blob: 8056ada053b414d748b6805dd312a93dc83812f0 [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 Miller166bd442000-03-16 10:48:25 +110017if test -z "$LD" ; then
18 LD=$CC
19fi
20AC_SUBST(LD)
21
22# C Compiler features
23AC_C_INLINE
24if test "$GCC" = "yes"; then
25 CFLAGS="$CFLAGS -Wall"
26fi
27
Damien Millera22ba012000-03-02 23:09:20 +110028# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110029case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110030*-*-aix*)
31 AFS_LIBS="-lld"
Damien Millerdb819592000-03-14 13:44:01 +110032 CFLAGS="$CFLAGS -I/usr/local/include"
33 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +110034 if test "$LD" != "gcc" -a -z "$blibpath"; then
35 blibpath="/usr/lib:/lib:/usr/local/lib"
36 fi
Damien Millerd2c208a2000-05-17 22:00:02 +100037 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
Damien Millereca71f82000-01-20 22:38:27 +110038 AC_DEFINE(BROKEN_GETADDRINFO)
andre60f3c982000-06-03 16:18:19 +000039 dnl AIX handles lastlog as part of its login message
40 AC_DEFINE(DISABLE_LASTLOG)
Damien Miller75b1d102000-01-07 14:01:41 +110041 ;;
Damien Miller76112de1999-12-21 11:18:08 +110042*-*-hpux10*)
43 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +100044 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +110045 fi
46 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
47 AC_DEFINE(IPADDR_IN_DISPLAY)
48 AC_MSG_CHECKING(for HPUX trusted system password database)
49 if test -f /tcb/files/auth/system/default; then
50 AC_MSG_RESULT(yes)
51 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
52 LIBS="$LIBS -lsec"
Damien Miller105b7f02000-01-07 08:45:55 +110053 AC_MSG_WARN([This configuration is untested])
Damien Miller76112de1999-12-21 11:18:08 +110054 else
55 AC_MSG_RESULT(no)
56 AC_DEFINE(DISABLE_SHADOW)
57 fi
Damien Miller670a4b82000-01-22 13:53:11 +110058 MANTYPE='$(CATMAN)'
59 mansubdir=cat
Damien Miller76112de1999-12-21 11:18:08 +110060 ;;
Damien Miller1bead332000-04-30 00:47:29 +100061*-*-hpux11*)
62 if test -z "$GCC"; then
63 CFLAGS="$CFLAGS -Ae"
64 fi
65 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
Damien Miller1bead332000-04-30 00:47:29 +100066 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Miller1bead332000-04-30 00:47:29 +100067 AC_MSG_CHECKING(for HPUX trusted system password database)
68 if test -f /tcb/files/auth/system/default; then
69 AC_MSG_RESULT(yes)
70 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
71 LIBS="$LIBS -lsec"
72 AC_MSG_WARN([This configuration is untested])
73 else
74 AC_MSG_RESULT(no)
75 AC_DEFINE(DISABLE_SHADOW)
76 fi
77 MANTYPE='$(CATMAN)'
78 mansubdir=cat
79 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +110080*-*-irix5*)
Damien Millerdb819592000-03-14 13:44:01 +110081 CFLAGS="$CFLAGS -I/usr/local/include"
82 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller07278932000-01-22 14:05:37 +110083 MANTYPE='$(CATMAN)'
Damien Miller1808f382000-01-06 12:03:12 +110084 no_libsocket=1
85 no_libnsl=1
86 ;;
87*-*-irix6*)
Damien Millerdb819592000-03-14 13:44:01 +110088 CFLAGS="$CFLAGS -I/usr/local/include"
89 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller07278932000-01-22 14:05:37 +110090 MANTYPE='$(CATMAN)'
91 AC_MSG_WARN([*** Irix 6.x is not tested, please report you experiences *** ])
Damien Millerbeb4ba51999-12-28 15:09:35 +110092 no_libsocket=1
93 no_libnsl=1
94 ;;
Damien Millerb29ea912000-01-15 14:12:03 +110095*-*-linux*)
96 no_dev_ptmx=1
Damien Miller7bcb0892000-03-11 20:45:40 +110097 AC_DEFINE(DONT_TRY_OTHER_AF)
98 inet6_default_4in6=yes
Damien Millerb29ea912000-01-15 14:12:03 +110099 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100100*-*-netbsd*)
Damien Millera22ba012000-03-02 23:09:20 +1100101 need_dash_r=1
Damien Milleree1c0b32000-01-21 00:18:15 +1100102 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100103*-*-solaris*)
Damien Millerdb819592000-03-14 13:44:01 +1100104 CFLAGS="$CFLAGS -I/usr/local/include"
Damien Miller08c788a2000-03-16 07:52:29 +1100105 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
Damien Millera22ba012000-03-02 23:09:20 +1100106 need_dash_r=1
andre2ff7b5d2000-06-03 14:57:40 +0000107 # hardwire lastlog location (can't detect it on some versions)
108 conf_lastlog_location="/var/adm/lastlog"
Damien Miller75b1d102000-01-07 14:01:41 +1100109 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000110*-*-sunos4*)
111 CFLAGS="$CFLAGS -DSUNOS4"
112 AC_CHECK_FUNCS(getpwanam)
113 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100114*-*-sysv*)
Damien Millerdb819592000-03-14 13:44:01 +1100115 CFLAGS="$CFLAGS -I/usr/local/include"
116 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller0e1cf7c2000-01-26 12:15:30 +1100117 MANTYPE='$(CATMAN)'
118 mansubdir=cat
Damien Miller75b1d102000-01-07 14:01:41 +1100119 LIBS="$LIBS -lgen -lsocket"
120 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100121esac
122
Damien Millera22ba012000-03-02 23:09:20 +1100123# Checks for libraries.
Damien Millerab18c411999-11-11 10:40:23 +1100124AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
125AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Millerab18c411999-11-11 10:40:23 +1100126
Damien Millerbeb4ba51999-12-28 15:09:35 +1100127if test -z "$no_libsocket" ; then
128 AC_CHECK_LIB(nsl, yp_match, , )
129fi
130if test -z "$no_libnsl" ; then
131 AC_CHECK_LIB(socket, main, , )
Damien Miller32b3cf21999-12-26 10:21:48 +1100132fi
Damien Millerab18c411999-11-11 10:40:23 +1100133
Damien Millera22ba012000-03-02 23:09:20 +1100134# Checks for header files.
andre2ff7b5d2000-06-03 14:57:40 +0000135AC_CHECK_HEADERS(bstring.h endian.h lastlog.h login.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/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h stddef.h time.h util.h utmp.h utmpx.h)
Damien Millerab18c411999-11-11 10:40:23 +1100136
Damien Millera22ba012000-03-02 23:09:20 +1100137# Checks for library functions.
andre2ff7b5d2000-06-03 14:57:40 +0000138AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage innetgr md5_crypt memmove mkdtemp on_exit openpty rresvport_af setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy vsnprintf vhangup _getpty __b64_ntop)
139dnl checks for time functions
140AC_CHECK_FUNCS(gettimeofday time)
141dnl checks for libutil functions
142AC_CHECK_FUNCS(login logout updwtmp logwtmp)
143dnl checks for utmp functions
144AC_CHECK_FUNCS(entutent getutent getutid getutline pututline setutent)
145AC_CHECK_FUNCS(utmpname)
146dnl checks for utmpx functions
147AC_CHECK_FUNCS(entutxent getutxent getutxid getutxline pututxline )
148AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100149
Damien Miller04f80141999-11-19 15:32:34 +1100150AC_CHECK_FUNC(login,
151 [AC_DEFINE(HAVE_LOGIN)],
152 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
153)
154
155AC_CHECK_FUNC(daemon,
156 [AC_DEFINE(HAVE_DAEMON)],
157 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
158)
159
Damien Miller9fb07e42000-03-05 16:22:59 +1100160AC_CHECK_FUNC(getpagesize,
161 [AC_DEFINE(HAVE_GETPAGESIZE)],
162 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
163)
164
Damien Millera22ba012000-03-02 23:09:20 +1100165AC_ARG_WITH(pam,
166 [ --without-pam Disable PAM support ],
167 [
168 if test "x$withval" = "xno" ; then
169 no_pam=1
170 AC_DEFINE(DISABLE_PAM)
171 fi
172 ]
173)
174if test -z "$no_pam" -a "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then
175 AC_CHECK_LIB(dl, dlopen, , )
176 LIBS="$LIBS -lpam"
177
Damien Miller0e65eed2000-05-17 22:16:05 +1000178 AC_CHECK_FUNCS(pam_getenvlist)
Damien Miller1bead332000-04-30 00:47:29 +1000179
Damien Millera22ba012000-03-02 23:09:20 +1100180 # Check PAM strerror arguments (old PAM)
181 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
182 AC_TRY_COMPILE(
183 [
Damien Miller81171112000-04-23 11:14:01 +1000184#include <stdlib.h>
185#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100186 ],
187 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
188 [AC_MSG_RESULT(no)],
189 [
190 AC_DEFINE(HAVE_OLD_PAM)
191 AC_MSG_RESULT(yes)
192 ]
193 )
194fi
195
196# The big search for OpenSSL
197AC_ARG_WITH(ssl-dir,
198 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
199 [
200 if test "x$withval" != "$xno" ; then
201 tryssldir=$withval
202 fi
203 ]
204)
205
206saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100207saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100208saved_CFLAGS="$CFLAGS"
209if test "x$prefix" != "xNONE" ; then
210 tryssldir="$tryssldir $prefix"
211fi
Damien Miller61e50f12000-05-08 20:49:37 +1000212AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera22ba012000-03-02 23:09:20 +1100213
Damien Miller61e50f12000-05-08 20:49:37 +1000214 for ssldir in "" $tryssldir /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
215 if test ! -z "$ssldir" ; then
216 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
217 CFLAGS="$saved_CFLAGS -I$ssldir/include"
218 if test ! -z "$need_dash_r" ; then
219 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
220 fi
Damien Millera1ad4802000-03-15 10:04:54 +1100221 else
Damien Miller61e50f12000-05-08 20:49:37 +1000222 LDFLAGS="$saved_LDFLAGS"
Damien Millerb85dcad2000-03-11 11:37:00 +1100223 fi
224
Damien Miller3b512e12000-05-17 23:29:18 +1000225 LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000226
Damien Miller3b512e12000-05-17 23:29:18 +1000227 # Basic test to check for compatible version and correct linking
228 # *does not* test for RSA - that comes later.
229 AC_TRY_RUN(
230 [
Damien Millere59ce622000-05-01 20:54:17 +1000231#include <string.h>
232#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000233int main(void)
234{
Damien Miller3b512e12000-05-17 23:29:18 +1000235 char a[2048];
236 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000237 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000238 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000239}
Damien Miller3b512e12000-05-17 23:29:18 +1000240 ],
241 [
242 found_crypto=1
243 break;
244 ], []
245 )
Damien Miller61e50f12000-05-08 20:49:37 +1000246
247 if test ! -z "$found_crypto" ; then
248 break;
249 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100250 done
251
Damien Miller61e50f12000-05-08 20:49:37 +1000252 if test -z "$found_crypto" ; then
253 AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])
Damien Millerb85dcad2000-03-11 11:37:00 +1100254 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000255 if test -z "$ssldir" ; then
256 ssldir="(system)"
257 fi
Damien Millera22ba012000-03-02 23:09:20 +1100258
Damien Miller61e50f12000-05-08 20:49:37 +1000259 ac_cv_openssldir=$ssldir
260])
261
262if test ! -z "$ac_cv_openssldir" -a ! "x$ac_cv_openssldir" = "x(system)" ; then
263 AC_DEFINE(HAVE_OPENSSL)
264 dnl Need to recover ssldir - test above runs in subshell
265 ssldir=$ac_cv_openssldir
Damien Millera1ad4802000-03-15 10:04:54 +1100266 CFLAGS="$saved_CFLAGS -I$ssldir/include"
267 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
268 if test ! -z "$need_dash_r" ; then
269 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
Damien Millera22ba012000-03-02 23:09:20 +1100270 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100271 if test ! -z "$blibpath" ; then
272 blibpath="$blibpath:$ssldir:$ssldir/lib"
273 fi
Damien Millera22ba012000-03-02 23:09:20 +1100274fi
Damien Miller3b512e12000-05-17 23:29:18 +1000275LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000276
Damien Miller3b512e12000-05-17 23:29:18 +1000277# Now test RSA support
278saved_LIBS="$LIBS"
279AC_MSG_CHECKING([for RSA support])
280for WANTS_RSAREF in "" 1 ; do
281 if test -z "$WANTS_RSAREF" ; then
282 LIBS="$saved_LIBS"
283 else
284 LIBS="$saved_LIBS -lRSAglue -lrsaref"
285 fi
286 AC_TRY_RUN([
287#include <string.h>
288#include <openssl/rand.h>
289#include <openssl/rsa.h>
290#include <openssl/bn.h>
291#include <openssl/sha.h>
292int main(void)
293{
294 int num; RSA *key; static unsigned char p_in[] = "blahblah";
295 unsigned char c[256], p[256];
296 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
297 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
298 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
299 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
300}
301 ],
302 [
303 rsa_works=1
304 break;
305 ], [])
306done
307
308if test ! -z "$no_rsa" ; then
309 AC_MSG_RESULT(disabled)
310else
311 if test -z "$rsa_works" ; then
312 AC_MSG_WARN([*** No RSA support found *** ])
313 else
314 if test -z "$WANTS_RSAREF" ; then
315 AC_MSG_RESULT(yes)
316 else
317 AC_MSG_RESULT(using RSAref)
318 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
319 fi
320 fi
321fi
Damien Millera22ba012000-03-02 23:09:20 +1100322
323# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100324AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100325AC_CHECK_SIZEOF(short int, 2)
326AC_CHECK_SIZEOF(int, 4)
327AC_CHECK_SIZEOF(long int, 4)
328AC_CHECK_SIZEOF(long long int, 8)
329
Damien Millera22ba012000-03-02 23:09:20 +1100330# More checks for data types
Damien Miller61e50f12000-05-08 20:49:37 +1000331AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
332 AC_TRY_COMPILE(
333 [ #include <sys/types.h> ],
334 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
335 [ ac_cv_have_intxx_t="yes" ],
336 [ ac_cv_have_intxx_t="no" ]
337 )
338])
339if test "x$ac_cv_have_intxx_t" = "xyes" ; then
340 AC_DEFINE(HAVE_INTXX_T)
341 have_intxx_t=1
342fi
343
344AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
345 AC_TRY_COMPILE(
346 [ #include <sys/types.h> ],
347 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
348 [ ac_cv_have_u_intxx_t="yes" ],
349 [ ac_cv_have_u_intxx_t="no" ]
350 )
351])
352if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
353 AC_DEFINE(HAVE_U_INTXX_T)
354 have_u_intxx_t=1
355fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100356
Damien Millerc6398ef1999-11-20 12:18:40 +1100357
Damien Millereaf99942000-01-19 13:45:07 +1100358if test -z "$have_u_intxx_t" -o -z "$have_intxx_t" -a \
Damien Millerb29ea912000-01-15 14:12:03 +1100359 "x$ac_cv_header_sys_bitypes_h" = "xyes"
360then
361 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
362 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +1000363 [
364#include <sys/bitypes.h>
365 ],
Damien Millerb29ea912000-01-15 14:12:03 +1100366 [
Damien Miller70494d12000-04-03 15:57:06 +1000367 int8_t a; int16_t b; int32_t c;
368 u_int8_t e; u_int16_t f; u_int32_t g;
369 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +1100370 ],
371 [
372 AC_DEFINE(HAVE_U_INTXX_T)
373 AC_DEFINE(HAVE_INTXX_T)
374 AC_MSG_RESULT(yes)
375 ],
376 [AC_MSG_RESULT(no)]
377 )
378fi
379
Damien Millerd6121d22000-03-17 23:26:46 +1100380if test -z "$have_u_intxx_t" ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000381 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
382 AC_TRY_COMPILE(
383 [
384#include <sys/types.h>
385 ],
386 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
387 [ ac_cv_have_uintxx_t="yes" ],
388 [ ac_cv_have_uintxx_t="no" ]
389 )
390 ])
391 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
392 AC_DEFINE(HAVE_UINTXX_T)
393 fi
Damien Millerd6121d22000-03-17 23:26:46 +1100394fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100395
Damien Miller61e50f12000-05-08 20:49:37 +1000396AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
397 AC_TRY_COMPILE(
398 [
Damien Miller81171112000-04-23 11:14:01 +1000399#include <sys/types.h>
400#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000401 ],
402 [socklen_t foo; foo = 1235;],
403 [ ac_cv_have_socklen_t="yes" ],
404 [ ac_cv_have_socklen_t="no" ]
405 )
406])
407if test "x$ac_cv_have_socklen_t" = "xyes" ; then
408 AC_DEFINE(HAVE_SOCKLEN_T)
409fi
Damien Miller74d0d4a1999-12-29 02:24:35 +1100410
Damien Miller61e50f12000-05-08 20:49:37 +1000411AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
412 AC_TRY_COMPILE(
413 [
414#include <sys/types.h>
415 ],
416 [ size_t foo; foo = 1235; ],
417 [ ac_cv_have_size_t="yes" ],
418 [ ac_cv_have_size_t="no" ]
419 )
420])
421if test "x$ac_cv_have_size_t" = "xyes" ; then
422 AC_DEFINE(HAVE_SIZE_T)
423fi
Damien Miller95058511999-12-29 10:36:45 +1100424
Damien Miller615f9392000-05-17 22:53:33 +1000425AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
426 AC_TRY_COMPILE(
427 [
428#include <sys/types.h>
429 ],
430 [ ssize_t foo; foo = 1235; ],
431 [ ac_cv_have_ssize_t="yes" ],
432 [ ac_cv_have_ssize_t="no" ]
433 )
434])
435if test "x$ac_cv_have_ssize_t" = "xyes" ; then
436 AC_DEFINE(HAVE_SSIZE_T)
437fi
438
Damien Miller61e50f12000-05-08 20:49:37 +1000439
440AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
441 AC_TRY_COMPILE(
442 [
Damien Miller81171112000-04-23 11:14:01 +1000443#include <sys/types.h>
444#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000445 ],
446 [ struct sockaddr_storage s; ],
447 [ ac_cv_have_struct_sockaddr_storage="yes" ],
448 [ ac_cv_have_struct_sockaddr_storage="no" ]
449 )
450])
451if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
452 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
453fi
Damien Miller34132e52000-01-14 15:45:46 +1100454
Damien Miller61e50f12000-05-08 20:49:37 +1000455AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
456 AC_TRY_COMPILE(
457 [
458#include <netinet/in.h>
459 ],
460 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
461 [ ac_cv_have_struct_sockaddr_in6="yes" ],
462 [ ac_cv_have_struct_sockaddr_in6="no" ]
463 )
464])
465if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
466 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
467fi
Damien Miller34132e52000-01-14 15:45:46 +1100468
Damien Miller61e50f12000-05-08 20:49:37 +1000469AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
470 AC_TRY_COMPILE(
471 [
472#include <netinet/in.h>
473 ],
474 [ struct in6_addr s; s.s6_addr[0] = 0; ],
475 [ ac_cv_have_struct_in6_addr="yes" ],
476 [ ac_cv_have_struct_in6_addr="no" ]
477 )
478])
479if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
480 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
481fi
Damien Miller34132e52000-01-14 15:45:46 +1100482
Damien Miller61e50f12000-05-08 20:49:37 +1000483AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
484 AC_TRY_COMPILE(
485 [
Damien Miller81171112000-04-23 11:14:01 +1000486#include <sys/types.h>
487#include <sys/socket.h>
488#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000489 ],
490 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
491 [ ac_cv_have_struct_addrinfo="yes" ],
492 [ ac_cv_have_struct_addrinfo="no" ]
493 )
494])
495if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
496 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
497fi
498
Damien Miller34132e52000-01-14 15:45:46 +1100499
Damien Millera22ba012000-03-02 23:09:20 +1100500# Checks for structure members
Damien Miller34132e52000-01-14 15:45:46 +1100501
Damien Miller61e50f12000-05-08 20:49:37 +1000502OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
503OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
504OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
505OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
506OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +1000507OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +1000508OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
509OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
510OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
511OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
512OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
513OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +0000514OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
515OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
516OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
517OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
518
Damien Miller61e50f12000-05-08 20:49:37 +1000519
520
521AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
522 ac_cv_have_ss_family_in_struct_ss, [
523 AC_TRY_COMPILE(
524 [
Damien Miller81171112000-04-23 11:14:01 +1000525#include <sys/types.h>
526#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000527 ],
528 [ struct sockaddr_storage s; s.ss_family = 1; ],
529 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
530 [ ac_cv_have_ss_family_in_struct_ss="no" ],
531 )
532])
533if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
534 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
535fi
536
537
538AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
539 ac_cv_have___ss_family_in_struct_ss, [
540 AC_TRY_COMPILE(
541 [
Damien Miller81171112000-04-23 11:14:01 +1000542#include <sys/types.h>
543#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000544 ],
545 [ struct sockaddr_storage s; s.__ss_family = 1; ],
546 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
547 [ ac_cv_have___ss_family_in_struct_ss="no" ]
548 )
549])
550if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
551 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
552fi
Damien Millerbf1c9b21999-12-09 10:16:54 +1100553
Damien Miller61e50f12000-05-08 20:49:37 +1000554
555AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
556 AC_TRY_LINK([],
557 [ extern char *__progname; printf("%s", __progname); ],
558 [ ac_cv_libc_defines___progname="yes" ],
559 [ ac_cv_libc_defines___progname="no" ]
560 )
561])
562if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
563 AC_DEFINE(HAVE___PROGNAME)
564fi
565
Damien Millera22ba012000-03-02 23:09:20 +1100566
567# Looking for programs, paths and files
568AC_ARG_WITH(rsh,
569 [ --with-rsh=PATH Specify path to remote shell program ],
570 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100571 if test "x$withval" != "$no" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100572 AC_DEFINE_UNQUOTED(RSH_PATH, "$withval")
573 fi
574 ],
575 [
576 AC_PATH_PROG(rsh_path, rsh)
577 ]
578)
579
580AC_ARG_WITH(xauth,
581 [ --with-xauth=PATH Specify path to xauth program ],
582 [
583 if test "x$withval" != "$xno" ; then
584 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$withval")
585 fi
586 ],
587 [
588 AC_PATH_PROG(xauth_path, xauth)
589 if test ! -z "$xauth_path" -a -x "/usr/openwin/bin/xauth" ; then
590 xauth_path="/usr/openwin/bin/xauth"
591 fi
592 ]
593)
594
595if test ! -z "$xauth_path" ; then
596 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
597fi
598if test ! -z "$rsh_path" ; then
599 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
600fi
601
602# Check for mail directory (last resort if we cannot get it from headers)
603if test ! -z "$MAIL" ; then
604 maildir=`dirname $MAIL`
605 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
606fi
607
Damien Millera22ba012000-03-02 23:09:20 +1100608if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +1100609 AC_CHECK_FILE("/dev/ptmx",
610 [
611 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
612 have_dev_ptmx=1
613 ]
614 )
Damien Millera22ba012000-03-02 23:09:20 +1100615fi
Damien Miller204ad072000-03-02 23:56:12 +1100616AC_CHECK_FILE("/dev/ptc",
617 [
618 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
619 have_dev_ptc=1
620 ]
621)
622
Damien Millera22ba012000-03-02 23:09:20 +1100623# Options from here on. Some of these are preset by platform above
624
Damien Millera22ba012000-03-02 23:09:20 +1100625# Check for user-specified random device, otherwise check /dev/urandom
626AC_ARG_WITH(random,
627 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
628 [
Damien Miller040f3832000-04-03 14:50:43 +1000629 if test "x$withval" != "xno" ; then
630 RANDOM_POOL="$withval";
631 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
632 fi
Damien Millera22ba012000-03-02 23:09:20 +1100633 ],
634 [
635 # Check for random device
636 AC_CHECK_FILE("/dev/urandom",
637 [
638 RANDOM_POOL="/dev/urandom";
639 AC_SUBST(RANDOM_POOL)
640 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
641 ]
642 )
643 ]
644)
645
646# Check for EGD pool file
647AC_ARG_WITH(egd-pool,
648 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
649 [
Damien Miller040f3832000-04-03 14:50:43 +1000650 if test "x$withval" != "xno" ; then
651 EGD_SOCKET="$withval";
652 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
653 fi
Damien Millera22ba012000-03-02 23:09:20 +1100654 ]
655)
656
Damien Miller0437b332000-05-02 09:56:41 +1000657# detect pathnames for entropy gathering commands, if we need them
658INSTALL_SSH_PRNG_CMDS=""
659rm -f prng_commands
Damien Miller11e37f62000-04-08 18:23:30 +1000660if test -z "$RANDOM_POOL" -a -z "$EGD_SOCKET" ; then
661 # Use these commands to collect entropy
Damien Miller61e50f12000-05-08 20:49:37 +1000662 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
663 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
664 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
665 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
666 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
667 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
668 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
669 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
670 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
671 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
672 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
673 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
674 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
675 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
676 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
Damien Miller0437b332000-05-02 09:56:41 +1000677
678 INSTALL_SSH_PRNG_CMDS="yes"
Damien Miller11e37f62000-04-08 18:23:30 +1000679fi
Damien Miller0437b332000-05-02 09:56:41 +1000680AC_SUBST(INSTALL_SSH_PRNG_CMDS)
681
Damien Miller11e37f62000-04-08 18:23:30 +1000682
Damien Miller670a4b82000-01-22 13:53:11 +1100683AC_ARG_WITH(catman,
684 [ --with-catman=man|cat Install preformatted manpages[no]],
685 [
686 MANTYPE='$(CATMAN)'
687 if test x"$withval" != x"yes" ; then
688 mansubdir=$withval
689 else
690 mansubdir=cat
691 fi
692 ], [
693 if test -z "$MANTYPE" ; then
694 MANTYPE='$(TROFFMAN)'
695 mansubdir=man
696 fi
697 ]
698)
699AC_SUBST(MANTYPE)
700AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +1100701
Damien Millera22ba012000-03-02 23:09:20 +1100702# Check whether user wants Kerberos support
Damien Miller80297751999-11-19 13:03:25 +1100703AC_ARG_WITH(kerberos4,
Damien Miller105b7f02000-01-07 08:45:55 +1100704 [ --with-kerberos4=PATH Enable Kerberos 4 support],
Damien Miller80297751999-11-19 13:03:25 +1100705 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100706 if test "x$withval" != "xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +1100707
708 if test "x$withval" != "$xyes" ; then
709 CFLAGS="$CFLAGS -I${withval}/include"
710 LDFLAGS="$LDFLAGS -L${withval}/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100711 if test ! -z "$need_dash_r" ; then
712 LDFLAGS="$LDFLAGS -R${withval}/lib"
713 fi
714 if test ! -z "$blibpath" ; then
715 blibpath="$blibpath:${withval}/lib"
716 fi
Damien Miller105b7f02000-01-07 08:45:55 +1100717 else
718 if test -d /usr/include/kerberosIV ; then
719 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
720 fi
721 fi
722
723 AC_CHECK_HEADERS(krb.h)
724 AC_CHECK_LIB(krb, main)
725 if test "$ac_cv_header_krb_h" != yes; then
726 AC_MSG_WARN([Cannot find krb.h, build may fail])
727 fi
728 if test "$ac_cv_lib_krb_main" != yes; then
729 AC_MSG_WARN([Cannot find libkrb, build may fail])
730 fi
731
Damien Millerc85f9b42000-01-29 10:20:21 +1100732 KLIBS="-lkrb -ldes"
Damien Miller105b7f02000-01-07 08:45:55 +1100733 AC_CHECK_LIB(resolv, dn_expand, , )
734 KRB4=yes
Damien Miller8bdeee21999-12-30 15:50:54 +1100735 AC_DEFINE(KRB4)
Damien Miller8bdeee21999-12-30 15:50:54 +1100736 fi
Damien Miller80297751999-11-19 13:03:25 +1100737 ]
738)
739
Damien Millera22ba012000-03-02 23:09:20 +1100740# Check whether user wants AFS support
Damien Millerc6398ef1999-11-20 12:18:40 +1100741AC_ARG_WITH(afs,
Damien Miller105b7f02000-01-07 08:45:55 +1100742 [ --with-afs=PATH Enable AFS support],
Damien Miller80297751999-11-19 13:03:25 +1100743 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100744 if test "x$withval" != "xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +1100745
746 if test "x$withval" != "$xyes" ; then
747 CFLAGS="$CFLAGS -I${withval}/include"
748 LFLAGS="$LFLAGS -L${withval}/lib"
749 fi
750
751 if test -z "$KRB4" ; then
752 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
753 fi
754
Damien Miller8bdeee21999-12-30 15:50:54 +1100755 LIBS="$LIBS -lkafs"
Damien Miller105b7f02000-01-07 08:45:55 +1100756 if test ! -z "$AFS_LIBS" ; then
757 LIBS="$LIBS $AFS_LIBS"
758 fi
759 AC_DEFINE(AFS)
Damien Miller8bdeee21999-12-30 15:50:54 +1100760 fi
Damien Miller80297751999-11-19 13:03:25 +1100761 ]
762)
Damien Millerc85f9b42000-01-29 10:20:21 +1100763LIBS="$LIBS $KLIBS"
Damien Miller80297751999-11-19 13:03:25 +1100764
Damien Millera22ba012000-03-02 23:09:20 +1100765# Check whether user wants S/Key support
Damien Miller80297751999-11-19 13:03:25 +1100766AC_ARG_WITH(skey,
767 [ --with-skey Enable S/Key support],
768 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100769 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +1100770 AC_DEFINE(SKEY)
771 LIBS="$LIBS -lskey"
772 fi
Damien Miller80297751999-11-19 13:03:25 +1100773 ]
774)
775
Damien Millera22ba012000-03-02 23:09:20 +1100776# Check whether user wants TCP wrappers support
Damien Millerf7c0f821999-11-22 22:31:49 +1100777AC_ARG_WITH(tcp-wrappers,
Damien Miller80297751999-11-19 13:03:25 +1100778 [ --with-tcp-wrappers Enable tcpwrappers support],
779 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100780 if test "x$withval" != "xno" ; then
Damien Miller65165f82000-03-05 17:02:45 +1100781 saved_LIBS="$LIBS"
Damien Miller105b7f02000-01-07 08:45:55 +1100782 LIBS="$LIBS -lwrap"
Damien Miller65165f82000-03-05 17:02:45 +1100783 AC_MSG_CHECKING(for libwrap)
784 AC_TRY_LINK(
785 [
Damien Miller81171112000-04-23 11:14:01 +1000786#include <tcpd.h>
Damien Miller65165f82000-03-05 17:02:45 +1100787 int deny_severity = 0, allow_severity = 0;
788 ],
789 [hosts_access(0);],
790 [
791 AC_MSG_RESULT(yes)
792 AC_DEFINE(LIBWRAP)
793 ],
794 [
795 AC_MSG_RESULT(no)
796 AC_MSG_WARN([*** libwrap missing - tcpwrapper support disabled ***])
797 LIBS="$saved_LIBS"
798 ]
799 )
Damien Miller8bdeee21999-12-30 15:50:54 +1100800 fi
Damien Miller80297751999-11-19 13:03:25 +1100801 ]
802)
803
Damien Millera22ba012000-03-02 23:09:20 +1100804# Check whether to enable MD5 passwords
Damien Millerf7c0f821999-11-22 22:31:49 +1100805AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100806 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +1100807 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100808 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +1100809 AC_DEFINE(HAVE_MD5_PASSWORDS)
810 fi
811 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100812)
813
Damien Millera22ba012000-03-02 23:09:20 +1100814# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +1100815AC_ARG_WITH(shadow,
816 [ --without-shadow Disable shadow password support],
817 [
818 if test "x$withval" = "xno" ; then
819 AC_DEFINE(DISABLE_SHADOW)
820 fi
821 ]
822)
823
Damien Millera22ba012000-03-02 23:09:20 +1100824# Use ip address instead of hostname in $DISPLAY
Damien Miller76112de1999-12-21 11:18:08 +1100825AC_ARG_WITH(ipaddr-display,
826 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
827 [
Damien Miller66409952000-01-17 21:40:06 +1100828 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +1100829 AC_DEFINE(IPADDR_IN_DISPLAY)
830 fi
831 ]
832)
833
Damien Millera22ba012000-03-02 23:09:20 +1100834# Whether to mess with the default path
Damien Millere7f626c1999-12-31 09:49:44 +1100835AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +1100836 [ --with-default-path=PATH Specify default \$PATH environment for server],
837 [
838 if test "x$withval" != "xno" ; then
Damien Miller9550a761999-12-29 02:32:22 +1100839 AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
Damien Miller5a3e6831999-12-27 09:48:56 +1100840 fi
841 ]
842)
843
Damien Millera22ba012000-03-02 23:09:20 +1100844# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7d80e342000-01-19 14:36:49 +1100845AC_ARG_WITH(ipv4-default,
846 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
847 [
848 if test "x$withval" != "xno" ; then
849 AC_DEFINE(IPV4_DEFAULT)
850 fi
851 ]
852)
853
Damien Miller61e50f12000-05-08 20:49:37 +1000854AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7bcb0892000-03-11 20:45:40 +1100855AC_ARG_WITH(4in6,
856 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
857 [
858 if test "x$withval" != "xno" ; then
859 AC_MSG_RESULT(yes)
860 AC_DEFINE(IPV4_IN_IPV6)
861 else
862 AC_MSG_RESULT(no)
863 fi
864 ],[
865 if test "x$inet6_default_4in6" = "xyes"; then
866 AC_MSG_RESULT([yes (default)])
867 AC_DEFINE(IPV4_IN_IPV6)
868 else
869 AC_MSG_RESULT([no (default)])
870 fi
871 ]
872)
873
Damien Millera22ba012000-03-02 23:09:20 +1100874# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +1100875piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +1100876AC_ARG_WITH(pid-dir,
877 [ --with-pid-dir=PATH Specify location of ssh.pid file],
878 [
879 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +1100880 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +1100881 fi
882 ]
883)
Damien Miller4018c192000-04-30 09:30:44 +1000884
Damien Millerdbd250f2000-01-18 08:57:14 +1100885AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +1100886AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +1100887
andre2ff7b5d2000-06-03 14:57:40 +0000888dnl allow user to disable some login recording features
889AC_ARG_ENABLE(lastlog,
890 [ --disable-lastlog disable use of lastlog even if detected [no]],
891 [ AC_DEFINE(DISABLE_LASTLOG) ]
892)
893AC_ARG_ENABLE(utmp,
894 [ --disable-utmp disable use of utmp even if detected [no]],
895 [ AC_DEFINE(DISABLE_UTMP) ]
896)
897AC_ARG_ENABLE(utmpx,
898 [ --disable-utmpx disable use of utmpx even if detected [no]],
899 [ AC_DEFINE(DISABLE_UTMPX) ]
900)
901AC_ARG_ENABLE(wtmp,
902 [ --disable-wtmp disable use of wtmp even if detected [no]],
903 [ AC_DEFINE(DISABLE_WTMP) ]
904)
905AC_ARG_ENABLE(wtmpx,
906 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
907 [ AC_DEFINE(DISABLE_WTMPX) ]
908)
909AC_ARG_ENABLE(libutil,
910 [ --disable-libutil disable use of libutil (login() etc.) [no]],
911 [ AC_DEFINE(DISABLE_LOGIN) ]
912)
913AC_ARG_ENABLE(pututline,
914 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
915 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
916)
917AC_ARG_ENABLE(pututxline,
918 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
919 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
920)
921AC_ARG_WITH(lastlog,
922 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
923 [ conf_lastlog_location="$withval"; ],)
924
925dnl lastlog, [uw]tmpx? detection
926dnl NOTE: set the paths in the platform section to avoid the
927dnl need for command-line parameters
928dnl lastlog and [uw]tmp are subject to a file search if all else fails
929
930dnl lastlog detection
931dnl NOTE: the code itself will detect if lastlog is a directory
932AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
933AC_TRY_COMPILE([
934#include <sys/types.h>
935#include <utmp.h>
936#ifdef HAVE_LASTLOG_H
937# include <lastlog.h>
938#endif
Damien Miller2994e082000-06-04 15:51:47 +1000939#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +0000940# include <paths.h>
941#endif
942 ],
943 [ char *lastlog = LASTLOG_FILE; ],
944 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +1000945 [
946 AC_MSG_RESULT(no)
947 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
948 AC_TRY_COMPILE([
949#include <sys/types.h>
950#include <utmp.h>
951#ifdef HAVE_LASTLOG_H
952# include <lastlog.h>
953#endif
954#ifdef HAVE_PATHS_H
955# include <paths.h>
956#endif
957 ],
958 [ char *lastlog = _PATH_LASTLOG; ],
959 [ AC_MSG_RESULT(yes) ],
960 [
961 AC_MSG_RESULT(no),
962 system_lastlog_path=no
963 ])
964 ]
andre2ff7b5d2000-06-03 14:57:40 +0000965)
Damien Miller2994e082000-06-04 15:51:47 +1000966
andre2ff7b5d2000-06-03 14:57:40 +0000967if test -z "$conf_lastlog_location"; then
968 if test x"$system_lastlog_path" = x"no" ; then
969 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Miller2994e082000-06-04 15:51:47 +1000970 if test -d "$f" -o -e "$f" ; then
andre2ff7b5d2000-06-03 14:57:40 +0000971 conf_lastlog_location=$f
972 fi
973 done
974 if test -z "$conf_lastlog_location"; then
975 AC_MSG_WARN([** Cannot find lastlog - disabling feature **])
976 AC_DEFINE(DISABLE_LASTLOG)
977 fi
978 fi
979fi
980
981if test -n "$conf_lastlog_location"; then
982 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
983fi
984
985dnl utmp detection
986AC_MSG_CHECKING([if your system defines UTMP_FILE])
987AC_TRY_COMPILE([
988#include <sys/types.h>
989#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +1000990#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +0000991# include <paths.h>
992#endif
993 ],
994 [ char *utmp = UTMP_FILE; ],
995 [ AC_MSG_RESULT(yes) ],
996 [ AC_MSG_RESULT(no)
997 system_utmp_path=no ]
998)
999if test -z "$conf_utmp_location"; then
1000 if test x"$system_utmp_path" = x"no" ; then
1001 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1002 if test -f $f ; then
1003 conf_utmp_location=$f
1004 fi
1005 done
1006 if test -z "$conf_utmp_location"; then
1007 AC_DEFINE(DISABLE_UTMP)
1008 fi
1009 fi
1010fi
1011if test -n "$conf_utmp_location"; then
1012 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1013fi
1014
1015dnl wtmp detection
1016AC_MSG_CHECKING([if your system defines WTMP_FILE])
1017AC_TRY_COMPILE([
1018#include <sys/types.h>
1019#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001020#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001021# include <paths.h>
1022#endif
1023 ],
1024 [ char *wtmp = WTMP_FILE; ],
1025 [ AC_MSG_RESULT(yes) ],
1026 [ AC_MSG_RESULT(no)
1027 system_wtmp_path=no ]
1028)
1029if test -z "$conf_wtmp_location"; then
1030 if test x"$system_wtmp_path" = x"no" ; then
1031 for f in /usr/adm/wtmp /var/log/wtmp; do
1032 if test -f $f ; then
1033 conf_wtmp_location=$f
1034 fi
1035 done
1036 if test -z "$conf_wtmp_location"; then
1037 AC_DEFINE(DISABLE_WTMP)
1038 fi
1039 fi
1040fi
1041if test -n "$conf_wtmp_location"; then
1042 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1043fi
1044
1045
1046dnl utmpx detection - I don't know any system so perverse as to require
1047dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1048dnl there, though.
1049AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1050AC_TRY_COMPILE([
1051#include <sys/types.h>
1052#include <utmp.h>
1053#ifdef HAVE_UTMPX_H
1054#include <utmpx.h>
1055#endif
Damien Miller2994e082000-06-04 15:51:47 +10001056#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001057# include <paths.h>
1058#endif
1059 ],
1060 [ char *utmpx = UTMPX_FILE; ],
1061 [ AC_MSG_RESULT(yes) ],
1062 [ AC_MSG_RESULT(no)
1063 system_utmpx_path=no ]
1064)
1065if test -z "$conf_utmpx_location"; then
1066 if test x"$system_utmpx_path" = x"no" ; then
1067 AC_DEFINE(DISABLE_UTMPX)
1068 fi
1069else
1070 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1071fi
1072
1073dnl wtmpx detection
1074AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1075AC_TRY_COMPILE([
1076#include <sys/types.h>
1077#include <utmp.h>
1078#ifdef HAVE_UTMPX_H
1079#include <utmpx.h>
1080#endif
Damien Miller2994e082000-06-04 15:51:47 +10001081#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001082# include <paths.h>
1083#endif
1084 ],
1085 [ char *wtmpx = WTMPX_FILE; ],
1086 [ AC_MSG_RESULT(yes) ],
1087 [ AC_MSG_RESULT(no)
1088 system_wtmpx_path=no ]
1089)
1090if test -z "$conf_wtmpx_location"; then
1091 if test x"$system_wtmpx_path" = x"no" ; then
1092 AC_DEFINE(DISABLE_WTMPX)
1093 fi
1094else
1095 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1096fi
1097
Damien Miller4018c192000-04-30 09:30:44 +10001098
1099# Change default command timeout for builtin PRNG
1100entropy_timeout=100
1101AC_ARG_WITH(entropy-timeout,
1102 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1103 [
1104 if test "x$withval" != "xno" ; then
1105 entropy_timeout=$withval
1106 fi
1107 ]
1108)
1109AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1110
1111
Damien Miller29ea30d2000-03-17 10:54:15 +11001112if test ! -z "$blibpath" ; then
1113 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1114 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1115fi
1116
Damien Miller0437b332000-05-02 09:56:41 +10001117AC_OUTPUT(Makefile ssh_prng_cmds)
1118
1119