blob: 9fb78f1ffb195fd115c3a831116796267798415d [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 Miller2e1b0821999-12-25 10:11:29 +110016
Damien Millerad833b32000-08-23 10:46:23 +100017# Use LOGIN_PROGRAM from environment if possible
18if test ! -z "$LOGIN_PROGRAM" ; then
19 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
20else
21 # Search for login
22 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
23 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
24 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
25 fi
26fi
27
Damien Miller166bd442000-03-16 10:48:25 +110028if test -z "$LD" ; then
29 LD=$CC
30fi
31AC_SUBST(LD)
32
33# C Compiler features
34AC_C_INLINE
35if test "$GCC" = "yes"; then
36 CFLAGS="$CFLAGS -Wall"
37fi
38
Damien Millera22ba012000-03-02 23:09:20 +110039# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110040case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110041*-*-aix*)
42 AFS_LIBS="-lld"
Damien Millerdb819592000-03-14 13:44:01 +110043 CFLAGS="$CFLAGS -I/usr/local/include"
44 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Milleredb82922000-06-20 13:25:52 +100045 if (test "$LD" != "gcc" && test -z "$blibpath"); then
Damien Miller29ea30d2000-03-17 10:54:15 +110046 blibpath="/usr/lib:/lib:/usr/local/lib"
47 fi
Damien Millerd2c208a2000-05-17 22:00:02 +100048 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
Damien Millereca71f82000-01-20 22:38:27 +110049 AC_DEFINE(BROKEN_GETADDRINFO)
andree441aa32000-06-12 22:34:38 +000050 MANTYPE='$(CATMAN)'
51 mansubdir=cat
andre60f3c982000-06-03 16:18:19 +000052 dnl AIX handles lastlog as part of its login message
53 AC_DEFINE(DISABLE_LASTLOG)
Damien Miller5fc85652000-07-09 23:53:07 +100054 MANTYPE='$(CATMAN)'
55 mansubdir=cat
Damien Miller75b1d102000-01-07 14:01:41 +110056 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +110057*-*-cygwin*)
58 LIBS="$LIBS /usr/lib/textmode.o"
59 AC_DEFINE(HAVE_CYGWIN)
60 AC_DEFINE(DISABLE_PAM)
61 AC_DEFINE(DISABLE_SHADOW)
62 AC_DEFINE(IPV4_DEFAULT)
63 AC_DEFINE(IP_TOS_IS_BROKEN)
64 AC_DEFINE(BROKEN_VHANGUP)
65 no_pam=1
66 no_libsocket=1
67 no_libnsl=1
68 ;;
Damien Miller76112de1999-12-21 11:18:08 +110069*-*-hpux10*)
70 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100071 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110072 fi
73 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110074 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +100075 AC_DEFINE(USE_PIPES)
Damien Miller76112de1999-12-21 11:18:08 +110076 AC_MSG_CHECKING(for HPUX trusted system password database)
77 if test -f /tcb/files/auth/system/default; then
78 AC_MSG_RESULT(yes)
79 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
80 LIBS="$LIBS -lsec"
Damien Miller105b7f02000-01-07 08:45:55 +110081 AC_MSG_WARN([This configuration is untested])
Damien Miller76112de1999-12-21 11:18:08 +110082 else
83 AC_MSG_RESULT(no)
84 AC_DEFINE(DISABLE_SHADOW)
85 fi
Damien Miller670a4b82000-01-22 13:53:11 +110086 MANTYPE='$(CATMAN)'
87 mansubdir=cat
Damien Miller76112de1999-12-21 11:18:08 +110088 ;;
Damien Miller1bead332000-04-30 00:47:29 +100089*-*-hpux11*)
Damien Miller1bead332000-04-30 00:47:29 +100090 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
Damien Miller9a947342000-08-30 10:03:33 +110091 IPADDR_IN_DISPLAY=yes
Damien Miller5552d7a2000-08-30 09:53:24 +110092 AC_DEFINE(USE_PIPES)
Damien Miller1bead332000-04-30 00:47:29 +100093 AC_MSG_CHECKING(for HPUX trusted system password database)
94 if test -f /tcb/files/auth/system/default; then
95 AC_MSG_RESULT(yes)
96 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
97 LIBS="$LIBS -lsec"
98 AC_MSG_WARN([This configuration is untested])
99 else
100 AC_MSG_RESULT(no)
101 AC_DEFINE(DISABLE_SHADOW)
102 fi
103 MANTYPE='$(CATMAN)'
104 mansubdir=cat
105 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100106*-*-irix5*)
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 Miller07278932000-01-22 14:05:37 +1100109 MANTYPE='$(CATMAN)'
Damien Miller1808f382000-01-06 12:03:12 +1100110 no_libsocket=1
111 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000112 AC_DEFINE(BROKEN_INET_NTOA)
Damien Miller1808f382000-01-06 12:03:12 +1100113 ;;
114*-*-irix6*)
Damien Millerdb819592000-03-14 13:44:01 +1100115 CFLAGS="$CFLAGS -I/usr/local/include"
Damien Miller9e110892000-06-07 21:05:46 +1000116 LDFLAGS="$LDFLAGS"
Damien Miller07278932000-01-22 14:05:37 +1100117 MANTYPE='$(CATMAN)'
Damien Miller91606b12000-06-28 08:22:29 +1000118 AC_DEFINE(WITH_IRIX_ARRAY)
119 AC_DEFINE(WITH_IRIX_PROJECT)
120 AC_DEFINE(WITH_IRIX_AUDIT)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100121 no_libsocket=1
122 no_libnsl=1
Damien Miller11fa2cc2000-08-16 10:35:58 +1000123 AC_DEFINE(BROKEN_INET_NTOA)
Damien Millerbeb4ba51999-12-28 15:09:35 +1100124 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100125*-*-linux*)
126 no_dev_ptmx=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100127 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000128 AC_DEFINE(PAM_TTY_KLUDGE)
Damien Miller7bcb0892000-03-11 20:45:40 +1100129 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +1100130 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100131*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100132 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100133 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000134*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000135 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100136 conf_utmp_location=/etc/utmp
137 conf_wtmp_location=/usr/adm/wtmp
138 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000139 AC_DEFINE(HAVE_NEXT)
140 CFLAGS="$CFLAGS -I/usr/local/include"
Damien Miller0f91b4e2000-06-18 15:43:25 +1000141 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100142*-*-solaris*)
Damien Millerdb819592000-03-14 13:44:01 +1100143 CFLAGS="$CFLAGS -I/usr/local/include"
Damien Miller08c788a2000-03-16 07:52:29 +1100144 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
Damien Millera22ba012000-03-02 23:09:20 +1100145 need_dash_r=1
andre2ff7b5d2000-06-03 14:57:40 +0000146 # hardwire lastlog location (can't detect it on some versions)
147 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000148 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
149 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
150 if test "$sol2ver" -ge 8; then
151 AC_MSG_RESULT(yes)
152 AC_DEFINE(DISABLE_UTMP)
153 AC_DEFINE(DISABLE_WTMP)
154 else
155 AC_MSG_RESULT(no)
156 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100157 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000158*-*-sunos4*)
159 CFLAGS="$CFLAGS -DSUNOS4"
160 AC_CHECK_FUNCS(getpwanam)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000161 conf_utmp_location=/etc/utmp
162 conf_wtmp_location=/var/adm/wtmp
163 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000164 AC_DEFINE(USE_PIPES)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000165 MANTYPE='$(CATMAN)'
166 mansubdir=cat
Damien Millerdfc83f42000-05-20 15:02:59 +1000167 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000168*-sni-sysv*)
169 CFLAGS="$CFLAGS -I/usr/local/include"
170 LDFLAGS="$LDFLAGS -L/usr/local/lib -L/usr/ucblib"
171 MANTYPE='$(CATMAN)'
172 AC_DEFINE(IP_TOS_IS_BROKEN)
173 mansubdir=cat
Damien Millerb2dc28e2000-07-12 09:18:33 +1000174 LIBS="$LIBS -lgen -lnsl -lucb"
Damien Miller2ae714f2000-07-11 09:29:50 +1000175 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100176*-*-sysv*)
Damien Millerdb819592000-03-14 13:44:01 +1100177 CFLAGS="$CFLAGS -I/usr/local/include"
178 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller0e1cf7c2000-01-26 12:15:30 +1100179 MANTYPE='$(CATMAN)'
180 mansubdir=cat
Damien Miller75b1d102000-01-07 14:01:41 +1100181 LIBS="$LIBS -lgen -lsocket"
182 ;;
Damien Millera66626b2000-06-13 18:57:53 +1000183*-*-sco3*)
Damien Miller238a9fa2000-08-31 09:20:05 +1100184 AC_DEFINE(USE_PIPES)
Damien Millera66626b2000-06-13 18:57:53 +1000185 CFLAGS="$CFLAGS -I/usr/local/include"
186 LDFLAGS="$LDFLAGS -L/usr/local/lib"
187 MANTYPE='$(CATMAN)'
188 mansubdir=cat
189 LIBS="$LIBS -lgen -lsocket"
190 no_dev_ptmx=1
191 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000192*-dec-osf*)
193# This is untested
194 if test ! -z "USE_SIA" ; then
195 AC_MSG_CHECKING(for Digital Unix Security Integration Architecture)
196 if test -f /etc/sia/matrix.conf; then
197 AC_MSG_RESULT(yes)
198 AC_DEFINE(HAVE_OSF_SIA)
199 AC_DEFINE(DISABLE_LOGIN)
200 LIBS="$LIBS -lsecurity -ldb -lm -laud"
201 else
202 AC_MSG_RESULT(no)
203 fi
204 fi
205 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100206esac
207
Damien Millere37bfc12000-06-05 09:37:43 +1000208# Allow user to specify flags
209AC_ARG_WITH(cflags,
210 [ --with-cflags Specify additional flags to pass to compiler],
211 [
212 if test "x$withval" != "xno" ; then
213 CFLAGS="$CFLAGS $withval"
214 fi
215 ]
216)
217AC_ARG_WITH(ldflags,
218 [ --with-ldlags Specify additional flags to pass to linker],
219 [
220 if test "x$withval" != "xno" ; then
221 LDFLAGS="$LDFLAGS $withval"
222 fi
223 ]
224)
225AC_ARG_WITH(libs,
226 [ --with-libs Specify additional libraries to link with],
227 [
228 if test "x$withval" != "xno" ; then
229 LIBS="$LIBS $withval"
230 fi
231 ]
232)
233
234
Damien Millera22ba012000-03-02 23:09:20 +1100235# Checks for libraries.
Damien Millerab18c411999-11-11 10:40:23 +1100236AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
237AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Millerab18c411999-11-11 10:40:23 +1100238
Damien Millerbeb4ba51999-12-28 15:09:35 +1100239if test -z "$no_libsocket" ; then
240 AC_CHECK_LIB(nsl, yp_match, , )
241fi
242if test -z "$no_libnsl" ; then
243 AC_CHECK_LIB(socket, main, , )
Damien Miller32b3cf21999-12-26 10:21:48 +1100244fi
Damien Millerab18c411999-11-11 10:40:23 +1100245
Damien Millera22ba012000-03-02 23:09:20 +1100246# Checks for header files.
Damien Millerad833b32000-08-23 10:46:23 +1000247AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.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 stddef.h time.h ttyent.h usersec.h util.h utmp.h utmpx.h)
Damien Millerab18c411999-11-11 10:40:23 +1100248
Damien Millerad833b32000-08-23 10:46:23 +1000249dnl Checks for library functions.
Damien Miller7b28dc52000-09-05 13:34:53 +1100250AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo futimes gai_strerror getaddrinfo getnameinfo getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid sigaction sigvec snprintf strerror strlcat strlcpy strsep vsnprintf vhangup _getpty __b64_ntop)
Damien Millerad833b32000-08-23 10:46:23 +1000251dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000252AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000253dnl Checks for libutil functions
andre2ff7b5d2000-06-03 14:57:40 +0000254AC_CHECK_FUNCS(login logout updwtmp logwtmp)
Damien Millerad833b32000-08-23 10:46:23 +1000255dnl Checks for utmp functions
andre2ff7b5d2000-06-03 14:57:40 +0000256AC_CHECK_FUNCS(entutent getutent getutid getutline pututline setutent)
257AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000258dnl Checks for utmpx functions
andre2ff7b5d2000-06-03 14:57:40 +0000259AC_CHECK_FUNCS(entutxent getutxent getutxid getutxline pututxline )
260AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100261
Damien Miller5fc85652000-07-09 23:53:07 +1000262AC_CHECK_FUNC(getuserattr,
263 [AC_DEFINE(HAVE_GETUSERATTR)],
264 [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])]
265)
266
Damien Miller04f80141999-11-19 15:32:34 +1100267AC_CHECK_FUNC(login,
268 [AC_DEFINE(HAVE_LOGIN)],
269 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
270)
271
272AC_CHECK_FUNC(daemon,
273 [AC_DEFINE(HAVE_DAEMON)],
274 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
275)
276
Damien Miller9fb07e42000-03-05 16:22:59 +1100277AC_CHECK_FUNC(getpagesize,
278 [AC_DEFINE(HAVE_GETPAGESIZE)],
279 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
280)
281
Damien Millercb170cb2000-07-01 16:52:55 +1000282# Check for broken snprintf
283if test "x$ac_cv_func_snprintf" = "xyes" ; then
284 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
285 AC_TRY_RUN(
286 [
287#include <stdio.h>
288int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');}
289 ],
290 [AC_MSG_RESULT(yes)],
291 [
292 AC_MSG_RESULT(no)
293 AC_DEFINE(BROKEN_SNPRINTF)
294 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
295 ]
296 )
297fi
298
Damien Miller7b22d652000-06-18 14:07:04 +1000299PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +1100300AC_ARG_WITH(pam,
301 [ --without-pam Disable PAM support ],
302 [
303 if test "x$withval" = "xno" ; then
304 no_pam=1
305 AC_DEFINE(DISABLE_PAM)
Damien Miller7b22d652000-06-18 14:07:04 +1000306 PAM_MSG="disabled"
Damien Millera22ba012000-03-02 23:09:20 +1100307 fi
308 ]
309)
Damien Milleredb82922000-06-20 13:25:52 +1000310if (test -z "$no_pam" && test "x$ac_cv_header_security_pam_appl_h" = "xyes") ; then
Damien Millera22ba012000-03-02 23:09:20 +1100311 AC_CHECK_LIB(dl, dlopen, , )
312 LIBS="$LIBS -lpam"
313
Damien Miller0e65eed2000-05-17 22:16:05 +1000314 AC_CHECK_FUNCS(pam_getenvlist)
Damien Miller1bead332000-04-30 00:47:29 +1000315
Damien Miller1f335fb2000-06-26 11:31:33 +1000316 disable_shadow=yes
317
Damien Miller7b22d652000-06-18 14:07:04 +1000318 PAM_MSG="yes"
319
Damien Millera22ba012000-03-02 23:09:20 +1100320 # Check PAM strerror arguments (old PAM)
321 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
322 AC_TRY_COMPILE(
323 [
Damien Miller81171112000-04-23 11:14:01 +1000324#include <stdlib.h>
325#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100326 ],
327 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
328 [AC_MSG_RESULT(no)],
329 [
330 AC_DEFINE(HAVE_OLD_PAM)
331 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000332 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +1100333 ]
334 )
335fi
336
337# The big search for OpenSSL
338AC_ARG_WITH(ssl-dir,
339 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
340 [
341 if test "x$withval" != "$xno" ; then
342 tryssldir=$withval
343 fi
344 ]
345)
346
347saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100348saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100349saved_CFLAGS="$CFLAGS"
350if test "x$prefix" != "xNONE" ; then
351 tryssldir="$tryssldir $prefix"
352fi
Damien Miller61e50f12000-05-08 20:49:37 +1000353AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera22ba012000-03-02 23:09:20 +1100354
Damien Miller61e50f12000-05-08 20:49:37 +1000355 for ssldir in "" $tryssldir /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
356 if test ! -z "$ssldir" ; then
357 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
358 CFLAGS="$saved_CFLAGS -I$ssldir/include"
359 if test ! -z "$need_dash_r" ; then
360 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
361 fi
Damien Millera1ad4802000-03-15 10:04:54 +1100362 else
Damien Miller61e50f12000-05-08 20:49:37 +1000363 LDFLAGS="$saved_LDFLAGS"
Damien Millerb85dcad2000-03-11 11:37:00 +1100364 fi
365
Damien Miller3b512e12000-05-17 23:29:18 +1000366 LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000367
Damien Miller3b512e12000-05-17 23:29:18 +1000368 # Basic test to check for compatible version and correct linking
369 # *does not* test for RSA - that comes later.
370 AC_TRY_RUN(
371 [
Damien Millere59ce622000-05-01 20:54:17 +1000372#include <string.h>
373#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000374int main(void)
375{
Damien Miller3b512e12000-05-17 23:29:18 +1000376 char a[2048];
377 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000378 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000379 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000380}
Damien Miller3b512e12000-05-17 23:29:18 +1000381 ],
382 [
383 found_crypto=1
384 break;
385 ], []
386 )
Damien Miller61e50f12000-05-08 20:49:37 +1000387
388 if test ! -z "$found_crypto" ; then
389 break;
390 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100391 done
392
Damien Miller61e50f12000-05-08 20:49:37 +1000393 if test -z "$found_crypto" ; then
394 AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])
Damien Millerb85dcad2000-03-11 11:37:00 +1100395 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000396 if test -z "$ssldir" ; then
397 ssldir="(system)"
398 fi
Damien Millera22ba012000-03-02 23:09:20 +1100399
Damien Miller61e50f12000-05-08 20:49:37 +1000400 ac_cv_openssldir=$ssldir
401])
402
Damien Milleredb82922000-06-20 13:25:52 +1000403if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000404 AC_DEFINE(HAVE_OPENSSL)
405 dnl Need to recover ssldir - test above runs in subshell
406 ssldir=$ac_cv_openssldir
Damien Millera1ad4802000-03-15 10:04:54 +1100407 CFLAGS="$saved_CFLAGS -I$ssldir/include"
408 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
409 if test ! -z "$need_dash_r" ; then
410 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
Damien Millera22ba012000-03-02 23:09:20 +1100411 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100412 if test ! -z "$blibpath" ; then
413 blibpath="$blibpath:$ssldir:$ssldir/lib"
414 fi
Damien Millera22ba012000-03-02 23:09:20 +1100415fi
Damien Miller3b512e12000-05-17 23:29:18 +1000416LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000417
Damien Miller3b512e12000-05-17 23:29:18 +1000418# Now test RSA support
419saved_LIBS="$LIBS"
420AC_MSG_CHECKING([for RSA support])
421for WANTS_RSAREF in "" 1 ; do
422 if test -z "$WANTS_RSAREF" ; then
423 LIBS="$saved_LIBS"
424 else
425 LIBS="$saved_LIBS -lRSAglue -lrsaref"
426 fi
427 AC_TRY_RUN([
428#include <string.h>
429#include <openssl/rand.h>
430#include <openssl/rsa.h>
431#include <openssl/bn.h>
432#include <openssl/sha.h>
433int main(void)
434{
435 int num; RSA *key; static unsigned char p_in[] = "blahblah";
436 unsigned char c[256], p[256];
437 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
438 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
439 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
440 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
441}
442 ],
443 [
444 rsa_works=1
445 break;
446 ], [])
447done
448
449if test ! -z "$no_rsa" ; then
450 AC_MSG_RESULT(disabled)
Damien Miller7b22d652000-06-18 14:07:04 +1000451 RSA_MSG="disabled"
Damien Miller3b512e12000-05-17 23:29:18 +1000452else
453 if test -z "$rsa_works" ; then
454 AC_MSG_WARN([*** No RSA support found *** ])
Damien Miller7b22d652000-06-18 14:07:04 +1000455 RSA_MSG="no"
Damien Miller3b512e12000-05-17 23:29:18 +1000456 else
457 if test -z "$WANTS_RSAREF" ; then
458 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +1000459 RSA_MSG="yes"
Damien Miller3b512e12000-05-17 23:29:18 +1000460 else
Damien Miller7b22d652000-06-18 14:07:04 +1000461 RSA_MSG="yes (using RSAref)"
Damien Miller3b512e12000-05-17 23:29:18 +1000462 AC_MSG_RESULT(using RSAref)
463 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
464 fi
465 fi
466fi
Damien Millera22ba012000-03-02 23:09:20 +1100467
468# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100469AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100470AC_CHECK_SIZEOF(short int, 2)
471AC_CHECK_SIZEOF(int, 4)
472AC_CHECK_SIZEOF(long int, 4)
473AC_CHECK_SIZEOF(long long int, 8)
474
Damien Millera22ba012000-03-02 23:09:20 +1100475# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +1100476AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
477 AC_TRY_COMPILE(
478 [ #include <sys/types.h> ],
479 [ u_int a; a = 1;],
480 [ ac_cv_have_u_int="yes" ],
481 [ ac_cv_have_u_int="no" ]
482 )
483])
484if test "x$ac_cv_have_u_int" = "xyes" ; then
485 AC_DEFINE(HAVE_U_INT)
486 have_u_int=1
487fi
488
Damien Miller61e50f12000-05-08 20:49:37 +1000489AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
490 AC_TRY_COMPILE(
491 [ #include <sys/types.h> ],
492 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
493 [ ac_cv_have_intxx_t="yes" ],
494 [ ac_cv_have_intxx_t="no" ]
495 )
496])
497if test "x$ac_cv_have_intxx_t" = "xyes" ; then
498 AC_DEFINE(HAVE_INTXX_T)
499 have_intxx_t=1
500fi
501
502AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
503 AC_TRY_COMPILE(
504 [ #include <sys/types.h> ],
505 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
506 [ ac_cv_have_u_intxx_t="yes" ],
507 [ ac_cv_have_u_intxx_t="no" ]
508 )
509])
510if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
511 AC_DEFINE(HAVE_U_INTXX_T)
512 have_u_intxx_t=1
513fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100514
Damien Milleredb82922000-06-20 13:25:52 +1000515if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
516 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +1100517then
518 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
519 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +1000520 [
521#include <sys/bitypes.h>
522 ],
Damien Millerb29ea912000-01-15 14:12:03 +1100523 [
Damien Miller70494d12000-04-03 15:57:06 +1000524 int8_t a; int16_t b; int32_t c;
525 u_int8_t e; u_int16_t f; u_int32_t g;
526 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +1100527 ],
528 [
529 AC_DEFINE(HAVE_U_INTXX_T)
530 AC_DEFINE(HAVE_INTXX_T)
531 AC_MSG_RESULT(yes)
532 ],
533 [AC_MSG_RESULT(no)]
534 )
535fi
536
Damien Millerd6121d22000-03-17 23:26:46 +1100537if test -z "$have_u_intxx_t" ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000538 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
539 AC_TRY_COMPILE(
540 [
541#include <sys/types.h>
542 ],
543 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
544 [ ac_cv_have_uintxx_t="yes" ],
545 [ ac_cv_have_uintxx_t="no" ]
546 )
547 ])
548 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
549 AC_DEFINE(HAVE_UINTXX_T)
550 fi
Damien Millerd6121d22000-03-17 23:26:46 +1100551fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100552
Damien Miller61e50f12000-05-08 20:49:37 +1000553AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
554 AC_TRY_COMPILE(
555 [
Damien Miller81171112000-04-23 11:14:01 +1000556#include <sys/types.h>
557#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000558 ],
559 [socklen_t foo; foo = 1235;],
560 [ ac_cv_have_socklen_t="yes" ],
561 [ ac_cv_have_socklen_t="no" ]
562 )
563])
564if test "x$ac_cv_have_socklen_t" = "xyes" ; then
565 AC_DEFINE(HAVE_SOCKLEN_T)
566fi
Damien Miller74d0d4a1999-12-29 02:24:35 +1100567
Damien Miller61e50f12000-05-08 20:49:37 +1000568AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
569 AC_TRY_COMPILE(
570 [
571#include <sys/types.h>
572 ],
573 [ size_t foo; foo = 1235; ],
574 [ ac_cv_have_size_t="yes" ],
575 [ ac_cv_have_size_t="no" ]
576 )
577])
578if test "x$ac_cv_have_size_t" = "xyes" ; then
579 AC_DEFINE(HAVE_SIZE_T)
580fi
Damien Miller95058511999-12-29 10:36:45 +1100581
Damien Miller615f9392000-05-17 22:53:33 +1000582AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
583 AC_TRY_COMPILE(
584 [
585#include <sys/types.h>
586 ],
587 [ ssize_t foo; foo = 1235; ],
588 [ ac_cv_have_ssize_t="yes" ],
589 [ ac_cv_have_ssize_t="no" ]
590 )
591])
592if test "x$ac_cv_have_ssize_t" = "xyes" ; then
593 AC_DEFINE(HAVE_SSIZE_T)
594fi
595
Damien Millerb54b40e2000-06-23 08:23:34 +1000596AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
597 AC_TRY_COMPILE(
598 [
599#include <sys/types.h>
600#include <sys/socket.h>
601 ],
602 [ sa_family_t foo; foo = 1235; ],
603 [ ac_cv_have_sa_family_t="yes" ],
604 [ ac_cv_have_sa_family_t="no" ]
605 )
606])
607if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
608 AC_DEFINE(HAVE_SA_FAMILY_T)
609fi
610
Damien Miller0f91b4e2000-06-18 15:43:25 +1000611AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
612 AC_TRY_COMPILE(
613 [
614#include <sys/types.h>
615 ],
616 [ pid_t foo; foo = 1235; ],
617 [ ac_cv_have_pid_t="yes" ],
618 [ ac_cv_have_pid_t="no" ]
619 )
620])
621if test "x$ac_cv_have_pid_t" = "xyes" ; then
622 AC_DEFINE(HAVE_PID_T)
623fi
624
625AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
626 AC_TRY_COMPILE(
627 [
628#include <sys/types.h>
629 ],
630 [ mode_t foo; foo = 1235; ],
631 [ ac_cv_have_mode_t="yes" ],
632 [ ac_cv_have_mode_t="no" ]
633 )
634])
635if test "x$ac_cv_have_mode_t" = "xyes" ; then
636 AC_DEFINE(HAVE_MODE_T)
637fi
638
Damien Miller61e50f12000-05-08 20:49:37 +1000639
640AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
641 AC_TRY_COMPILE(
642 [
Damien Miller81171112000-04-23 11:14:01 +1000643#include <sys/types.h>
644#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000645 ],
646 [ struct sockaddr_storage s; ],
647 [ ac_cv_have_struct_sockaddr_storage="yes" ],
648 [ ac_cv_have_struct_sockaddr_storage="no" ]
649 )
650])
651if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
652 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
653fi
Damien Miller34132e52000-01-14 15:45:46 +1100654
Damien Miller61e50f12000-05-08 20:49:37 +1000655AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
656 AC_TRY_COMPILE(
657 [
Damien Miller7b22d652000-06-18 14:07:04 +1000658#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000659#include <netinet/in.h>
660 ],
661 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
662 [ ac_cv_have_struct_sockaddr_in6="yes" ],
663 [ ac_cv_have_struct_sockaddr_in6="no" ]
664 )
665])
666if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
667 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
668fi
Damien Miller34132e52000-01-14 15:45:46 +1100669
Damien Miller61e50f12000-05-08 20:49:37 +1000670AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
671 AC_TRY_COMPILE(
672 [
Damien Miller7b22d652000-06-18 14:07:04 +1000673#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000674#include <netinet/in.h>
675 ],
676 [ struct in6_addr s; s.s6_addr[0] = 0; ],
677 [ ac_cv_have_struct_in6_addr="yes" ],
678 [ ac_cv_have_struct_in6_addr="no" ]
679 )
680])
681if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
682 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
683fi
Damien Miller34132e52000-01-14 15:45:46 +1100684
Damien Miller61e50f12000-05-08 20:49:37 +1000685AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
686 AC_TRY_COMPILE(
687 [
Damien Miller81171112000-04-23 11:14:01 +1000688#include <sys/types.h>
689#include <sys/socket.h>
690#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000691 ],
692 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
693 [ ac_cv_have_struct_addrinfo="yes" ],
694 [ ac_cv_have_struct_addrinfo="no" ]
695 )
696])
697if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
698 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
699fi
700
Damien Miller34132e52000-01-14 15:45:46 +1100701
Damien Millera22ba012000-03-02 23:09:20 +1100702# Checks for structure members
Damien Miller34132e52000-01-14 15:45:46 +1100703
Damien Miller61e50f12000-05-08 20:49:37 +1000704OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
705OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
706OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
707OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
708OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +1000709OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +1000710OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
711OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +1000712OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +1000713OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
714OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
715OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
716OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +0000717OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
718OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
719OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
720OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
721
Damien Miller942da032000-08-18 13:59:06 +1000722AC_CACHE_CHECK([for sun_len field in struct sockaddr_un],
723 ac_cv_have_sun_len_in_struct_sockaddr_un, [
724 AC_TRY_COMPILE(
725 [
726#include <sys/types.h>
727#include <sys/socket.h>
728 ],
729 [ struct sockaddr_un s; s.sun_len = 1; ],
730 [ ac_cv_have_sun_len_in_struct_sockaddr_un="yes" ],
731 [ ac_cv_have_sun_len_in_struct_sockaddr_un="no" ],
732 )
733])
734if test "x$ac_cv_have_sun_len_in_struct_sockaddr_un" = "xyes" ; then
735 AC_DEFINE(HAVE_SUN_LEN_IN_SOCKADDR_UN)
736fi
737
Damien Miller61e50f12000-05-08 20:49:37 +1000738AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
739 ac_cv_have_ss_family_in_struct_ss, [
740 AC_TRY_COMPILE(
741 [
Damien Miller81171112000-04-23 11:14:01 +1000742#include <sys/types.h>
743#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000744 ],
745 [ struct sockaddr_storage s; s.ss_family = 1; ],
746 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
747 [ ac_cv_have_ss_family_in_struct_ss="no" ],
748 )
749])
750if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
751 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
752fi
753
Damien Miller61e50f12000-05-08 20:49:37 +1000754AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
755 ac_cv_have___ss_family_in_struct_ss, [
756 AC_TRY_COMPILE(
757 [
Damien Miller81171112000-04-23 11:14:01 +1000758#include <sys/types.h>
759#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000760 ],
761 [ struct sockaddr_storage s; s.__ss_family = 1; ],
762 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
763 [ ac_cv_have___ss_family_in_struct_ss="no" ]
764 )
765])
766if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
767 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
768fi
Damien Millerbf1c9b21999-12-09 10:16:54 +1100769
Damien Millerad833b32000-08-23 10:46:23 +1000770AC_CACHE_CHECK([for pw_class field in struct passwd],
771 ac_cv_have_pw_class_in_struct_passwd, [
772 AC_TRY_COMPILE(
773 [
774#include <sys/types.h>
775#include <pwd.h>
776 ],
777 [ struct passwd p s; p.pw_class = NULL; ],
778 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
779 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
780 )
781])
782if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
783 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
784fi
785
Damien Miller61e50f12000-05-08 20:49:37 +1000786
787AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
788 AC_TRY_LINK([],
789 [ extern char *__progname; printf("%s", __progname); ],
790 [ ac_cv_libc_defines___progname="yes" ],
791 [ ac_cv_libc_defines___progname="no" ]
792 )
793])
794if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
795 AC_DEFINE(HAVE___PROGNAME)
796fi
797
Damien Millera22ba012000-03-02 23:09:20 +1100798
Damien Millerecbb26d2000-07-15 14:59:14 +1000799AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
800 AC_TRY_LINK([],
801 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
802 [ ac_cv_libc_defines_sys_errlist="yes" ],
803 [ ac_cv_libc_defines_sys_errlist="no" ]
804 )
805])
806if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
807 AC_DEFINE(HAVE_SYS_ERRLIST)
808fi
809
810
Damien Miller11fa2cc2000-08-16 10:35:58 +1000811AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
812 AC_TRY_LINK([],
813 [ extern int sys_nerr; printf("%i", sys_nerr);],
814 [ ac_cv_libc_defines_sys_nerr="yes" ],
815 [ ac_cv_libc_defines_sys_nerr="no" ]
816 )
817])
818if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
819 AC_DEFINE(HAVE_SYS_NERR)
820fi
821
822
Damien Millera22ba012000-03-02 23:09:20 +1100823# Looking for programs, paths and files
824AC_ARG_WITH(rsh,
825 [ --with-rsh=PATH Specify path to remote shell program ],
826 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100827 if test "x$withval" != "$no" ; then
Damien Miller90dcc052000-07-08 10:17:40 +1000828 rsh_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +1100829 fi
830 ],
831 [
832 AC_PATH_PROG(rsh_path, rsh)
833 ]
834)
835
836AC_ARG_WITH(xauth,
837 [ --with-xauth=PATH Specify path to xauth program ],
838 [
839 if test "x$withval" != "$xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +1000840 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +1100841 fi
842 ],
843 [
844 AC_PATH_PROG(xauth_path, xauth)
Damien Milleredb82922000-06-20 13:25:52 +1000845 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +1100846 xauth_path="/usr/openwin/bin/xauth"
847 fi
848 ]
849)
850
851if test ! -z "$xauth_path" ; then
852 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
853fi
854if test ! -z "$rsh_path" ; then
855 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
856fi
857
858# Check for mail directory (last resort if we cannot get it from headers)
859if test ! -z "$MAIL" ; then
860 maildir=`dirname $MAIL`
861 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
862fi
863
Damien Millera22ba012000-03-02 23:09:20 +1100864if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +1100865 AC_CHECK_FILE("/dev/ptmx",
866 [
867 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
868 have_dev_ptmx=1
869 ]
870 )
Damien Millera22ba012000-03-02 23:09:20 +1100871fi
Damien Miller204ad072000-03-02 23:56:12 +1100872AC_CHECK_FILE("/dev/ptc",
873 [
874 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
875 have_dev_ptc=1
876 ]
877)
878
Damien Millera22ba012000-03-02 23:09:20 +1100879# Options from here on. Some of these are preset by platform above
880
Damien Millera22ba012000-03-02 23:09:20 +1100881# Check for user-specified random device, otherwise check /dev/urandom
882AC_ARG_WITH(random,
883 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
884 [
Damien Miller040f3832000-04-03 14:50:43 +1000885 if test "x$withval" != "xno" ; then
886 RANDOM_POOL="$withval";
887 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
888 fi
Damien Millera22ba012000-03-02 23:09:20 +1100889 ],
890 [
891 # Check for random device
892 AC_CHECK_FILE("/dev/urandom",
893 [
894 RANDOM_POOL="/dev/urandom";
895 AC_SUBST(RANDOM_POOL)
896 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
897 ]
898 )
899 ]
900)
901
902# Check for EGD pool file
903AC_ARG_WITH(egd-pool,
904 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
905 [
Damien Miller040f3832000-04-03 14:50:43 +1000906 if test "x$withval" != "xno" ; then
907 EGD_SOCKET="$withval";
908 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
909 fi
Damien Millera22ba012000-03-02 23:09:20 +1100910 ]
911)
912
Damien Miller0437b332000-05-02 09:56:41 +1000913# detect pathnames for entropy gathering commands, if we need them
914INSTALL_SSH_PRNG_CMDS=""
915rm -f prng_commands
Damien Milleredb82922000-06-20 13:25:52 +1000916if (test -z "$RANDOM_POOL" && test -z "$EGD_SOCKET") ; then
Damien Miller11e37f62000-04-08 18:23:30 +1000917 # Use these commands to collect entropy
Damien Miller61e50f12000-05-08 20:49:37 +1000918 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
919 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
920 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
921 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
922 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
923 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
924 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
925 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
926 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
927 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
928 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
929 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
930 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
931 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
932 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
Damien Miller0437b332000-05-02 09:56:41 +1000933
934 INSTALL_SSH_PRNG_CMDS="yes"
Damien Miller11e37f62000-04-08 18:23:30 +1000935fi
Damien Miller0437b332000-05-02 09:56:41 +1000936AC_SUBST(INSTALL_SSH_PRNG_CMDS)
937
Damien Miller11e37f62000-04-08 18:23:30 +1000938
Damien Miller670a4b82000-01-22 13:53:11 +1100939AC_ARG_WITH(catman,
940 [ --with-catman=man|cat Install preformatted manpages[no]],
941 [
942 MANTYPE='$(CATMAN)'
943 if test x"$withval" != x"yes" ; then
944 mansubdir=$withval
945 else
946 mansubdir=cat
947 fi
948 ], [
949 if test -z "$MANTYPE" ; then
950 MANTYPE='$(TROFFMAN)'
951 mansubdir=man
952 fi
953 ]
954)
955AC_SUBST(MANTYPE)
956AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +1100957
Damien Millera22ba012000-03-02 23:09:20 +1100958# Check whether user wants Kerberos support
Damien Miller7b22d652000-06-18 14:07:04 +1000959KRB4_MSG="no"
Damien Miller80297751999-11-19 13:03:25 +1100960AC_ARG_WITH(kerberos4,
Damien Miller105b7f02000-01-07 08:45:55 +1100961 [ --with-kerberos4=PATH Enable Kerberos 4 support],
Damien Miller80297751999-11-19 13:03:25 +1100962 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100963 if test "x$withval" != "xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +1100964
965 if test "x$withval" != "$xyes" ; then
966 CFLAGS="$CFLAGS -I${withval}/include"
967 LDFLAGS="$LDFLAGS -L${withval}/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100968 if test ! -z "$need_dash_r" ; then
969 LDFLAGS="$LDFLAGS -R${withval}/lib"
970 fi
971 if test ! -z "$blibpath" ; then
972 blibpath="$blibpath:${withval}/lib"
973 fi
Damien Miller105b7f02000-01-07 08:45:55 +1100974 else
975 if test -d /usr/include/kerberosIV ; then
976 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
977 fi
978 fi
979
980 AC_CHECK_HEADERS(krb.h)
981 AC_CHECK_LIB(krb, main)
982 if test "$ac_cv_header_krb_h" != yes; then
983 AC_MSG_WARN([Cannot find krb.h, build may fail])
984 fi
985 if test "$ac_cv_lib_krb_main" != yes; then
986 AC_MSG_WARN([Cannot find libkrb, build may fail])
987 fi
988
Damien Millerc85f9b42000-01-29 10:20:21 +1100989 KLIBS="-lkrb -ldes"
Damien Miller105b7f02000-01-07 08:45:55 +1100990 AC_CHECK_LIB(resolv, dn_expand, , )
991 KRB4=yes
Damien Miller7b22d652000-06-18 14:07:04 +1000992 KRB4_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +1100993 AC_DEFINE(KRB4)
Damien Miller8bdeee21999-12-30 15:50:54 +1100994 fi
Damien Miller80297751999-11-19 13:03:25 +1100995 ]
996)
997
Damien Millera22ba012000-03-02 23:09:20 +1100998# Check whether user wants AFS support
Damien Miller7b22d652000-06-18 14:07:04 +1000999AFS_MSG="no"
Damien Millerc6398ef1999-11-20 12:18:40 +11001000AC_ARG_WITH(afs,
Damien Miller105b7f02000-01-07 08:45:55 +11001001 [ --with-afs=PATH Enable AFS support],
Damien Miller80297751999-11-19 13:03:25 +11001002 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001003 if test "x$withval" != "xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +11001004
1005 if test "x$withval" != "$xyes" ; then
1006 CFLAGS="$CFLAGS -I${withval}/include"
1007 LFLAGS="$LFLAGS -L${withval}/lib"
1008 fi
1009
1010 if test -z "$KRB4" ; then
1011 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1012 fi
1013
Damien Miller8bdeee21999-12-30 15:50:54 +11001014 LIBS="$LIBS -lkafs"
Damien Miller105b7f02000-01-07 08:45:55 +11001015 if test ! -z "$AFS_LIBS" ; then
1016 LIBS="$LIBS $AFS_LIBS"
1017 fi
1018 AC_DEFINE(AFS)
Damien Miller7b22d652000-06-18 14:07:04 +10001019 AFS_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001020 fi
Damien Miller80297751999-11-19 13:03:25 +11001021 ]
1022)
Damien Millerc85f9b42000-01-29 10:20:21 +11001023LIBS="$LIBS $KLIBS"
Damien Miller80297751999-11-19 13:03:25 +11001024
Damien Millera22ba012000-03-02 23:09:20 +11001025# Check whether user wants S/Key support
Damien Miller7b22d652000-06-18 14:07:04 +10001026SKEY_MSG="no"
Damien Miller80297751999-11-19 13:03:25 +11001027AC_ARG_WITH(skey,
1028 [ --with-skey Enable S/Key support],
1029 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001030 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001031 AC_DEFINE(SKEY)
1032 LIBS="$LIBS -lskey"
Damien Miller7b22d652000-06-18 14:07:04 +10001033 SKEY_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001034 fi
Damien Miller80297751999-11-19 13:03:25 +11001035 ]
1036)
1037
Damien Millera22ba012000-03-02 23:09:20 +11001038# Check whether user wants TCP wrappers support
Damien Miller7b22d652000-06-18 14:07:04 +10001039TCPW_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001040AC_ARG_WITH(tcp-wrappers,
Damien Miller80297751999-11-19 13:03:25 +11001041 [ --with-tcp-wrappers Enable tcpwrappers support],
1042 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001043 if test "x$withval" != "xno" ; then
Damien Miller65165f82000-03-05 17:02:45 +11001044 saved_LIBS="$LIBS"
Damien Miller105b7f02000-01-07 08:45:55 +11001045 LIBS="$LIBS -lwrap"
Damien Miller65165f82000-03-05 17:02:45 +11001046 AC_MSG_CHECKING(for libwrap)
1047 AC_TRY_LINK(
1048 [
Damien Miller81171112000-04-23 11:14:01 +10001049#include <tcpd.h>
Damien Miller65165f82000-03-05 17:02:45 +11001050 int deny_severity = 0, allow_severity = 0;
1051 ],
1052 [hosts_access(0);],
1053 [
1054 AC_MSG_RESULT(yes)
1055 AC_DEFINE(LIBWRAP)
Damien Miller7b22d652000-06-18 14:07:04 +10001056 TCPW_MSG="yes"
Damien Miller65165f82000-03-05 17:02:45 +11001057 ],
1058 [
Damien Miller7b22d652000-06-18 14:07:04 +10001059 AC_MSG_ERROR([*** libwrap missing])
Damien Miller65165f82000-03-05 17:02:45 +11001060 ]
1061 )
Damien Miller8bdeee21999-12-30 15:50:54 +11001062 fi
Damien Miller80297751999-11-19 13:03:25 +11001063 ]
1064)
1065
Damien Millera22ba012000-03-02 23:09:20 +11001066# Check whether to enable MD5 passwords
Damien Miller7b22d652000-06-18 14:07:04 +10001067MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11001068AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001069 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11001070 [
Damien Millerb85dcad2000-03-11 11:37:00 +11001071 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11001072 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Miller7b22d652000-06-18 14:07:04 +10001073 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11001074 fi
1075 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11001076)
1077
Damien Millera22ba012000-03-02 23:09:20 +11001078# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11001079AC_ARG_WITH(shadow,
1080 [ --without-shadow Disable shadow password support],
1081 [
1082 if test "x$withval" = "xno" ; then
1083 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10001084 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11001085 fi
1086 ]
1087)
1088
Damien Miller1f335fb2000-06-26 11:31:33 +10001089if test -z "$disable_shadow" ; then
1090 AC_MSG_CHECKING([if the systems has expire shadow information])
1091 AC_TRY_COMPILE(
1092 [
1093#include <sys/types.h>
1094#include <shadow.h>
1095 struct spwd sp;
1096 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1097 [ sp_expire_available=yes ], []
1098 )
1099
1100 if test "x$sp_expire_available" = "xyes" ; then
1101 AC_MSG_RESULT(yes)
1102 AC_DEFINE(HAS_SHADOW_EXPIRE)
1103 else
1104 AC_MSG_RESULT(no)
1105 fi
1106fi
1107
Damien Millera22ba012000-03-02 23:09:20 +11001108# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11001109if test ! -z "$IPADDR_IN_DISPLAY" ; then
1110 DISPLAY_HACK_MSG="yes"
1111 AC_DEFINE(IPADDR_IN_DISPLAY)
1112else
1113 DISPLAY_HACK_MSG="no"
1114 AC_ARG_WITH(ipaddr-display,
1115 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1116 [
1117 if test "x$withval" != "xno" ; then
1118 AC_DEFINE(IPADDR_IN_DISPLAY)
1119 DISPLAY_HACK_MSG="yes"
1120 fi
1121 ]
1122 )
1123fi
Damien Miller76112de1999-12-21 11:18:08 +11001124
Damien Millera22ba012000-03-02 23:09:20 +11001125# Whether to mess with the default path
Damien Miller7b22d652000-06-18 14:07:04 +10001126SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11001127AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +11001128 [ --with-default-path=PATH Specify default \$PATH environment for server],
1129 [
1130 if test "x$withval" != "xno" ; then
Damien Miller9550a761999-12-29 02:32:22 +11001131 AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
Damien Miller7b22d652000-06-18 14:07:04 +10001132 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11001133 fi
1134 ]
1135)
1136
Damien Millera22ba012000-03-02 23:09:20 +11001137# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7b22d652000-06-18 14:07:04 +10001138IPV4_HACK_MSG="no"
Damien Miller7d80e342000-01-19 14:36:49 +11001139AC_ARG_WITH(ipv4-default,
1140 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
1141 [
1142 if test "x$withval" != "xno" ; then
1143 AC_DEFINE(IPV4_DEFAULT)
Damien Miller7b22d652000-06-18 14:07:04 +10001144 IPV4_HACK_MSG="yes"
Damien Miller7d80e342000-01-19 14:36:49 +11001145 fi
1146 ]
1147)
1148
Damien Miller61e50f12000-05-08 20:49:37 +10001149AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7b22d652000-06-18 14:07:04 +10001150IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11001151AC_ARG_WITH(4in6,
1152 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
1153 [
1154 if test "x$withval" != "xno" ; then
1155 AC_MSG_RESULT(yes)
1156 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001157 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001158 else
1159 AC_MSG_RESULT(no)
1160 fi
1161 ],[
1162 if test "x$inet6_default_4in6" = "xyes"; then
1163 AC_MSG_RESULT([yes (default)])
1164 AC_DEFINE(IPV4_IN_IPV6)
Damien Miller7b22d652000-06-18 14:07:04 +10001165 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11001166 else
1167 AC_MSG_RESULT([no (default)])
1168 fi
1169 ]
1170)
1171
Damien Millera22ba012000-03-02 23:09:20 +11001172# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11001173piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +11001174AC_ARG_WITH(pid-dir,
1175 [ --with-pid-dir=PATH Specify location of ssh.pid file],
1176 [
1177 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +11001178 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +11001179 fi
1180 ]
1181)
Damien Miller4018c192000-04-30 09:30:44 +10001182
Damien Millerdbd250f2000-01-18 08:57:14 +11001183AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11001184AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11001185
andre2ff7b5d2000-06-03 14:57:40 +00001186dnl allow user to disable some login recording features
1187AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001188 [ --disable-lastlog disable use of lastlog even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001189 [ AC_DEFINE(DISABLE_LASTLOG) ]
1190)
1191AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00001192 [ --disable-utmp disable use of utmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001193 [ AC_DEFINE(DISABLE_UTMP) ]
1194)
1195AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00001196 [ --disable-utmpx disable use of utmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001197 [ AC_DEFINE(DISABLE_UTMPX) ]
1198)
1199AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00001200 [ --disable-wtmp disable use of wtmp even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001201 [ AC_DEFINE(DISABLE_WTMP) ]
1202)
1203AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00001204 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001205 [ AC_DEFINE(DISABLE_WTMPX) ]
1206)
1207AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00001208 [ --disable-libutil disable use of libutil (login() etc.) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001209 [ AC_DEFINE(DISABLE_LOGIN) ]
1210)
1211AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00001212 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001213 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
1214)
1215AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00001216 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
andre2ff7b5d2000-06-03 14:57:40 +00001217 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
1218)
1219AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00001220 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
andre2ff7b5d2000-06-03 14:57:40 +00001221 [ conf_lastlog_location="$withval"; ],)
1222
1223dnl lastlog, [uw]tmpx? detection
1224dnl NOTE: set the paths in the platform section to avoid the
1225dnl need for command-line parameters
1226dnl lastlog and [uw]tmp are subject to a file search if all else fails
1227
1228dnl lastlog detection
1229dnl NOTE: the code itself will detect if lastlog is a directory
1230AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
1231AC_TRY_COMPILE([
1232#include <sys/types.h>
1233#include <utmp.h>
1234#ifdef HAVE_LASTLOG_H
1235# include <lastlog.h>
1236#endif
Damien Miller2994e082000-06-04 15:51:47 +10001237#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001238# include <paths.h>
1239#endif
1240 ],
1241 [ char *lastlog = LASTLOG_FILE; ],
1242 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10001243 [
1244 AC_MSG_RESULT(no)
1245 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
1246 AC_TRY_COMPILE([
1247#include <sys/types.h>
1248#include <utmp.h>
1249#ifdef HAVE_LASTLOG_H
1250# include <lastlog.h>
1251#endif
1252#ifdef HAVE_PATHS_H
1253# include <paths.h>
1254#endif
1255 ],
1256 [ char *lastlog = _PATH_LASTLOG; ],
1257 [ AC_MSG_RESULT(yes) ],
1258 [
andree441aa32000-06-12 22:34:38 +00001259 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10001260 system_lastlog_path=no
1261 ])
1262 ]
andre2ff7b5d2000-06-03 14:57:40 +00001263)
Damien Miller2994e082000-06-04 15:51:47 +10001264
andre2ff7b5d2000-06-03 14:57:40 +00001265if test -z "$conf_lastlog_location"; then
1266 if test x"$system_lastlog_path" = x"no" ; then
1267 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10001268 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00001269 conf_lastlog_location=$f
1270 fi
1271 done
1272 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00001273 AC_MSG_WARN([** Cannot find lastlog **])
1274 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00001275 fi
1276 fi
1277fi
1278
1279if test -n "$conf_lastlog_location"; then
1280 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1281fi
1282
1283dnl utmp detection
1284AC_MSG_CHECKING([if your system defines UTMP_FILE])
1285AC_TRY_COMPILE([
1286#include <sys/types.h>
1287#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001288#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001289# include <paths.h>
1290#endif
1291 ],
1292 [ char *utmp = UTMP_FILE; ],
1293 [ AC_MSG_RESULT(yes) ],
1294 [ AC_MSG_RESULT(no)
1295 system_utmp_path=no ]
1296)
1297if test -z "$conf_utmp_location"; then
1298 if test x"$system_utmp_path" = x"no" ; then
1299 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1300 if test -f $f ; then
1301 conf_utmp_location=$f
1302 fi
1303 done
1304 if test -z "$conf_utmp_location"; then
1305 AC_DEFINE(DISABLE_UTMP)
1306 fi
1307 fi
1308fi
1309if test -n "$conf_utmp_location"; then
1310 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1311fi
1312
1313dnl wtmp detection
1314AC_MSG_CHECKING([if your system defines WTMP_FILE])
1315AC_TRY_COMPILE([
1316#include <sys/types.h>
1317#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001318#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001319# include <paths.h>
1320#endif
1321 ],
1322 [ char *wtmp = WTMP_FILE; ],
1323 [ AC_MSG_RESULT(yes) ],
1324 [ AC_MSG_RESULT(no)
1325 system_wtmp_path=no ]
1326)
1327if test -z "$conf_wtmp_location"; then
1328 if test x"$system_wtmp_path" = x"no" ; then
1329 for f in /usr/adm/wtmp /var/log/wtmp; do
1330 if test -f $f ; then
1331 conf_wtmp_location=$f
1332 fi
1333 done
1334 if test -z "$conf_wtmp_location"; then
1335 AC_DEFINE(DISABLE_WTMP)
1336 fi
1337 fi
1338fi
1339if test -n "$conf_wtmp_location"; then
1340 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1341fi
1342
1343
1344dnl utmpx detection - I don't know any system so perverse as to require
1345dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1346dnl there, though.
1347AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1348AC_TRY_COMPILE([
1349#include <sys/types.h>
1350#include <utmp.h>
1351#ifdef HAVE_UTMPX_H
1352#include <utmpx.h>
1353#endif
Damien Miller2994e082000-06-04 15:51:47 +10001354#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001355# include <paths.h>
1356#endif
1357 ],
1358 [ char *utmpx = UTMPX_FILE; ],
1359 [ AC_MSG_RESULT(yes) ],
1360 [ AC_MSG_RESULT(no)
1361 system_utmpx_path=no ]
1362)
1363if test -z "$conf_utmpx_location"; then
1364 if test x"$system_utmpx_path" = x"no" ; then
1365 AC_DEFINE(DISABLE_UTMPX)
1366 fi
1367else
1368 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1369fi
1370
1371dnl wtmpx detection
1372AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1373AC_TRY_COMPILE([
1374#include <sys/types.h>
1375#include <utmp.h>
1376#ifdef HAVE_UTMPX_H
1377#include <utmpx.h>
1378#endif
Damien Miller2994e082000-06-04 15:51:47 +10001379#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001380# include <paths.h>
1381#endif
1382 ],
1383 [ char *wtmpx = WTMPX_FILE; ],
1384 [ AC_MSG_RESULT(yes) ],
1385 [ AC_MSG_RESULT(no)
1386 system_wtmpx_path=no ]
1387)
1388if test -z "$conf_wtmpx_location"; then
1389 if test x"$system_wtmpx_path" = x"no" ; then
1390 AC_DEFINE(DISABLE_WTMPX)
1391 fi
1392else
1393 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1394fi
1395
Damien Miller4018c192000-04-30 09:30:44 +10001396
1397# Change default command timeout for builtin PRNG
Damien Miller14c12cb2000-06-07 22:20:23 +10001398entropy_timeout=200
Damien Miller4018c192000-04-30 09:30:44 +10001399AC_ARG_WITH(entropy-timeout,
1400 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1401 [
1402 if test "x$withval" != "xno" ; then
1403 entropy_timeout=$withval
1404 fi
1405 ]
1406)
1407AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1408
1409
Damien Miller29ea30d2000-03-17 10:54:15 +11001410if test ! -z "$blibpath" ; then
1411 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1412 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1413fi
1414
Damien Millerbac2d8a2000-09-05 16:13:06 +11001415AC_EXEEXT
1416
Damien Miller0437b332000-05-02 09:56:41 +10001417AC_OUTPUT(Makefile ssh_prng_cmds)
1418
Damien Miller7b22d652000-06-18 14:07:04 +10001419# Print summary of options
1420
1421if test x$MANTYPE = x'$(CATMAN)' ; then
1422 MAN_MSG=cat
1423else
1424 MAN_MSG=man
1425fi
1426if test ! -z "$RANDOM_POOL" ; then
1427 RAND_MSG="Device ($RANDOM_POOL)"
1428else
1429 if test ! -z "$EGD_SOCKET" ; then
1430 RAND_MSG="EGD ($EGD_SOCKET)"
1431 else
1432 RAND_MSG="Builtin (timeout $entropy_timeout)"
1433 fi
1434fi
1435
1436# Someone please show me a better way :)
1437A=`eval echo ${prefix}` ; A=`eval echo ${A}`
1438B=`eval echo ${bindir}` ; B=`eval echo ${B}`
1439C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
1440D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
1441E=`eval echo ${libexecdir}/ssh/ssh-askpass` ; E=`eval echo ${E}`
1442F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
1443G=`eval echo ${piddir}` ; G=`eval echo ${G}`
1444
1445echo ""
1446echo "OpenSSH configured has been configured with the following options."
1447echo " User binaries: $B"
1448echo " System binaries: $C"
1449echo " Configuration files: $D"
1450echo " Askpass program: $E"
1451echo " Manual pages: $F"
1452echo " PID file: $G"
1453echo " Random number collection: $RAND_MSG"
1454echo " Manpage format: $MAN_MSG"
1455echo " PAM support: ${PAM_MSG}"
1456echo " KerberosIV support: $KRB4_MSG"
1457echo " AFS support: $AFS_MSG"
1458echo " S/KEY support: $SKEY_MSG"
1459echo " TCP Wrappers support: $TCPW_MSG"
1460echo " MD5 password support: $MD5_MSG"
1461echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
1462echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
1463echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
1464
1465echo ""
1466
1467echo "Compiler flags: ${CFLAGS}"
1468echo "Linker flags: ${LDFLAGS}"
1469echo "Libraries: ${LIBS}"
1470
1471echo ""
1472