blob: 4bbc95013f3bf7816f6c8020001fe8ffb7ea6bdf [file] [log] [blame]
Damien Millerab18c411999-11-11 10:40:23 +11001AC_INIT(ssh.c)
Damien Miller7f6ea021999-10-28 13:25:17 +10002
3AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +11004AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +11005AC_CANONICAL_HOST
Damien Miller7f6ea021999-10-28 13:25:17 +10006
Damien Millera22ba012000-03-02 23:09:20 +11007# Checks for programs.
Damien Millerab18c411999-11-11 10:40:23 +11008AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +10009AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110010AC_PROG_INSTALL
Damien Millerc7b38ce1999-11-09 10:28:04 +110011AC_CHECK_PROG(AR, ar, ar)
Damien Millere79334a1999-12-29 10:03:37 +110012AC_PATH_PROG(PERL, perl)
13AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100014AC_PATH_PROG(ENT, ent)
15AC_SUBST(ENT)
Damien Miller78315eb2000-09-29 23:01:36 +110016AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin)
Damien Miller2e1b0821999-12-25 10:11:29 +110017
Damien Millerad833b32000-08-23 10:46:23 +100018# Use LOGIN_PROGRAM from environment if possible
19if test ! -z "$LOGIN_PROGRAM" ; then
20 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
21else
22 # Search for login
23 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
24 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
25 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
26 fi
27fi
28
Damien Miller166bd442000-03-16 10:48:25 +110029if test -z "$LD" ; then
30 LD=$CC
31fi
32AC_SUBST(LD)
33
34# C Compiler features
35AC_C_INLINE
36if test "$GCC" = "yes"; then
37 CFLAGS="$CFLAGS -Wall"
38fi
39
Damien Miller78315eb2000-09-29 23:01:36 +110040CFLAGS="$CFLAGS -I. -I${srcdir-.}"
41
Damien Millera22ba012000-03-02 23:09:20 +110042# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110043case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110044*-*-aix*)
45 AFS_LIBS="-lld"
Damien Millerdb819592000-03-14 13:44:01 +110046 CFLAGS="$CFLAGS -I/usr/local/include"
47 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100048 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Miller29ea30d2000-03-17 10:54:15 +110049 blibpath="/usr/lib:/lib:/usr/local/lib"
50 fi
Damien Millerd2c208a2000-05-17 22:00:02 +100051 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
Damien Millereca71f82000-01-20 22:38:27 +110052 AC_DEFINE(BROKEN_GETADDRINFO)
andree441aa32000-06-12 22:34:38 +000053 MANTYPE='$(CATMAN)'
54 mansubdir=cat
andre60f3c982000-06-03 16:18:19 +000055 dnl AIX handles lastlog as part of its login message
56 AC_DEFINE(DISABLE_LASTLOG)
Damien Miller5fc85652000-07-09 23:53:07 +100057 MANTYPE='$(CATMAN)'
58 mansubdir=cat
Damien Miller75b1d102000-01-07 14:01:41 +110059 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110060*-*-cygwin*)
Damien Milleref767ac2000-10-17 23:14:08 +110061 LIBS="$LIBS -lregex /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +110062 AC_DEFINE(HAVE_CYGWIN)
63 AC_DEFINE(DISABLE_PAM)
64 AC_DEFINE(DISABLE_SHADOW)
65 AC_DEFINE(IPV4_DEFAULT)
66 AC_DEFINE(IP_TOS_IS_BROKEN)
67 AC_DEFINE(BROKEN_VHANGUP)
68 no_pam=1
69 no_libsocket=1
70 no_libnsl=1
71 ;;
Damien Miller76112de1999-12-21 11:18:08 +110072*-*-hpux10*)
73 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100074 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110075 fi
76 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110077 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +100078 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110079 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110080 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000081 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Damien Miller8a1e6a62000-09-16 15:55:52 +110082 LIBS="$LIBS -lsec"
Damien Miller670a4b82000-01-22 13:53:11 +110083 MANTYPE='$(CATMAN)'
84 mansubdir=cat
Damien Miller76112de1999-12-21 11:18:08 +110085 ;;
Damien Miller1bead332000-04-30 00:47:29 +100086*-*-hpux11*)
Damien Miller1bead332000-04-30 00:47:29 +100087 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110088 IPADDR_IN_DISPLAY=yes
Damien Miller5552d7a2000-08-30 09:53:24 +110089 AC_DEFINE(USE_PIPES)
Damien Miller8a1e6a62000-09-16 15:55:52 +110090 AC_DEFINE(DISABLE_SHADOW)
Damien Millerd6f204d2000-09-23 13:57:27 +110091 AC_DEFINE(DISABLE_UTMP)
Kevin Steves8848b242000-10-18 13:11:44 +000092 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Damien Miller8a1e6a62000-09-16 15:55:52 +110093 LIBS="$LIBS -lsec"
Damien Miller1bead332000-04-30 00:47:29 +100094 MANTYPE='$(CATMAN)'
95 mansubdir=cat
96 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +110097*-*-irix5*)
Damien Millerdb819592000-03-14 13:44:01 +110098 CFLAGS="$CFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +100099 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100100 PATH="$PATH:/usr/etc"
Damien Miller07278932000-01-22 14:05:37 +1100101 MANTYPE='$(CATMAN)'
Damien Miller1808f382000-01-06 12:03:12 +1100102 no_libsocket=1
103 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000104 AC_DEFINE(BROKEN_INET_NTOA)
Damien Miller1808f382000-01-06 12:03:12 +1100105 ;;
106*-*-irix6*)
Damien Millerdb819592000-03-14 13:44:01 +1100107 CFLAGS="$CFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000108 LDFLAGS="$LDFLAGS"
Damien Miller190d5a82000-09-30 09:43:19 +1100109 PATH="$PATH:/usr/etc"
Damien Miller07278932000-01-22 14:05:37 +1100110 MANTYPE='$(CATMAN)'
Damien Miller91606b12000-06-28 08:22:29 +1000111 AC_DEFINE(WITH_IRIX_ARRAY)
112 AC_DEFINE(WITH_IRIX_PROJECT)
113 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000114 AC_DEFINE(WITH_IRIX_JOBS)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100115 no_libsocket=1
116 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000117 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100118 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100119*-*-linux*)
120 no_dev_ptmx=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100121 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000122 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100123 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100124 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000125mips-sony-bsd|mips-sony-newsos4)
126 AC_DEFINE(HAVE_NEWS4)
127 SONY=1
128 AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT),
129 AC_MSG_ERROR([*** libiberty missing - please install first ***])
130 )
131 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100132*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100133 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100134 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000135*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000136 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100137 conf_utmp_location=/etc/utmp
138 conf_wtmp_location=/usr/adm/wtmp
139 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000140 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000141 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000142 AC_DEFINE(USE_PIPES)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000143 CFLAGS="$CFLAGS -I/usr/local/include"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000144 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100145*-*-solaris*)
Damien Millerdb819592000-03-14 13:44:01 +1100146 CFLAGS="$CFLAGS -I/usr/local/include"
Damien Miller08c788a2000-03-16 07:52:29 +1100147 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
Damien Millera22ba012000-03-02 23:09:20 +1100148 need_dash_r=1
andre2ff7b5d2000-06-03 14:57:40 +0000149 # hardwire lastlog location (can't detect it on some versions)
150 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000151 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
152 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
153 if test "$sol2ver" -ge 8; then
154 AC_MSG_RESULT(yes)
155 AC_DEFINE(DISABLE_UTMP)
156 AC_DEFINE(DISABLE_WTMP)
157 else
158 AC_MSG_RESULT(no)
159 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100160 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000161*-*-sunos4*)
162 CFLAGS="$CFLAGS -DSUNOS4"
163 AC_CHECK_FUNCS(getpwanam)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000164 conf_utmp_location=/etc/utmp
165 conf_wtmp_location=/var/adm/wtmp
166 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000167 AC_DEFINE(USE_PIPES)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000168 MANTYPE='$(CATMAN)'
169 mansubdir=cat
Damien Millerdfc83f42000-05-20 15:02:59 +1000170 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000171*-sni-sysv*)
172 CFLAGS="$CFLAGS -I/usr/local/include"
173 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
174 MANTYPE='$(CATMAN)'
175 AC_DEFINE(IP_TOS_IS_BROKEN)
176 mansubdir=cat
Damien Millerb2dc28e2000-07-12 09:18:33 +1000177 LIBS="$LIBS -lgen -lnsl -lucb"
Damien Miller2ae714f2000-07-11 09:29:50 +1000178 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100179*-*-sysv4.2*)
180 CFLAGS="$CFLAGS -I/usr/local/include"
181 LDFLAGS="$LDFLAGS -L/usr/local/lib"
182 MANTYPE='$(CATMAN)'
183 mansubdir=cat
184 LIBS="$LIBS -lgen -lsocket -lnsl -lresolv"
185 enable_suid_ssh=no
186 ;;
187*-*-sysv5*)
188 CFLAGS="$CFLAGS -I/usr/local/include"
189 LDFLAGS="$LDFLAGS -L/usr/local/lib"
190 MANTYPE='$(CATMAN)'
191 mansubdir=cat
192 LIBS="$LIBS -lgen -lsocket"
193 enable_suid_ssh=no
194 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100195*-*-sysv*)
Damien Millerdb819592000-03-14 13:44:01 +1100196 CFLAGS="$CFLAGS -I/usr/local/include"
197 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller0e1cf7c2000-01-26 12:15:30 +1100198 MANTYPE='$(CATMAN)'
199 mansubdir=cat
Damien Miller75b1d102000-01-07 14:01:41 +1100200 LIBS="$LIBS -lgen -lsocket"
201 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100202*-*-sco3.2v4*)
Damien Miller238a9fa2000-08-31 09:20:05 +1100203 AC_DEFINE(USE_PIPES)
Damien Miller78315eb2000-09-29 23:01:36 +1100204 CFLAGS="$CFLAGS -Dftruncate=chsize -I/usr/local/include"
205 LDFLAGS="$LDFLAGS -L/usr/local/lib"
206 MANTYPE='$(CATMAN)'
207 mansubdir=cat
Ben Lindstrom980754c2000-11-12 00:04:24 +0000208 LIBS="$LIBS -lgen -lsocket -los -lprot -lx -ltinfo -lm"
Damien Miller78315eb2000-09-29 23:01:36 +1100209 no_dev_ptmx=1
210 RANLIB=true
211 AC_DEFINE(BROKEN_SYS_TERMIO_H)
212 rsh_path="/usr/bin/rcmd"
213 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000214 AC_DEFINE(DISABLE_SHADOW)
Damien Miller78315eb2000-09-29 23:01:36 +1100215 ;;
216*-*-sco3.2v5*)
Damien Millera66626b2000-06-13 18:57:53 +1000217 CFLAGS="$CFLAGS -I/usr/local/include"
218 LDFLAGS="$LDFLAGS -L/usr/local/lib"
219 MANTYPE='$(CATMAN)'
220 mansubdir=cat
Ben Lindstrom980754c2000-11-12 00:04:24 +0000221 LIBS="$LIBS -lgen -lsocket -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000222 no_dev_ptmx=1
Damien Miller78315eb2000-09-29 23:01:36 +1100223 rsh_path="/usr/bin/rcmd"
224 AC_DEFINE(HAVE_SCO_PROTECTED_PW)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000225 AC_DEFINE(DISABLE_SHADOW)
Damien Millera66626b2000-06-13 18:57:53 +1000226 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000227*-dec-osf*)
228# This is untested
229 if test ! -z "USE_SIA" ; then
230 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
231 if test -f /etc/sia/matrix.conf; then
232 AC_MSG_RESULT(yes)
233 AC_DEFINE(HAVE_OSF_SIA)
234 AC_DEFINE(DISABLE_LOGIN)
235 LIBS="$LIBS -lsecurity -ldb -lm -laud"
236 else
237 AC_MSG_RESULT(no)
238 fi
239 fi
240 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100241esac
242
Damien Millere37bfc12000-06-05 09:37:43 +1000243# Allow user to specify flags
244AC_ARG_WITH(cflags,
245 [ --with-cflags Specify additional flags to pass to compiler],
246 [
247 if test "x$withval" != "xno" ; then
248 CFLAGS="$CFLAGS $withval"
249 fi
250 ]
251)
252AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000253 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000254 [
255 if test "x$withval" != "xno" ; then
256 LDFLAGS="$LDFLAGS $withval"
257 fi
258 ]
259)
260AC_ARG_WITH(libs,
261 [ --with-libs Specify additional libraries to link with],
262 [
263 if test "x$withval" != "xno" ; then
264 LIBS="$LIBS $withval"
265 fi
266 ]
267)
268
269
Damien Millera22ba012000-03-02 23:09:20 +1100270# Checks for libraries.
Damien Millerab18c411999-11-11 10:40:23 +1100271AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
272AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Miller6f9c3372000-10-25 10:06:04 +1100273
274AC_CHECK_FUNC(regcomp,
275 [],
276 [
277 AC_CHECK_LIB(pcre, pcre_info,
278 AC_DEFINE(HAVE_LIBPCRE) LIBS="$LIBS -lpcreposix -lpcre")
279 ]
280)
Damien Millerab18c411999-11-11 10:40:23 +1100281
Damien Millerbeb4ba51999-12-28 15:09:35 +1100282if test -z "$no_libsocket" ; then
283 AC_CHECK_LIB(nsl, yp_match, , )
284fi
285if test -z "$no_libnsl" ; then
286 AC_CHECK_LIB(socket, main, , )
Damien Miller32b3cf21999-12-26 10:21:48 +1100287fi
Damien Millerab18c411999-11-11 10:40:23 +1100288
Damien Millera22ba012000-03-02 23:09:20 +1100289# Checks for header files.
Damien Miller874d77b2000-10-14 16:23:11 +1100290AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h sys/un.h stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h vis.h)
Damien Millerab18c411999-11-11 10:40:23 +1100291
Damien Millerad833b32000-08-23 10:46:23 +1000292dnl Checks for library functions.
Ben Lindstrom67e21e12000-11-05 09:08:45 +0000293AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getnameinfo getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setenv seteuid setlogin setproctitle setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strsep strtok_r vsnprintf vhangup vis waitpid _getpty __b64_ntop)
Damien Millerad833b32000-08-23 10:46:23 +1000294dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000295AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000296dnl Checks for libutil functions
andre2ff7b5d2000-06-03 14:57:40 +0000297AC_CHECK_FUNCS(login logout updwtmp logwtmp)
Damien Millerad833b32000-08-23 10:46:23 +1000298dnl Checks for utmp functions
andre2ff7b5d2000-06-03 14:57:40 +0000299AC_CHECK_FUNCS(entutent getutent getutid getutline pututline setutent)
300AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000301dnl Checks for utmpx functions
andre2ff7b5d2000-06-03 14:57:40 +0000302AC_CHECK_FUNCS(entutxent getutxent getutxid getutxline pututxline )
303AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100304
Damien Miller5fc85652000-07-09 23:53:07 +1000305AC_CHECK_FUNC(getuserattr,
306 [AC_DEFINE(HAVE_GETUSERATTR)],
307 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
308)
309
Damien Miller04f80141999-11-19 15:32:34 +1100310AC_CHECK_FUNC(login,
311 [AC_DEFINE(HAVE_LOGIN)],
312 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
313)
314
315AC_CHECK_FUNC(daemon,
316 [AC_DEFINE(HAVE_DAEMON)],
317 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
318)
319
Damien Miller9fb07e42000-03-05 16:22:59 +1100320AC_CHECK_FUNC(getpagesize,
321 [AC_DEFINE(HAVE_GETPAGESIZE)],
322 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
323)
324
Damien Millercb170cb2000-07-01 16:52:55 +1000325# Check for broken snprintf
326if test "x$ac_cv_func_snprintf" = "xyes" ; then
327 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
328 AC_TRY_RUN(
329 [
330#include <stdio.h>
331int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
332 ],
333 [AC_MSG_RESULT(yes)],
334 [
335 AC_MSG_RESULT(no)
336 AC_DEFINE(BROKEN_SNPRINTF)
337 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
338 ]
339 )
340fi
341
Damien Miller606f8802000-09-16 15:39:56 +1100342AC_FUNC_GETPGRP
343
Damien Miller7b22d652000-06-18 14:07:04 +1000344PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100345AC_ARG_WITH(pam,
346 [ --without-pam Disable PAM support ],
347 [
348 if test "x$withval" = "xno" ; then
349 no_pam=1
350 AC_DEFINE(DISABLE_PAM)
Damien Miller7b22d652000-06-18 14:07:04 +1000351 PAM_MSG="disabled"
Damien Millera22ba012000-03-02 23:09:20 +1100352 fi
353 ]
354)
Damien Milleredb82922000-06-20 13:25:52 +1000355if (test -z "$no_pam" && test "x$ac_cv_header_security_pam_appl_h" = "xyes") ; then
Damien Millera22ba012000-03-02 23:09:20 +1100356 AC_CHECK_LIB(dl, dlopen, , )
357 LIBS="$LIBS -lpam"
358
Damien Miller0e65eed2000-05-17 22:16:05 +1000359 AC_CHECK_FUNCS(pam_getenvlist)
Damien Miller1bead332000-04-30 00:47:29 +1000360
Damien Miller1f335fb2000-06-26 11:31:33 +1000361 disable_shadow=yes
362
Damien Miller7b22d652000-06-18 14:07:04 +1000363 PAM_MSG="yes"
364
Damien Millera22ba012000-03-02 23:09:20 +1100365 # Check PAM strerror arguments (old PAM)
366 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
367 AC_TRY_COMPILE(
368 [
Damien Miller81171112000-04-23 11:14:01 +1000369#include <stdlib.h>
370#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100371 ],
372 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
373 [AC_MSG_RESULT(no)],
374 [
375 AC_DEFINE(HAVE_OLD_PAM)
376 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000377 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100378 ]
379 )
380fi
381
382# The big search for OpenSSL
383AC_ARG_WITH(ssl-dir,
384 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
385 [
Ben Lindstrom23e13712000-10-29 22:49:19 +0000386 if test "x$withval" != "xno" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100387 tryssldir=$withval
388 fi
389 ]
390)
391
392saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100393saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100394saved_CFLAGS="$CFLAGS"
395if test "x$prefix" != "xNONE" ; then
396 tryssldir="$tryssldir $prefix"
397fi
Damien Miller61e50f12000-05-08 20:49:37 +1000398AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera22ba012000-03-02 23:09:20 +1100399
Damien Millera1b61e12000-09-16 17:02:16 +1100400 for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
Damien Miller61e50f12000-05-08 20:49:37 +1000401 if test ! -z "$ssldir" ; then
402 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
403 CFLAGS="$saved_CFLAGS -I$ssldir/include"
404 if test ! -z "$need_dash_r" ; then
405 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
406 fi
Damien Millera1ad4802000-03-15 10:04:54 +1100407 else
Damien Miller61e50f12000-05-08 20:49:37 +1000408 LDFLAGS="$saved_LDFLAGS"
Damien Millerb85dcad2000-03-11 11:37:00 +1100409 fi
410
Damien Miller3b512e12000-05-17 23:29:18 +1000411 LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000412
Damien Miller3b512e12000-05-17 23:29:18 +1000413 # Basic test to check for compatible version and correct linking
414 # *does not* test for RSA - that comes later.
415 AC_TRY_RUN(
416 [
Damien Millere59ce622000-05-01 20:54:17 +1000417#include <string.h>
418#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000419int main(void)
420{
Damien Miller3b512e12000-05-17 23:29:18 +1000421 char a[2048];
422 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000423 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000424 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000425}
Damien Miller3b512e12000-05-17 23:29:18 +1000426 ],
427 [
428 found_crypto=1
429 break;
430 ], []
431 )
Damien Miller61e50f12000-05-08 20:49:37 +1000432
433 if test ! -z "$found_crypto" ; then
434 break;
435 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100436 done
437
Damien Miller61e50f12000-05-08 20:49:37 +1000438 if test -z "$found_crypto" ; then
439 AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])
Damien Millerb85dcad2000-03-11 11:37:00 +1100440 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000441 if test -z "$ssldir" ; then
442 ssldir="(system)"
443 fi
Damien Millera22ba012000-03-02 23:09:20 +1100444
Damien Miller61e50f12000-05-08 20:49:37 +1000445 ac_cv_openssldir=$ssldir
446])
447
Damien Milleredb82922000-06-20 13:25:52 +1000448if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000449 AC_DEFINE(HAVE_OPENSSL)
450 dnl Need to recover ssldir - test above runs in subshell
451 ssldir=$ac_cv_openssldir
Damien Millera1ad4802000-03-15 10:04:54 +1100452 CFLAGS="$saved_CFLAGS -I$ssldir/include"
453 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
454 if test ! -z "$need_dash_r" ; then
455 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
Damien Millera22ba012000-03-02 23:09:20 +1100456 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100457 if test ! -z "$blibpath" ; then
458 blibpath="$blibpath:$ssldir:$ssldir/lib"
459 fi
Damien Millera22ba012000-03-02 23:09:20 +1100460fi
Damien Miller3b512e12000-05-17 23:29:18 +1000461LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000462
Damien Miller3b512e12000-05-17 23:29:18 +1000463# Now test RSA support
464saved_LIBS="$LIBS"
465AC_MSG_CHECKING([for RSA support])
466for WANTS_RSAREF in "" 1 ; do
467 if test -z "$WANTS_RSAREF" ; then
468 LIBS="$saved_LIBS"
469 else
470 LIBS="$saved_LIBS -lRSAglue -lrsaref"
471 fi
472 AC_TRY_RUN([
473#include <string.h>
474#include <openssl/rand.h>
475#include <openssl/rsa.h>
476#include <openssl/bn.h>
477#include <openssl/sha.h>
478int main(void)
479{
480 int num; RSA *key; static unsigned char p_in[] = "blahblah";
481 unsigned char c[256], p[256];
482 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
483 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
484 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
485 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
486}
487 ],
488 [
489 rsa_works=1
490 break;
491 ], [])
492done
493
494if test ! -z "$no_rsa" ; then
495 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000496 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000497else
498 if test -z "$rsa_works" ; then
499 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000500 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000501 else
502 if test -z "$WANTS_RSAREF" ; then
503 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000504 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000505 else
Damien Miller7b22d652000-06-18 14:07:04 +1000506 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000507 AC_MSG_RESULT(using RSAref)
508 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
509 fi
510 fi
511fi
Damien Millera22ba012000-03-02 23:09:20 +1100512
Ben Lindstromb5628642000-10-18 00:02:25 +0000513# Cheap hack to ensure NEWS-OS libraries are arranged right.
514if test ! -z "$SONY" ; then
515 LIBS="$LIBS -liberty";
516fi
517
Damien Millera22ba012000-03-02 23:09:20 +1100518# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100519AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100520AC_CHECK_SIZEOF(short int, 2)
521AC_CHECK_SIZEOF(int, 4)
522AC_CHECK_SIZEOF(long int, 4)
523AC_CHECK_SIZEOF(long long int, 8)
524
Damien Millera22ba012000-03-02 23:09:20 +1100525# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100526AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
527 AC_TRY_COMPILE(
528 [ #include <sys/types.h> ],
529 [ u_int a; a = 1;],
530 [ ac_cv_have_u_int="yes" ],
531 [ ac_cv_have_u_int="no" ]
532 )
533])
534if test "x$ac_cv_have_u_int" = "xyes" ; then
535 AC_DEFINE(HAVE_U_INT)
536 have_u_int=1
537fi
538
Damien Miller61e50f12000-05-08 20:49:37 +1000539AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
540 AC_TRY_COMPILE(
541 [ #include <sys/types.h> ],
542 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
543 [ ac_cv_have_intxx_t="yes" ],
544 [ ac_cv_have_intxx_t="no" ]
545 )
546])
547if test "x$ac_cv_have_intxx_t" = "xyes" ; then
548 AC_DEFINE(HAVE_INTXX_T)
549 have_intxx_t=1
550fi
551
Damien Miller578783e2000-09-23 14:12:24 +1100552AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
553 AC_TRY_COMPILE(
554 [ #include <sys/types.h> ],
555 [ int64_t a; a = 1;],
556 [ ac_cv_have_int64_t="yes" ],
557 [ ac_cv_have_int64_t="no" ]
558 )
559])
560if test "x$ac_cv_have_int64_t" = "xyes" ; then
561 AC_DEFINE(HAVE_INT64_T)
562 have_int64_t=1
563fi
564
Damien Miller61e50f12000-05-08 20:49:37 +1000565AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
566 AC_TRY_COMPILE(
567 [ #include <sys/types.h> ],
568 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
569 [ ac_cv_have_u_intxx_t="yes" ],
570 [ ac_cv_have_u_intxx_t="no" ]
571 )
572])
573if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
574 AC_DEFINE(HAVE_U_INTXX_T)
575 have_u_intxx_t=1
576fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100577
Damien Miller578783e2000-09-23 14:12:24 +1100578AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
579 AC_TRY_COMPILE(
580 [ #include <sys/types.h> ],
581 [ u_int64_t a; a = 1;],
582 [ ac_cv_have_u_int64_t="yes" ],
583 [ ac_cv_have_u_int64_t="no" ]
584 )
585])
586if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
587 AC_DEFINE(HAVE_U_INT64_T)
588 have_u_int64_t=1
589fi
590
Damien Milleredb82922000-06-20 13:25:52 +1000591if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
592 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +1100593then
594 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
595 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +1000596 [
597#include <sys/bitypes.h>
598 ],
Damien Millerb29ea912000-01-15 14:12:03 +1100599 [
Damien Miller70494d12000-04-03 15:57:06 +1000600 int8_t a; int16_t b; int32_t c;
601 u_int8_t e; u_int16_t f; u_int32_t g;
602 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +1100603 ],
604 [
605 AC_DEFINE(HAVE_U_INTXX_T)
606 AC_DEFINE(HAVE_INTXX_T)
607 AC_MSG_RESULT(yes)
608 ],
609 [AC_MSG_RESULT(no)]
610 )
611fi
612
Damien Millerd6121d22000-03-17 23:26:46 +1100613if test -z "$have_u_intxx_t" ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000614 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
615 AC_TRY_COMPILE(
616 [
617#include <sys/types.h>
618 ],
619 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
620 [ ac_cv_have_uintxx_t="yes" ],
621 [ ac_cv_have_uintxx_t="no" ]
622 )
623 ])
624 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
625 AC_DEFINE(HAVE_UINTXX_T)
626 fi
Damien Millerd6121d22000-03-17 23:26:46 +1100627fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100628
Damien Miller61e50f12000-05-08 20:49:37 +1000629AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
630 AC_TRY_COMPILE(
631 [
Damien Miller81171112000-04-23 11:14:01 +1000632#include <sys/types.h>
633#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000634 ],
635 [socklen_t foo; foo = 1235;],
636 [ ac_cv_have_socklen_t="yes" ],
637 [ ac_cv_have_socklen_t="no" ]
638 )
639])
640if test "x$ac_cv_have_socklen_t" = "xyes" ; then
641 AC_DEFINE(HAVE_SOCKLEN_T)
642fi
Damien Miller74d0d4a1999-12-29 02:24:35 +1100643
Damien Miller61e50f12000-05-08 20:49:37 +1000644AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
645 AC_TRY_COMPILE(
646 [
647#include <sys/types.h>
648 ],
649 [ size_t foo; foo = 1235; ],
650 [ ac_cv_have_size_t="yes" ],
651 [ ac_cv_have_size_t="no" ]
652 )
653])
654if test "x$ac_cv_have_size_t" = "xyes" ; then
655 AC_DEFINE(HAVE_SIZE_T)
656fi
Damien Miller95058511999-12-29 10:36:45 +1100657
Damien Miller615f9392000-05-17 22:53:33 +1000658AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
659 AC_TRY_COMPILE(
660 [
661#include <sys/types.h>
662 ],
663 [ ssize_t foo; foo = 1235; ],
664 [ ac_cv_have_ssize_t="yes" ],
665 [ ac_cv_have_ssize_t="no" ]
666 )
667])
668if test "x$ac_cv_have_ssize_t" = "xyes" ; then
669 AC_DEFINE(HAVE_SSIZE_T)
670fi
671
Damien Millerb54b40e2000-06-23 08:23:34 +1000672AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
673 AC_TRY_COMPILE(
674 [
675#include <sys/types.h>
676#include <sys/socket.h>
677 ],
678 [ sa_family_t foo; foo = 1235; ],
679 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +1100680 [ AC_TRY_COMPILE(
681 [
682#include <sys/types.h>
683#include <sys/socket.h>
684#include <netinet/in.h>
685 ],
686 [ sa_family_t foo; foo = 1235; ],
687 [ ac_cv_have_sa_family_t="yes" ],
688
Damien Millerb54b40e2000-06-23 08:23:34 +1000689 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +1100690 )]
Damien Millerb54b40e2000-06-23 08:23:34 +1000691 )
692])
693if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
694 AC_DEFINE(HAVE_SA_FAMILY_T)
695fi
696
Damien Miller0f91b4e2000-06-18 15:43:25 +1000697AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
698 AC_TRY_COMPILE(
699 [
700#include <sys/types.h>
701 ],
702 [ pid_t foo; foo = 1235; ],
703 [ ac_cv_have_pid_t="yes" ],
704 [ ac_cv_have_pid_t="no" ]
705 )
706])
707if test "x$ac_cv_have_pid_t" = "xyes" ; then
708 AC_DEFINE(HAVE_PID_T)
709fi
710
711AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
712 AC_TRY_COMPILE(
713 [
714#include <sys/types.h>
715 ],
716 [ mode_t foo; foo = 1235; ],
717 [ ac_cv_have_mode_t="yes" ],
718 [ ac_cv_have_mode_t="no" ]
719 )
720])
721if test "x$ac_cv_have_mode_t" = "xyes" ; then
722 AC_DEFINE(HAVE_MODE_T)
723fi
724
Damien Miller61e50f12000-05-08 20:49:37 +1000725
726AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
727 AC_TRY_COMPILE(
728 [
Damien Miller81171112000-04-23 11:14:01 +1000729#include <sys/types.h>
730#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000731 ],
732 [ struct sockaddr_storage s; ],
733 [ ac_cv_have_struct_sockaddr_storage="yes" ],
734 [ ac_cv_have_struct_sockaddr_storage="no" ]
735 )
736])
737if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
738 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
739fi
Damien Miller34132e52000-01-14 15:45:46 +1100740
Damien Miller61e50f12000-05-08 20:49:37 +1000741AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
742 AC_TRY_COMPILE(
743 [
Damien Miller7b22d652000-06-18 14:07:04 +1000744#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000745#include <netinet/in.h>
746 ],
747 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
748 [ ac_cv_have_struct_sockaddr_in6="yes" ],
749 [ ac_cv_have_struct_sockaddr_in6="no" ]
750 )
751])
752if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
753 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
754fi
Damien Miller34132e52000-01-14 15:45:46 +1100755
Damien Miller61e50f12000-05-08 20:49:37 +1000756AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
757 AC_TRY_COMPILE(
758 [
Damien Miller7b22d652000-06-18 14:07:04 +1000759#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000760#include <netinet/in.h>
761 ],
762 [ struct in6_addr s; s.s6_addr[0] = 0; ],
763 [ ac_cv_have_struct_in6_addr="yes" ],
764 [ ac_cv_have_struct_in6_addr="no" ]
765 )
766])
767if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
768 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
769fi
Damien Miller34132e52000-01-14 15:45:46 +1100770
Damien Miller61e50f12000-05-08 20:49:37 +1000771AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
772 AC_TRY_COMPILE(
773 [
Damien Miller81171112000-04-23 11:14:01 +1000774#include <sys/types.h>
775#include <sys/socket.h>
776#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000777 ],
778 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
779 [ ac_cv_have_struct_addrinfo="yes" ],
780 [ ac_cv_have_struct_addrinfo="no" ]
781 )
782])
783if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
784 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
785fi
786
Damien Miller78315eb2000-09-29 23:01:36 +1100787dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +1000788OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
789OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
790OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
791OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
792OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +1000793OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +1000794OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
795OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +1000796OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +1000797OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
798OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
799OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
800OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +0000801OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
802OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
803OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
804OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Damien Miller78315eb2000-09-29 23:01:36 +1100805AC_STRUCT_ST_BLKSIZE
andre2ff7b5d2000-06-03 14:57:40 +0000806
Damien Miller942da032000-08-18 13:59:06 +1000807AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
808 ac_cv_have_sun_len_in_struct_sockaddr_un, [
809 AC_TRY_COMPILE(
810 [
811#include <sys/types.h>
812#include <sys/socket.h>
813 ],
814 [ struct sockaddr_un s; s.sun_len = 1; ],
815 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
816 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
817 )
818])
819if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
820 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
821fi
822
Damien Miller61e50f12000-05-08 20:49:37 +1000823AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
824 ac_cv_have_ss_family_in_struct_ss, [
825 AC_TRY_COMPILE(
826 [
Damien Miller81171112000-04-23 11:14:01 +1000827#include <sys/types.h>
828#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000829 ],
830 [ struct sockaddr_storage s; s.ss_family = 1; ],
831 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
832 [ ac_cv_have_ss_family_in_struct_ss="no" ],
833 )
834])
835if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
836 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
837fi
838
Damien Miller61e50f12000-05-08 20:49:37 +1000839AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
840 ac_cv_have___ss_family_in_struct_ss, [
841 AC_TRY_COMPILE(
842 [
Damien Miller81171112000-04-23 11:14:01 +1000843#include <sys/types.h>
844#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000845 ],
846 [ struct sockaddr_storage s; s.__ss_family = 1; ],
847 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
848 [ ac_cv_have___ss_family_in_struct_ss="no" ]
849 )
850])
851if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
852 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
853fi
Damien Millerbf1c9b21999-12-09 10:16:54 +1100854
Damien Millerad833b32000-08-23 10:46:23 +1000855AC_CACHE_CHECK([for pw_class field in struct passwd],
856 ac_cv_have_pw_class_in_struct_passwd, [
857 AC_TRY_COMPILE(
858 [
Damien Millerad833b32000-08-23 10:46:23 +1000859#include <pwd.h>
860 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +0000861 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +1000862 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
863 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
864 )
865])
866if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
867 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
868fi
869
Damien Miller61e50f12000-05-08 20:49:37 +1000870
871AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
872 AC_TRY_LINK([],
873 [ extern char *__progname; printf("%s", __progname); ],
874 [ ac_cv_libc_defines___progname="yes" ],
875 [ ac_cv_libc_defines___progname="no" ]
876 )
877])
878if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
879 AC_DEFINE(HAVE___PROGNAME)
880fi
881
Damien Millera22ba012000-03-02 23:09:20 +1100882
Damien Millerecbb26d2000-07-15 14:59:14 +1000883AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
884 AC_TRY_LINK([],
885 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
886 [ ac_cv_libc_defines_sys_errlist="yes" ],
887 [ ac_cv_libc_defines_sys_errlist="no" ]
888 )
889])
890if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
891 AC_DEFINE(HAVE_SYS_ERRLIST)
892fi
893
894
Damien Miller11fa2cc2000-08-16 10:35:58 +1000895AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
896 AC_TRY_LINK([],
897 [ extern int sys_nerr; printf("%i", sys_nerr);],
898 [ ac_cv_libc_defines_sys_nerr="yes" ],
899 [ ac_cv_libc_defines_sys_nerr="no" ]
900 )
901])
902if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
903 AC_DEFINE(HAVE_SYS_NERR)
904fi
905
906
Damien Millera22ba012000-03-02 23:09:20 +1100907# Looking for programs, paths and files
908AC_ARG_WITH(rsh,
909 [ --with-rsh=PATH Specify path to remote shell program ],
910 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100911 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +1000912 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +1100913 fi
914 ],
915 [
916 AC_PATH_PROG(rsh_path, rsh)
917 ]
918)
919
920AC_ARG_WITH(xauth,
921 [ --with-xauth=PATH Specify path to xauth program ],
922 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000923 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +1000924 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +1100925 fi
926 ],
927 [
Damien Miller78315eb2000-09-29 23:01:36 +1100928 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 +1000929 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +1100930 xauth_path="/usr/openwin/bin/xauth"
931 fi
932 ]
933)
934
935if test ! -z "$xauth_path" ; then
936 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
937fi
938if test ! -z "$rsh_path" ; then
939 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
940fi
941
942# Check for mail directory (last resort if we cannot get it from headers)
943if test ! -z "$MAIL" ; then
944 maildir=`dirname $MAIL`
945 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
946fi
947
Damien Millera22ba012000-03-02 23:09:20 +1100948if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +1100949 AC_CHECK_FILE("/dev/ptmx",
950 [
951 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
952 have_dev_ptmx=1
953 ]
954 )
Damien Millera22ba012000-03-02 23:09:20 +1100955fi
Damien Miller204ad072000-03-02 23:56:12 +1100956AC_CHECK_FILE("/dev/ptc",
957 [
958 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
959 have_dev_ptc=1
960 ]
961)
962
Damien Millera22ba012000-03-02 23:09:20 +1100963# Options from here on. Some of these are preset by platform above
964
Damien Millera22ba012000-03-02 23:09:20 +1100965# Check for user-specified random device, otherwise check /dev/urandom
966AC_ARG_WITH(random,
967 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
968 [
Damien Miller040f3832000-04-03 14:50:43 +1000969 if test "x$withval" != "xno" ; then
970 RANDOM_POOL="$withval";
971 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
972 fi
Damien Millera22ba012000-03-02 23:09:20 +1100973 ],
974 [
975 # Check for random device
976 AC_CHECK_FILE("/dev/urandom",
977 [
978 RANDOM_POOL="/dev/urandom";
979 AC_SUBST(RANDOM_POOL)
980 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
981 ]
982 )
983 ]
984)
985
986# Check for EGD pool file
987AC_ARG_WITH(egd-pool,
988 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
989 [
Damien Miller040f3832000-04-03 14:50:43 +1000990 if test "x$withval" != "xno" ; then
991 EGD_SOCKET="$withval";
992 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
993 fi
Damien Millera22ba012000-03-02 23:09:20 +1100994 ]
995)
996
Damien Miller0437b332000-05-02 09:56:41 +1000997# detect pathnames for entropy gathering commands, if we need them
998INSTALL_SSH_PRNG_CMDS=""
999rm -f prng_commands
Damien Milleredb82922000-06-20 13:25:52 +10001000if (test -z "$RANDOM_POOL" && test -z "$EGD_SOCKET") ; then
Damien Miller11e37f62000-04-08 18:23:30 +10001001 # Use these commands to collect entropy
Damien Miller61e50f12000-05-08 20:49:37 +10001002 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1003 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1004 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1005 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1006 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1007 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1008 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1009 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1010 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1011 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1012 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1013 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1014 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1015 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1016 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
Damien Miller0437b332000-05-02 09:56:41 +10001017
1018 INSTALL_SSH_PRNG_CMDS="yes"
Damien Miller11e37f62000-04-08 18:23:30 +10001019fi
Damien Miller0437b332000-05-02 09:56:41 +10001020AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1021
Damien Miller11e37f62000-04-08 18:23:30 +10001022
Damien Miller670a4b82000-01-22 13:53:11 +11001023AC_ARG_WITH(catman,
1024 [ --with-catman=man|cat Install preformatted manpages[no]],
1025 [
1026 MANTYPE='$(CATMAN)'
1027 if test x"$withval" != x"yes" ; then
1028 mansubdir=$withval
1029 else
1030 mansubdir=cat
1031 fi
1032 ], [
1033 if test -z "$MANTYPE" ; then
1034 MANTYPE='$(TROFFMAN)'
1035 mansubdir=man
1036 fi
1037 ]
1038)
1039AC_SUBST(MANTYPE)
1040AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11001041
Damien Millera22ba012000-03-02 23:09:20 +11001042# Check whether user wants Kerberos support
Damien Miller7b22d652000-06-18 14:07:04 +10001043KRB4_MSG="no"
Damien Miller80297751999-11-19 13:03:25 +11001044AC_ARG_WITH(kerberos4,
Damien Miller105b7f02000-01-07 08:45:55 +11001045 [ --with-kerberos4=PATH Enable Kerberos 4 support],
Damien Miller80297751999-11-19 13:03:25 +11001046 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001047 if test "x$withval" != "xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +11001048
Ben Lindstrom23e13712000-10-29 22:49:19 +00001049 if test "x$withval" != "xyes" ; then
Damien Miller105b7f02000-01-07 08:45:55 +11001050 CFLAGS="$CFLAGS -I${withval}/include"
1051 LDFLAGS="$LDFLAGS -L${withval}/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +11001052 if test ! -z "$need_dash_r" ; then
1053 LDFLAGS="$LDFLAGS -R${withval}/lib"
1054 fi
1055 if test ! -z "$blibpath" ; then
1056 blibpath="$blibpath:${withval}/lib"
1057 fi
Damien Miller105b7f02000-01-07 08:45:55 +11001058 else
1059 if test -d /usr/include/kerberosIV ; then
1060 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
1061 fi
1062 fi
1063
1064 AC_CHECK_HEADERS(krb.h)
1065 AC_CHECK_LIB(krb, main)
1066 if test "$ac_cv_header_krb_h" != yes; then
1067 AC_MSG_WARN([Cannot find krb.h, build may fail])
1068 fi
1069 if test "$ac_cv_lib_krb_main" != yes; then
1070 AC_MSG_WARN([Cannot find libkrb, build may fail])
1071 fi
1072
Damien Millerc85f9b42000-01-29 10:20:21 +11001073 KLIBS="-lkrb -ldes"
Damien Miller105b7f02000-01-07 08:45:55 +11001074 AC_CHECK_LIB(resolv, dn_expand, , )
1075 KRB4=yes
Damien Miller7b22d652000-06-18 14:07:04 +10001076 KRB4_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001077 AC_DEFINE(KRB4)
Damien Miller8bdeee21999-12-30 15:50:54 +11001078 fi
Damien Miller80297751999-11-19 13:03:25 +11001079 ]
1080)
1081
Damien Millera22ba012000-03-02 23:09:20 +11001082# Check whether user wants AFS support
Damien Miller7b22d652000-06-18 14:07:04 +10001083AFS_MSG="no"
Damien Millerc6398ef1999-11-20 12:18:40 +11001084AC_ARG_WITH(afs,
Damien Miller105b7f02000-01-07 08:45:55 +11001085 [ --with-afs=PATH Enable AFS support],
Damien Miller80297751999-11-19 13:03:25 +11001086 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001087 if test "x$withval" != "xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +11001088
Ben Lindstrom76020ba2000-10-25 16:55:00 +00001089 if test "x$withval" != "xyes" ; then
Damien Miller105b7f02000-01-07 08:45:55 +11001090 CFLAGS="$CFLAGS -I${withval}/include"
Ben Lindstrom305fb002000-11-10 02:41:30 +00001091 LDFLAGS="$LDFLAGS -L${withval}/lib"
Damien Miller105b7f02000-01-07 08:45:55 +11001092 fi
1093
1094 if test -z "$KRB4" ; then
1095 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1096 fi
1097
Damien Miller8bdeee21999-12-30 15:50:54 +11001098 LIBS="$LIBS -lkafs"
Damien Miller105b7f02000-01-07 08:45:55 +11001099 if test ! -z "$AFS_LIBS" ; then
1100 LIBS="$LIBS $AFS_LIBS"
1101 fi
1102 AC_DEFINE(AFS)
Damien Miller7b22d652000-06-18 14:07:04 +10001103 AFS_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001104 fi
Damien Miller80297751999-11-19 13:03:25 +11001105 ]
1106)
Damien Millerc85f9b42000-01-29 10:20:21 +11001107LIBS="$LIBS $KLIBS"
Damien Miller80297751999-11-19 13:03:25 +11001108
Damien Millera22ba012000-03-02 23:09:20 +11001109# Check whether user wants S/Key support
Damien Miller7b22d652000-06-18 14:07:04 +10001110SKEY_MSG="no"
Damien Miller80297751999-11-19 13:03:25 +11001111AC_ARG_WITH(skey,
Ben Lindstrom305fb002000-11-10 02:41:30 +00001112 [ --with-skey=PATH Enable S/Key support],
Damien Miller80297751999-11-19 13:03:25 +11001113 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001114 if test "x$withval" != "xno" ; then
Ben Lindstrom305fb002000-11-10 02:41:30 +00001115
1116 if test "x$withval" != "xyes" ; then
1117 CFLAGS="$CFLAGS -I${withval}/include"
1118 LDFLAGS="$LDFLAGS -L${withval}/lib"
1119 fi
1120
Damien Miller8bdeee21999-12-30 15:50:54 +11001121 AC_DEFINE(SKEY)
1122 LIBS="$LIBS -lskey"
Damien Miller7b22d652000-06-18 14:07:04 +10001123 SKEY_MSG="yes"
Ben Lindstrom305fb002000-11-10 02:41:30 +00001124
1125 AC_CHECK_FUNC(skey_keyinfo,
1126 [],
1127 [
1128 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1129 ])
Damien Miller8bdeee21999-12-30 15:50:54 +11001130 fi
Damien Miller80297751999-11-19 13:03:25 +11001131 ]
1132)
1133
Damien Millera22ba012000-03-02 23:09:20 +11001134# Check whether user wants TCP wrappers support
Damien Miller7b22d652000-06-18 14:07:04 +10001135TCPW_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001136AC_ARG_WITH(tcp-wrappers,
Damien Miller80297751999-11-19 13:03:25 +11001137 [ --with-tcp-wrappers Enable tcpwrappers support],
1138 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001139 if test "x$withval" != "xno" ; then
Damien Miller65165f82000-03-05 17:02:45 +11001140 saved_LIBS="$LIBS"
Damien Miller105b7f02000-01-07 08:45:55 +11001141 LIBS="$LIBS -lwrap"
Damien Miller65165f82000-03-05 17:02:45 +11001142 AC_MSG_CHECKING(for libwrap)
1143 AC_TRY_LINK(
1144 [
Damien Miller81171112000-04-23 11:14:01 +10001145#include <tcpd.h>
Damien Miller65165f82000-03-05 17:02:45 +11001146 int deny_severity = 0, allow_severity = 0;
1147 ],
1148 [hosts_access(0);],
1149 [
1150 AC_MSG_RESULT(yes)
1151 AC_DEFINE(LIBWRAP)
Damien Miller7b22d652000-06-18 14:07:04 +10001152 TCPW_MSG="yes"
Damien Miller65165f82000-03-05 17:02:45 +11001153 ],
1154 [
Damien Miller7b22d652000-06-18 14:07:04 +10001155 AC_MSG_ERROR([*** libwrap missing])
Damien Miller65165f82000-03-05 17:02:45 +11001156 ]
1157 )
Damien Miller8bdeee21999-12-30 15:50:54 +11001158 fi
Damien Miller80297751999-11-19 13:03:25 +11001159 ]
1160)
1161
Damien Millera22ba012000-03-02 23:09:20 +11001162# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001163MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001164AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001165 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001166 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001167 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001168 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001169 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001170 fi
1171 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001172)
1173
Damien Millera22ba012000-03-02 23:09:20 +11001174# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001175AC_ARG_WITH(shadow,
1176 [ --without-shadow Disable shadow password support],
1177 [
1178 if test "x$withval" = "xno" ; then
1179 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001180 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001181 fi
1182 ]
1183)
1184
Damien Miller1f335fb2000-06-26 11:31:33 +10001185if test -z "$disable_shadow" ; then
1186 AC_MSG_CHECKING([if the systems has expire shadow information])
1187 AC_TRY_COMPILE(
1188 [
1189#include <sys/types.h>
1190#include <shadow.h>
1191 struct spwd sp;
1192 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1193 [ sp_expire_available=yes ], []
1194 )
1195
1196 if test "x$sp_expire_available" = "xyes" ; then
1197 AC_MSG_RESULT(yes)
1198 AC_DEFINE(HAS_SHADOW_EXPIRE)
1199 else
1200 AC_MSG_RESULT(no)
1201 fi
1202fi
1203
Damien Millera22ba012000-03-02 23:09:20 +11001204# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001205if test ! -z "$IPADDR_IN_DISPLAY" ; then
1206 DISPLAY_HACK_MSG="yes"
1207 AC_DEFINE(IPADDR_IN_DISPLAY)
1208else
1209 DISPLAY_HACK_MSG="no"
1210 AC_ARG_WITH(ipaddr-display,
1211 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1212 [
1213 if test "x$withval" != "xno" ; then
1214 AC_DEFINE(IPADDR_IN_DISPLAY)
1215 DISPLAY_HACK_MSG="yes"
1216 fi
1217 ]
1218 )
1219fi
Damien Miller76112de1999-12-21 11:18:08 +11001220
Damien Millera22ba012000-03-02 23:09:20 +11001221# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001222SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001223AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001224 [ --with-default-path=PATH Specify default \$PATH environment for server],
1225 [
1226 if test "x$withval" != "xno" ; then
Damien Millere68f92b2000-10-02 21:42:15 +11001227 AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
Damien Miller7b22d652000-06-18 14:07:04 +10001228 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001229 fi
1230 ]
1231)
1232
Damien Millera22ba012000-03-02 23:09:20 +11001233# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10001234IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11001235AC_ARG_WITH(ipv4-default,
1236 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1237 [
1238 if test "x$withval" != "xno" ; then
1239 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10001240 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11001241 fi
1242 ]
1243)
1244
Damien Miller61e50f12000-05-08 20:49:37 +10001245AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10001246IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11001247AC_ARG_WITH(4in6,
1248 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1249 [
1250 if test "x$withval" != "xno" ; then
1251 AC_MSG_RESULT(yes)
1252 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001253 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001254 else
1255 AC_MSG_RESULT(no)
1256 fi
1257 ],[
1258 if test "x$inet6_default_4in6" = "xyes"; then
1259 AC_MSG_RESULT([yes (default)])
1260 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001261 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001262 else
1263 AC_MSG_RESULT([no (default)])
1264 fi
1265 ]
1266)
1267
Damien Miller78315eb2000-09-29 23:01:36 +11001268AC_MSG_CHECKING(whether to install ssh as suid root)
1269AC_ARG_ENABLE(suid-ssh,
1270[ --enable-suid-ssh Install ssh as suid root (default)
1271 --disable-suid-ssh Install ssh without suid bit],
1272[ case "$enableval" in
1273 no)
1274 AC_MSG_RESULT(no)
1275 SSHMODE=0711
1276 ;;
1277 *) AC_MSG_RESULT(yes)
1278 SSHMODE=04711
1279 ;;
1280 esac ],
1281 AC_MSG_RESULT(yes)
1282 SSHMODE=04711
1283)
1284AC_SUBST(SSHMODE)
1285
1286
Damien Millera22ba012000-03-02 23:09:20 +11001287# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11001288piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +11001289AC_ARG_WITH(pid-dir,
1290 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1291 [
1292 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +11001293 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +11001294 fi
1295 ]
1296)
Damien Miller4018c192000-04-30 09:30:44 +10001297
Damien Miller78315eb2000-09-29 23:01:36 +11001298# make sure the directory exists
1299if test ! -d $piddir ; then
1300 piddir=`eval echo ${sysconfdir}`
1301 case $piddir in
1302 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
1303 esac
1304fi
1305
Damien Millerdbd250f2000-01-18 08:57:14 +11001306AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11001307AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11001308
andre2ff7b5d2000-06-03 14:57:40 +00001309dnl allow user to disable some login recording features
1310AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001311 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001312 [ AC_DEFINE(DISABLE_LASTLOG) ]
1313)
1314AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00001315 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001316 [ AC_DEFINE(DISABLE_UTMP) ]
1317)
1318AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00001319 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001320 [ AC_DEFINE(DISABLE_UTMPX) ]
1321)
1322AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00001323 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001324 [ AC_DEFINE(DISABLE_WTMP) ]
1325)
1326AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00001327 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001328 [ AC_DEFINE(DISABLE_WTMPX) ]
1329)
1330AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00001331 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001332 [ AC_DEFINE(DISABLE_LOGIN) ]
1333)
1334AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00001335 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001336 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1337)
1338AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00001339 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001340 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1341)
1342AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001343 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
andre2ff7b5d2000-06-03 14:57:40 +00001344 [ conf_lastlog_location="$withval"; ],)
1345
1346dnl lastlog, [uw]tmpx? detection
1347dnl NOTE: set the paths in the platform section to avoid the
1348dnl need for command-line parameters
1349dnl lastlog and [uw]tmp are subject to a file search if all else fails
1350
1351dnl lastlog detection
1352dnl NOTE: the code itself will detect if lastlog is a directory
1353AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1354AC_TRY_COMPILE([
1355#include <sys/types.h>
1356#include <utmp.h>
1357#ifdef HAVE_LASTLOG_H
1358# include <lastlog.h>
1359#endif
Damien Miller2994e082000-06-04 15:51:47 +10001360#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001361# include <paths.h>
1362#endif
1363 ],
1364 [ char *lastlog = LASTLOG_FILE; ],
1365 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10001366 [
1367 AC_MSG_RESULT(no)
1368 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1369 AC_TRY_COMPILE([
1370#include <sys/types.h>
1371#include <utmp.h>
1372#ifdef HAVE_LASTLOG_H
1373# include <lastlog.h>
1374#endif
1375#ifdef HAVE_PATHS_H
1376# include <paths.h>
1377#endif
1378 ],
1379 [ char *lastlog = _PATH_LASTLOG; ],
1380 [ AC_MSG_RESULT(yes) ],
1381 [
andree441aa32000-06-12 22:34:38 +00001382 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10001383 system_lastlog_path=no
1384 ])
1385 ]
andre2ff7b5d2000-06-03 14:57:40 +00001386)
Damien Miller2994e082000-06-04 15:51:47 +10001387
andre2ff7b5d2000-06-03 14:57:40 +00001388if test -z "$conf_lastlog_location"; then
1389 if test x"$system_lastlog_path" = x"no" ; then
1390 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10001391 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00001392 conf_lastlog_location=$f
1393 fi
1394 done
1395 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00001396 AC_MSG_WARN([** Cannot find lastlog **])
1397 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00001398 fi
1399 fi
1400fi
1401
1402if test -n "$conf_lastlog_location"; then
1403 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1404fi
1405
1406dnl utmp detection
1407AC_MSG_CHECKING([if your system defines UTMP_FILE])
1408AC_TRY_COMPILE([
1409#include <sys/types.h>
1410#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001411#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001412# include <paths.h>
1413#endif
1414 ],
1415 [ char *utmp = UTMP_FILE; ],
1416 [ AC_MSG_RESULT(yes) ],
1417 [ AC_MSG_RESULT(no)
1418 system_utmp_path=no ]
1419)
1420if test -z "$conf_utmp_location"; then
1421 if test x"$system_utmp_path" = x"no" ; then
1422 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1423 if test -f $f ; then
1424 conf_utmp_location=$f
1425 fi
1426 done
1427 if test -z "$conf_utmp_location"; then
1428 AC_DEFINE(DISABLE_UTMP)
1429 fi
1430 fi
1431fi
1432if test -n "$conf_utmp_location"; then
1433 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1434fi
1435
1436dnl wtmp detection
1437AC_MSG_CHECKING([if your system defines WTMP_FILE])
1438AC_TRY_COMPILE([
1439#include <sys/types.h>
1440#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001441#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001442# include <paths.h>
1443#endif
1444 ],
1445 [ char *wtmp = WTMP_FILE; ],
1446 [ AC_MSG_RESULT(yes) ],
1447 [ AC_MSG_RESULT(no)
1448 system_wtmp_path=no ]
1449)
1450if test -z "$conf_wtmp_location"; then
1451 if test x"$system_wtmp_path" = x"no" ; then
1452 for f in /usr/adm/wtmp /var/log/wtmp; do
1453 if test -f $f ; then
1454 conf_wtmp_location=$f
1455 fi
1456 done
1457 if test -z "$conf_wtmp_location"; then
1458 AC_DEFINE(DISABLE_WTMP)
1459 fi
1460 fi
1461fi
1462if test -n "$conf_wtmp_location"; then
1463 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1464fi
1465
1466
1467dnl utmpx detection - I don't know any system so perverse as to require
1468dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1469dnl there, though.
1470AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1471AC_TRY_COMPILE([
1472#include <sys/types.h>
1473#include <utmp.h>
1474#ifdef HAVE_UTMPX_H
1475#include <utmpx.h>
1476#endif
Damien Miller2994e082000-06-04 15:51:47 +10001477#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001478# include <paths.h>
1479#endif
1480 ],
1481 [ char *utmpx = UTMPX_FILE; ],
1482 [ AC_MSG_RESULT(yes) ],
1483 [ AC_MSG_RESULT(no)
1484 system_utmpx_path=no ]
1485)
1486if test -z "$conf_utmpx_location"; then
1487 if test x"$system_utmpx_path" = x"no" ; then
1488 AC_DEFINE(DISABLE_UTMPX)
1489 fi
1490else
1491 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1492fi
1493
1494dnl wtmpx detection
1495AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1496AC_TRY_COMPILE([
1497#include <sys/types.h>
1498#include <utmp.h>
1499#ifdef HAVE_UTMPX_H
1500#include <utmpx.h>
1501#endif
Damien Miller2994e082000-06-04 15:51:47 +10001502#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001503# include <paths.h>
1504#endif
1505 ],
1506 [ char *wtmpx = WTMPX_FILE; ],
1507 [ AC_MSG_RESULT(yes) ],
1508 [ AC_MSG_RESULT(no)
1509 system_wtmpx_path=no ]
1510)
1511if test -z "$conf_wtmpx_location"; then
1512 if test x"$system_wtmpx_path" = x"no" ; then
1513 AC_DEFINE(DISABLE_WTMPX)
1514 fi
1515else
1516 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1517fi
1518
Damien Miller4018c192000-04-30 09:30:44 +10001519
1520# Change default command timeout for builtin PRNG
Damien Miller14c12cb2000-06-07 22:20:23 +10001521entropy_timeout=200
Damien Miller4018c192000-04-30 09:30:44 +10001522AC_ARG_WITH(entropy-timeout,
1523 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1524 [
1525 if test "x$withval" != "xno" ; then
1526 entropy_timeout=$withval
1527 fi
1528 ]
1529)
1530AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1531
1532
Damien Miller29ea30d2000-03-17 10:54:15 +11001533if test ! -z "$blibpath" ; then
1534 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1535 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1536fi
1537
Damien Millerbac2d8a2000-09-05 16:13:06 +11001538AC_EXEEXT
1539
Damien Miller0437b332000-05-02 09:56:41 +10001540AC_OUTPUT(Makefile ssh_prng_cmds)
1541
Damien Miller7b22d652000-06-18 14:07:04 +10001542# Print summary of options
1543
1544if test x$MANTYPE = x'$(CATMAN)' ; then
1545 MAN_MSG=cat
1546else
1547 MAN_MSG=man
1548fi
1549if test ! -z "$RANDOM_POOL" ; then
1550 RAND_MSG="Device ($RANDOM_POOL)"
1551else
1552 if test ! -z "$EGD_SOCKET" ; then
1553 RAND_MSG="EGD ($EGD_SOCKET)"
1554 else
1555 RAND_MSG="Builtin (timeout $entropy_timeout)"
Damien Miller6f9c3372000-10-25 10:06:04 +11001556 BUILTIN_RNG=1
Damien Miller7b22d652000-06-18 14:07:04 +10001557 fi
1558fi
1559
1560# Someone please show me a better way :)
1561A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1562B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1563C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1564D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00001565E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Damien Miller7b22d652000-06-18 14:07:04 +10001566F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
1567G=`eval echo ${piddir}` ; G=`eval echo ${G}`
1568
1569echo ""
1570echo "OpenSSH configured has been configured with the following options."
1571echo " User binaries: $B"
Damien Millere68f92b2000-10-02 21:42:15 +11001572echo " User binaries: $B"
Damien Miller7b22d652000-06-18 14:07:04 +10001573echo " System binaries: $C"
1574echo " Configuration files: $D"
1575echo " Askpass program: $E"
1576echo " Manual pages: $F"
1577echo " PID file: $G"
1578echo " Random number collection: $RAND_MSG"
1579echo " Manpage format: $MAN_MSG"
1580echo " PAM support: ${PAM_MSG}"
1581echo " KerberosIV support: $KRB4_MSG"
1582echo " AFS support: $AFS_MSG"
1583echo " S/KEY support: $SKEY_MSG"
1584echo " TCP Wrappers support: $TCPW_MSG"
1585echo " MD5 password support: $MD5_MSG"
1586echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1587echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1588echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1589
1590echo ""
1591
Damien Millere68f92b2000-10-02 21:42:15 +11001592echo " Host: ${host}"
1593echo " Compiler: ${CC}"
1594echo " Compiler flags: ${CFLAGS}"
1595echo " Linker flags: ${LDFLAGS}"
1596echo " Libraries: ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10001597
1598echo ""
1599
Damien Miller6f9c3372000-10-25 10:06:04 +11001600if test ! -z "$BUILTIN_RNG" ; then
1601 echo "WARNING: you are using the builtin random number collection service."
1602 echo "Please read WARNING.RNG and request that your OS vendor includes"
1603 echo "/dev/random in future versions of their OS."
1604 echo ""
1605fi