blob: 9eb38393e856ded2d087481ac3dd09c6caaab2cd [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"
Damien Miller9e110892000-06-07 21:05:46 +100082 LDFLAGS="$LDFLAGS"
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"
Damien Miller9e110892000-06-07 21:05:46 +100089 LDFLAGS="$LDFLAGS"
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 Millera1cb6442000-06-09 11:58:35 +1000109 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
110 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
111 if test "$sol2ver" -ge 8; then
112 AC_MSG_RESULT(yes)
113 AC_DEFINE(DISABLE_UTMP)
114 AC_DEFINE(DISABLE_WTMP)
115 else
116 AC_MSG_RESULT(no)
117 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100118 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000119*-*-sunos4*)
120 CFLAGS="$CFLAGS -DSUNOS4"
121 AC_CHECK_FUNCS(getpwanam)
122 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100123*-*-sysv*)
Damien Millerdb819592000-03-14 13:44:01 +1100124 CFLAGS="$CFLAGS -I/usr/local/include"
125 LDFLAGS="$LDFLAGS -L/usr/local/lib"
Damien Miller0e1cf7c2000-01-26 12:15:30 +1100126 MANTYPE='$(CATMAN)'
127 mansubdir=cat
Damien Miller75b1d102000-01-07 14:01:41 +1100128 LIBS="$LIBS -lgen -lsocket"
129 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100130esac
131
Damien Millere37bfc12000-06-05 09:37:43 +1000132# Allow user to specify flags
133AC_ARG_WITH(cflags,
134 [ --with-cflags Specify additional flags to pass to compiler],
135 [
136 if test "x$withval" != "xno" ; then
137 CFLAGS="$CFLAGS $withval"
138 fi
139 ]
140)
141AC_ARG_WITH(ldflags,
142 [ --with-ldlags Specify additional flags to pass to linker],
143 [
144 if test "x$withval" != "xno" ; then
145 LDFLAGS="$LDFLAGS $withval"
146 fi
147 ]
148)
149AC_ARG_WITH(libs,
150 [ --with-libs Specify additional libraries to link with],
151 [
152 if test "x$withval" != "xno" ; then
153 LIBS="$LIBS $withval"
154 fi
155 ]
156)
157
158
Damien Millera22ba012000-03-02 23:09:20 +1100159# Checks for libraries.
Damien Millerab18c411999-11-11 10:40:23 +1100160AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
161AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
Damien Millerab18c411999-11-11 10:40:23 +1100162
Damien Millerbeb4ba51999-12-28 15:09:35 +1100163if test -z "$no_libsocket" ; then
164 AC_CHECK_LIB(nsl, yp_match, , )
165fi
166if test -z "$no_libnsl" ; then
167 AC_CHECK_LIB(socket, main, , )
Damien Miller32b3cf21999-12-26 10:21:48 +1100168fi
Damien Millerab18c411999-11-11 10:40:23 +1100169
Damien Millera22ba012000-03-02 23:09:20 +1100170# Checks for header files.
andre2ff7b5d2000-06-03 14:57:40 +0000171AC_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 +1100172
Damien Millera22ba012000-03-02 23:09:20 +1100173# Checks for library functions.
andre2ff7b5d2000-06-03 14:57:40 +0000174AC_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)
175dnl checks for time functions
176AC_CHECK_FUNCS(gettimeofday time)
177dnl checks for libutil functions
178AC_CHECK_FUNCS(login logout updwtmp logwtmp)
179dnl checks for utmp functions
180AC_CHECK_FUNCS(entutent getutent getutid getutline pututline setutent)
181AC_CHECK_FUNCS(utmpname)
182dnl checks for utmpx functions
183AC_CHECK_FUNCS(entutxent getutxent getutxid getutxline pututxline )
184AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100185
Damien Miller04f80141999-11-19 15:32:34 +1100186AC_CHECK_FUNC(login,
187 [AC_DEFINE(HAVE_LOGIN)],
188 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
189)
190
191AC_CHECK_FUNC(daemon,
192 [AC_DEFINE(HAVE_DAEMON)],
193 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
194)
195
Damien Miller9fb07e42000-03-05 16:22:59 +1100196AC_CHECK_FUNC(getpagesize,
197 [AC_DEFINE(HAVE_GETPAGESIZE)],
198 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
199)
200
Damien Millera22ba012000-03-02 23:09:20 +1100201AC_ARG_WITH(pam,
202 [ --without-pam Disable PAM support ],
203 [
204 if test "x$withval" = "xno" ; then
205 no_pam=1
206 AC_DEFINE(DISABLE_PAM)
207 fi
208 ]
209)
210if test -z "$no_pam" -a "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then
211 AC_CHECK_LIB(dl, dlopen, , )
212 LIBS="$LIBS -lpam"
213
Damien Miller0e65eed2000-05-17 22:16:05 +1000214 AC_CHECK_FUNCS(pam_getenvlist)
Damien Miller1bead332000-04-30 00:47:29 +1000215
Damien Millera22ba012000-03-02 23:09:20 +1100216 # Check PAM strerror arguments (old PAM)
217 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
218 AC_TRY_COMPILE(
219 [
Damien Miller81171112000-04-23 11:14:01 +1000220#include <stdlib.h>
221#include <security/pam_appl.h>
Damien Millera22ba012000-03-02 23:09:20 +1100222 ],
223 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
224 [AC_MSG_RESULT(no)],
225 [
226 AC_DEFINE(HAVE_OLD_PAM)
227 AC_MSG_RESULT(yes)
228 ]
229 )
230fi
231
232# The big search for OpenSSL
233AC_ARG_WITH(ssl-dir,
234 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
235 [
236 if test "x$withval" != "$xno" ; then
237 tryssldir=$withval
238 fi
239 ]
240)
241
242saved_LIBS="$LIBS"
Damien Millera1ad4802000-03-15 10:04:54 +1100243saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +1100244saved_CFLAGS="$CFLAGS"
245if test "x$prefix" != "xNONE" ; then
246 tryssldir="$tryssldir $prefix"
247fi
Damien Miller61e50f12000-05-08 20:49:37 +1000248AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
Damien Millera22ba012000-03-02 23:09:20 +1100249
Damien Miller61e50f12000-05-08 20:49:37 +1000250 for ssldir in "" $tryssldir /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
251 if test ! -z "$ssldir" ; then
252 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
253 CFLAGS="$saved_CFLAGS -I$ssldir/include"
254 if test ! -z "$need_dash_r" ; then
255 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
256 fi
Damien Millera1ad4802000-03-15 10:04:54 +1100257 else
Damien Miller61e50f12000-05-08 20:49:37 +1000258 LDFLAGS="$saved_LDFLAGS"
Damien Millerb85dcad2000-03-11 11:37:00 +1100259 fi
260
Damien Miller3b512e12000-05-17 23:29:18 +1000261 LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000262
Damien Miller3b512e12000-05-17 23:29:18 +1000263 # Basic test to check for compatible version and correct linking
264 # *does not* test for RSA - that comes later.
265 AC_TRY_RUN(
266 [
Damien Millere59ce622000-05-01 20:54:17 +1000267#include <string.h>
268#include <openssl/rand.h>
Damien Miller81171112000-04-23 11:14:01 +1000269int main(void)
270{
Damien Miller3b512e12000-05-17 23:29:18 +1000271 char a[2048];
272 memset(a, 0, sizeof(a));
Damien Miller81171112000-04-23 11:14:01 +1000273 RAND_add(a, sizeof(a), sizeof(a));
Damien Miller3b512e12000-05-17 23:29:18 +1000274 return(RAND_status() <= 0);
Damien Miller81171112000-04-23 11:14:01 +1000275}
Damien Miller3b512e12000-05-17 23:29:18 +1000276 ],
277 [
278 found_crypto=1
279 break;
280 ], []
281 )
Damien Miller61e50f12000-05-08 20:49:37 +1000282
283 if test ! -z "$found_crypto" ; then
284 break;
285 fi
Damien Millerb85dcad2000-03-11 11:37:00 +1100286 done
287
Damien Miller61e50f12000-05-08 20:49:37 +1000288 if test -z "$found_crypto" ; then
289 AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])
Damien Millerb85dcad2000-03-11 11:37:00 +1100290 fi
Damien Miller61e50f12000-05-08 20:49:37 +1000291 if test -z "$ssldir" ; then
292 ssldir="(system)"
293 fi
Damien Millera22ba012000-03-02 23:09:20 +1100294
Damien Miller61e50f12000-05-08 20:49:37 +1000295 ac_cv_openssldir=$ssldir
296])
297
298if test ! -z "$ac_cv_openssldir" -a ! "x$ac_cv_openssldir" = "x(system)" ; then
299 AC_DEFINE(HAVE_OPENSSL)
300 dnl Need to recover ssldir - test above runs in subshell
301 ssldir=$ac_cv_openssldir
Damien Millera1ad4802000-03-15 10:04:54 +1100302 CFLAGS="$saved_CFLAGS -I$ssldir/include"
303 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
304 if test ! -z "$need_dash_r" ; then
305 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
Damien Millera22ba012000-03-02 23:09:20 +1100306 fi
Damien Miller29ea30d2000-03-17 10:54:15 +1100307 if test ! -z "$blibpath" ; then
308 blibpath="$blibpath:$ssldir:$ssldir/lib"
309 fi
Damien Millera22ba012000-03-02 23:09:20 +1100310fi
Damien Miller3b512e12000-05-17 23:29:18 +1000311LIBS="$saved_LIBS -lcrypto"
Damien Miller61e50f12000-05-08 20:49:37 +1000312
Damien Miller3b512e12000-05-17 23:29:18 +1000313# Now test RSA support
314saved_LIBS="$LIBS"
315AC_MSG_CHECKING([for RSA support])
316for WANTS_RSAREF in "" 1 ; do
317 if test -z "$WANTS_RSAREF" ; then
318 LIBS="$saved_LIBS"
319 else
320 LIBS="$saved_LIBS -lRSAglue -lrsaref"
321 fi
322 AC_TRY_RUN([
323#include <string.h>
324#include <openssl/rand.h>
325#include <openssl/rsa.h>
326#include <openssl/bn.h>
327#include <openssl/sha.h>
328int main(void)
329{
330 int num; RSA *key; static unsigned char p_in[] = "blahblah";
331 unsigned char c[256], p[256];
332 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
333 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
334 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
335 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
336}
337 ],
338 [
339 rsa_works=1
340 break;
341 ], [])
342done
343
344if test ! -z "$no_rsa" ; then
345 AC_MSG_RESULT(disabled)
346else
347 if test -z "$rsa_works" ; then
348 AC_MSG_WARN([*** No RSA support found *** ])
349 else
350 if test -z "$WANTS_RSAREF" ; then
351 AC_MSG_RESULT(yes)
352 else
353 AC_MSG_RESULT(using RSAref)
354 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
355 fi
356 fi
357fi
Damien Millera22ba012000-03-02 23:09:20 +1100358
359# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +1100360AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +1100361AC_CHECK_SIZEOF(short int, 2)
362AC_CHECK_SIZEOF(int, 4)
363AC_CHECK_SIZEOF(long int, 4)
364AC_CHECK_SIZEOF(long long int, 8)
365
Damien Millera22ba012000-03-02 23:09:20 +1100366# More checks for data types
Damien Miller61e50f12000-05-08 20:49:37 +1000367AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
368 AC_TRY_COMPILE(
369 [ #include <sys/types.h> ],
370 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
371 [ ac_cv_have_intxx_t="yes" ],
372 [ ac_cv_have_intxx_t="no" ]
373 )
374])
375if test "x$ac_cv_have_intxx_t" = "xyes" ; then
376 AC_DEFINE(HAVE_INTXX_T)
377 have_intxx_t=1
378fi
379
380AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
381 AC_TRY_COMPILE(
382 [ #include <sys/types.h> ],
383 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
384 [ ac_cv_have_u_intxx_t="yes" ],
385 [ ac_cv_have_u_intxx_t="no" ]
386 )
387])
388if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
389 AC_DEFINE(HAVE_U_INTXX_T)
390 have_u_intxx_t=1
391fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100392
Damien Millerc6398ef1999-11-20 12:18:40 +1100393
Damien Millereaf99942000-01-19 13:45:07 +1100394if test -z "$have_u_intxx_t" -o -z "$have_intxx_t" -a \
Damien Millerb29ea912000-01-15 14:12:03 +1100395 "x$ac_cv_header_sys_bitypes_h" = "xyes"
396then
397 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
398 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +1000399 [
400#include <sys/bitypes.h>
401 ],
Damien Millerb29ea912000-01-15 14:12:03 +1100402 [
Damien Miller70494d12000-04-03 15:57:06 +1000403 int8_t a; int16_t b; int32_t c;
404 u_int8_t e; u_int16_t f; u_int32_t g;
405 a = b = c = e = f = g = 1;
Damien Millerb29ea912000-01-15 14:12:03 +1100406 ],
407 [
408 AC_DEFINE(HAVE_U_INTXX_T)
409 AC_DEFINE(HAVE_INTXX_T)
410 AC_MSG_RESULT(yes)
411 ],
412 [AC_MSG_RESULT(no)]
413 )
414fi
415
Damien Millerd6121d22000-03-17 23:26:46 +1100416if test -z "$have_u_intxx_t" ; then
Damien Miller61e50f12000-05-08 20:49:37 +1000417 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
418 AC_TRY_COMPILE(
419 [
420#include <sys/types.h>
421 ],
422 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
423 [ ac_cv_have_uintxx_t="yes" ],
424 [ ac_cv_have_uintxx_t="no" ]
425 )
426 ])
427 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
428 AC_DEFINE(HAVE_UINTXX_T)
429 fi
Damien Millerd6121d22000-03-17 23:26:46 +1100430fi
Damien Millerc6398ef1999-11-20 12:18:40 +1100431
Damien Miller61e50f12000-05-08 20:49:37 +1000432AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
433 AC_TRY_COMPILE(
434 [
Damien Miller81171112000-04-23 11:14:01 +1000435#include <sys/types.h>
436#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000437 ],
438 [socklen_t foo; foo = 1235;],
439 [ ac_cv_have_socklen_t="yes" ],
440 [ ac_cv_have_socklen_t="no" ]
441 )
442])
443if test "x$ac_cv_have_socklen_t" = "xyes" ; then
444 AC_DEFINE(HAVE_SOCKLEN_T)
445fi
Damien Miller74d0d4a1999-12-29 02:24:35 +1100446
Damien Miller61e50f12000-05-08 20:49:37 +1000447AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
448 AC_TRY_COMPILE(
449 [
450#include <sys/types.h>
451 ],
452 [ size_t foo; foo = 1235; ],
453 [ ac_cv_have_size_t="yes" ],
454 [ ac_cv_have_size_t="no" ]
455 )
456])
457if test "x$ac_cv_have_size_t" = "xyes" ; then
458 AC_DEFINE(HAVE_SIZE_T)
459fi
Damien Miller95058511999-12-29 10:36:45 +1100460
Damien Miller615f9392000-05-17 22:53:33 +1000461AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
462 AC_TRY_COMPILE(
463 [
464#include <sys/types.h>
465 ],
466 [ ssize_t foo; foo = 1235; ],
467 [ ac_cv_have_ssize_t="yes" ],
468 [ ac_cv_have_ssize_t="no" ]
469 )
470])
471if test "x$ac_cv_have_ssize_t" = "xyes" ; then
472 AC_DEFINE(HAVE_SSIZE_T)
473fi
474
Damien Miller61e50f12000-05-08 20:49:37 +1000475
476AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
477 AC_TRY_COMPILE(
478 [
Damien Miller81171112000-04-23 11:14:01 +1000479#include <sys/types.h>
480#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000481 ],
482 [ struct sockaddr_storage s; ],
483 [ ac_cv_have_struct_sockaddr_storage="yes" ],
484 [ ac_cv_have_struct_sockaddr_storage="no" ]
485 )
486])
487if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
488 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
489fi
Damien Miller34132e52000-01-14 15:45:46 +1100490
Damien Miller61e50f12000-05-08 20:49:37 +1000491AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
492 AC_TRY_COMPILE(
493 [
494#include <netinet/in.h>
495 ],
496 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
497 [ ac_cv_have_struct_sockaddr_in6="yes" ],
498 [ ac_cv_have_struct_sockaddr_in6="no" ]
499 )
500])
501if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
502 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
503fi
Damien Miller34132e52000-01-14 15:45:46 +1100504
Damien Miller61e50f12000-05-08 20:49:37 +1000505AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
506 AC_TRY_COMPILE(
507 [
508#include <netinet/in.h>
509 ],
510 [ struct in6_addr s; s.s6_addr[0] = 0; ],
511 [ ac_cv_have_struct_in6_addr="yes" ],
512 [ ac_cv_have_struct_in6_addr="no" ]
513 )
514])
515if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
516 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
517fi
Damien Miller34132e52000-01-14 15:45:46 +1100518
Damien Miller61e50f12000-05-08 20:49:37 +1000519AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
520 AC_TRY_COMPILE(
521 [
Damien Miller81171112000-04-23 11:14:01 +1000522#include <sys/types.h>
523#include <sys/socket.h>
524#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000525 ],
526 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
527 [ ac_cv_have_struct_addrinfo="yes" ],
528 [ ac_cv_have_struct_addrinfo="no" ]
529 )
530])
531if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
532 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
533fi
534
Damien Miller34132e52000-01-14 15:45:46 +1100535
Damien Millera22ba012000-03-02 23:09:20 +1100536# Checks for structure members
Damien Miller34132e52000-01-14 15:45:46 +1100537
Damien Miller61e50f12000-05-08 20:49:37 +1000538OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
539OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
540OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
541OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
542OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +1000543OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +1000544OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
545OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
546OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
547OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
548OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
549OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +0000550OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
551OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
552OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
553OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
554
Damien Miller61e50f12000-05-08 20:49:37 +1000555
556
557AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
558 ac_cv_have_ss_family_in_struct_ss, [
559 AC_TRY_COMPILE(
560 [
Damien Miller81171112000-04-23 11:14:01 +1000561#include <sys/types.h>
562#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000563 ],
564 [ struct sockaddr_storage s; s.ss_family = 1; ],
565 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
566 [ ac_cv_have_ss_family_in_struct_ss="no" ],
567 )
568])
569if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
570 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
571fi
572
573
574AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
575 ac_cv_have___ss_family_in_struct_ss, [
576 AC_TRY_COMPILE(
577 [
Damien Miller81171112000-04-23 11:14:01 +1000578#include <sys/types.h>
579#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +1000580 ],
581 [ struct sockaddr_storage s; s.__ss_family = 1; ],
582 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
583 [ ac_cv_have___ss_family_in_struct_ss="no" ]
584 )
585])
586if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
587 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
588fi
Damien Millerbf1c9b21999-12-09 10:16:54 +1100589
Damien Miller61e50f12000-05-08 20:49:37 +1000590
591AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
592 AC_TRY_LINK([],
593 [ extern char *__progname; printf("%s", __progname); ],
594 [ ac_cv_libc_defines___progname="yes" ],
595 [ ac_cv_libc_defines___progname="no" ]
596 )
597])
598if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
599 AC_DEFINE(HAVE___PROGNAME)
600fi
601
Damien Millera22ba012000-03-02 23:09:20 +1100602
603# Looking for programs, paths and files
604AC_ARG_WITH(rsh,
605 [ --with-rsh=PATH Specify path to remote shell program ],
606 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100607 if test "x$withval" != "$no" ; then
Damien Millera22ba012000-03-02 23:09:20 +1100608 AC_DEFINE_UNQUOTED(RSH_PATH, "$withval")
609 fi
610 ],
611 [
612 AC_PATH_PROG(rsh_path, rsh)
613 ]
614)
615
616AC_ARG_WITH(xauth,
617 [ --with-xauth=PATH Specify path to xauth program ],
618 [
619 if test "x$withval" != "$xno" ; then
620 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$withval")
621 fi
622 ],
623 [
624 AC_PATH_PROG(xauth_path, xauth)
625 if test ! -z "$xauth_path" -a -x "/usr/openwin/bin/xauth" ; then
626 xauth_path="/usr/openwin/bin/xauth"
627 fi
628 ]
629)
630
631if test ! -z "$xauth_path" ; then
632 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
633fi
634if test ! -z "$rsh_path" ; then
635 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
636fi
637
638# Check for mail directory (last resort if we cannot get it from headers)
639if test ! -z "$MAIL" ; then
640 maildir=`dirname $MAIL`
641 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
642fi
643
Damien Millera22ba012000-03-02 23:09:20 +1100644if test -z "$no_dev_ptmx" ; then
Damien Miller204ad072000-03-02 23:56:12 +1100645 AC_CHECK_FILE("/dev/ptmx",
646 [
647 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
648 have_dev_ptmx=1
649 ]
650 )
Damien Millera22ba012000-03-02 23:09:20 +1100651fi
Damien Miller204ad072000-03-02 23:56:12 +1100652AC_CHECK_FILE("/dev/ptc",
653 [
654 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
655 have_dev_ptc=1
656 ]
657)
658
Damien Millera22ba012000-03-02 23:09:20 +1100659# Options from here on. Some of these are preset by platform above
660
Damien Millera22ba012000-03-02 23:09:20 +1100661# Check for user-specified random device, otherwise check /dev/urandom
662AC_ARG_WITH(random,
663 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
664 [
Damien Miller040f3832000-04-03 14:50:43 +1000665 if test "x$withval" != "xno" ; then
666 RANDOM_POOL="$withval";
667 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
668 fi
Damien Millera22ba012000-03-02 23:09:20 +1100669 ],
670 [
671 # Check for random device
672 AC_CHECK_FILE("/dev/urandom",
673 [
674 RANDOM_POOL="/dev/urandom";
675 AC_SUBST(RANDOM_POOL)
676 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
677 ]
678 )
679 ]
680)
681
682# Check for EGD pool file
683AC_ARG_WITH(egd-pool,
684 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
685 [
Damien Miller040f3832000-04-03 14:50:43 +1000686 if test "x$withval" != "xno" ; then
687 EGD_SOCKET="$withval";
688 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
689 fi
Damien Millera22ba012000-03-02 23:09:20 +1100690 ]
691)
692
Damien Miller0437b332000-05-02 09:56:41 +1000693# detect pathnames for entropy gathering commands, if we need them
694INSTALL_SSH_PRNG_CMDS=""
695rm -f prng_commands
Damien Miller11e37f62000-04-08 18:23:30 +1000696if test -z "$RANDOM_POOL" -a -z "$EGD_SOCKET" ; then
697 # Use these commands to collect entropy
Damien Miller61e50f12000-05-08 20:49:37 +1000698 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
699 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
700 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
701 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
702 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
703 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
704 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
705 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
706 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
707 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
708 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
709 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
710 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
711 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
712 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
Damien Miller0437b332000-05-02 09:56:41 +1000713
714 INSTALL_SSH_PRNG_CMDS="yes"
Damien Miller11e37f62000-04-08 18:23:30 +1000715fi
Damien Miller0437b332000-05-02 09:56:41 +1000716AC_SUBST(INSTALL_SSH_PRNG_CMDS)
717
Damien Miller11e37f62000-04-08 18:23:30 +1000718
Damien Miller670a4b82000-01-22 13:53:11 +1100719AC_ARG_WITH(catman,
720 [ --with-catman=man|cat Install preformatted manpages[no]],
721 [
722 MANTYPE='$(CATMAN)'
723 if test x"$withval" != x"yes" ; then
724 mansubdir=$withval
725 else
726 mansubdir=cat
727 fi
728 ], [
729 if test -z "$MANTYPE" ; then
730 MANTYPE='$(TROFFMAN)'
731 mansubdir=man
732 fi
733 ]
734)
735AC_SUBST(MANTYPE)
736AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +1100737
Damien Millera22ba012000-03-02 23:09:20 +1100738# Check whether user wants Kerberos support
Damien Miller80297751999-11-19 13:03:25 +1100739AC_ARG_WITH(kerberos4,
Damien Miller105b7f02000-01-07 08:45:55 +1100740 [ --with-kerberos4=PATH Enable Kerberos 4 support],
Damien Miller80297751999-11-19 13:03:25 +1100741 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100742 if test "x$withval" != "xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +1100743
744 if test "x$withval" != "$xyes" ; then
745 CFLAGS="$CFLAGS -I${withval}/include"
746 LDFLAGS="$LDFLAGS -L${withval}/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100747 if test ! -z "$need_dash_r" ; then
748 LDFLAGS="$LDFLAGS -R${withval}/lib"
749 fi
750 if test ! -z "$blibpath" ; then
751 blibpath="$blibpath:${withval}/lib"
752 fi
Damien Miller105b7f02000-01-07 08:45:55 +1100753 else
754 if test -d /usr/include/kerberosIV ; then
755 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
756 fi
757 fi
758
759 AC_CHECK_HEADERS(krb.h)
760 AC_CHECK_LIB(krb, main)
761 if test "$ac_cv_header_krb_h" != yes; then
762 AC_MSG_WARN([Cannot find krb.h, build may fail])
763 fi
764 if test "$ac_cv_lib_krb_main" != yes; then
765 AC_MSG_WARN([Cannot find libkrb, build may fail])
766 fi
767
Damien Millerc85f9b42000-01-29 10:20:21 +1100768 KLIBS="-lkrb -ldes"
Damien Miller105b7f02000-01-07 08:45:55 +1100769 AC_CHECK_LIB(resolv, dn_expand, , )
770 KRB4=yes
Damien Miller8bdeee21999-12-30 15:50:54 +1100771 AC_DEFINE(KRB4)
Damien Miller8bdeee21999-12-30 15:50:54 +1100772 fi
Damien Miller80297751999-11-19 13:03:25 +1100773 ]
774)
775
Damien Millera22ba012000-03-02 23:09:20 +1100776# Check whether user wants AFS support
Damien Millerc6398ef1999-11-20 12:18:40 +1100777AC_ARG_WITH(afs,
Damien Miller105b7f02000-01-07 08:45:55 +1100778 [ --with-afs=PATH Enable AFS support],
Damien Miller80297751999-11-19 13:03:25 +1100779 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100780 if test "x$withval" != "xno" ; then
Damien Miller105b7f02000-01-07 08:45:55 +1100781
782 if test "x$withval" != "$xyes" ; then
783 CFLAGS="$CFLAGS -I${withval}/include"
784 LFLAGS="$LFLAGS -L${withval}/lib"
785 fi
786
787 if test -z "$KRB4" ; then
788 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
789 fi
790
Damien Miller8bdeee21999-12-30 15:50:54 +1100791 LIBS="$LIBS -lkafs"
Damien Miller105b7f02000-01-07 08:45:55 +1100792 if test ! -z "$AFS_LIBS" ; then
793 LIBS="$LIBS $AFS_LIBS"
794 fi
795 AC_DEFINE(AFS)
Damien Miller8bdeee21999-12-30 15:50:54 +1100796 fi
Damien Miller80297751999-11-19 13:03:25 +1100797 ]
798)
Damien Millerc85f9b42000-01-29 10:20:21 +1100799LIBS="$LIBS $KLIBS"
Damien Miller80297751999-11-19 13:03:25 +1100800
Damien Millera22ba012000-03-02 23:09:20 +1100801# Check whether user wants S/Key support
Damien Miller80297751999-11-19 13:03:25 +1100802AC_ARG_WITH(skey,
803 [ --with-skey Enable S/Key support],
804 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100805 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +1100806 AC_DEFINE(SKEY)
807 LIBS="$LIBS -lskey"
808 fi
Damien Miller80297751999-11-19 13:03:25 +1100809 ]
810)
811
Damien Millera22ba012000-03-02 23:09:20 +1100812# Check whether user wants TCP wrappers support
Damien Millerf7c0f821999-11-22 22:31:49 +1100813AC_ARG_WITH(tcp-wrappers,
Damien Miller80297751999-11-19 13:03:25 +1100814 [ --with-tcp-wrappers Enable tcpwrappers support],
815 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100816 if test "x$withval" != "xno" ; then
Damien Miller65165f82000-03-05 17:02:45 +1100817 saved_LIBS="$LIBS"
Damien Miller105b7f02000-01-07 08:45:55 +1100818 LIBS="$LIBS -lwrap"
Damien Miller65165f82000-03-05 17:02:45 +1100819 AC_MSG_CHECKING(for libwrap)
820 AC_TRY_LINK(
821 [
Damien Miller81171112000-04-23 11:14:01 +1000822#include <tcpd.h>
Damien Miller65165f82000-03-05 17:02:45 +1100823 int deny_severity = 0, allow_severity = 0;
824 ],
825 [hosts_access(0);],
826 [
827 AC_MSG_RESULT(yes)
828 AC_DEFINE(LIBWRAP)
829 ],
830 [
831 AC_MSG_RESULT(no)
832 AC_MSG_WARN([*** libwrap missing - tcpwrapper support disabled ***])
833 LIBS="$saved_LIBS"
834 ]
835 )
Damien Miller8bdeee21999-12-30 15:50:54 +1100836 fi
Damien Miller80297751999-11-19 13:03:25 +1100837 ]
838)
839
Damien Millera22ba012000-03-02 23:09:20 +1100840# Check whether to enable MD5 passwords
Damien Millerf7c0f821999-11-22 22:31:49 +1100841AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100842 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +1100843 [
Damien Millerb85dcad2000-03-11 11:37:00 +1100844 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +1100845 AC_DEFINE(HAVE_MD5_PASSWORDS)
846 fi
847 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +1100848)
849
Damien Millera22ba012000-03-02 23:09:20 +1100850# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +1100851AC_ARG_WITH(shadow,
852 [ --without-shadow Disable shadow password support],
853 [
854 if test "x$withval" = "xno" ; then
855 AC_DEFINE(DISABLE_SHADOW)
856 fi
857 ]
858)
859
Damien Millera22ba012000-03-02 23:09:20 +1100860# Use ip address instead of hostname in $DISPLAY
Damien Miller76112de1999-12-21 11:18:08 +1100861AC_ARG_WITH(ipaddr-display,
862 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
863 [
Damien Miller66409952000-01-17 21:40:06 +1100864 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +1100865 AC_DEFINE(IPADDR_IN_DISPLAY)
866 fi
867 ]
868)
869
Damien Millera22ba012000-03-02 23:09:20 +1100870# Whether to mess with the default path
Damien Millere7f626c1999-12-31 09:49:44 +1100871AC_ARG_WITH(default-path,
Damien Miller5a3e6831999-12-27 09:48:56 +1100872 [ --with-default-path=PATH Specify default \$PATH environment for server],
873 [
874 if test "x$withval" != "xno" ; then
Damien Miller9550a761999-12-29 02:32:22 +1100875 AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
Damien Miller5a3e6831999-12-27 09:48:56 +1100876 fi
877 ]
878)
879
Damien Millera22ba012000-03-02 23:09:20 +1100880# Whether to force IPv4 by default (needed on broken glibc Linux)
Damien Miller7d80e342000-01-19 14:36:49 +1100881AC_ARG_WITH(ipv4-default,
882 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
883 [
884 if test "x$withval" != "xno" ; then
885 AC_DEFINE(IPV4_DEFAULT)
886 fi
887 ]
888)
889
Damien Miller61e50f12000-05-08 20:49:37 +1000890AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Miller7bcb0892000-03-11 20:45:40 +1100891AC_ARG_WITH(4in6,
892 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
893 [
894 if test "x$withval" != "xno" ; then
895 AC_MSG_RESULT(yes)
896 AC_DEFINE(IPV4_IN_IPV6)
897 else
898 AC_MSG_RESULT(no)
899 fi
900 ],[
901 if test "x$inet6_default_4in6" = "xyes"; then
902 AC_MSG_RESULT([yes (default)])
903 AC_DEFINE(IPV4_IN_IPV6)
904 else
905 AC_MSG_RESULT([no (default)])
906 fi
907 ]
908)
909
Damien Millera22ba012000-03-02 23:09:20 +1100910# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +1100911piddir=/var/run
Damien Miller5eed6a22000-01-16 12:05:18 +1100912AC_ARG_WITH(pid-dir,
913 [ --with-pid-dir=PATH Specify location of ssh.pid file],
914 [
915 if test "x$withval" != "xno" ; then
Damien Millerb13c73e2000-01-17 22:02:17 +1100916 piddir=$withval
Damien Miller5eed6a22000-01-16 12:05:18 +1100917 fi
918 ]
919)
Damien Miller4018c192000-04-30 09:30:44 +1000920
Damien Millerdbd250f2000-01-18 08:57:14 +1100921AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +1100922AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +1100923
andre2ff7b5d2000-06-03 14:57:40 +0000924dnl allow user to disable some login recording features
925AC_ARG_ENABLE(lastlog,
926 [ --disable-lastlog disable use of lastlog even if detected [no]],
927 [ AC_DEFINE(DISABLE_LASTLOG) ]
928)
929AC_ARG_ENABLE(utmp,
930 [ --disable-utmp disable use of utmp even if detected [no]],
931 [ AC_DEFINE(DISABLE_UTMP) ]
932)
933AC_ARG_ENABLE(utmpx,
934 [ --disable-utmpx disable use of utmpx even if detected [no]],
935 [ AC_DEFINE(DISABLE_UTMPX) ]
936)
937AC_ARG_ENABLE(wtmp,
938 [ --disable-wtmp disable use of wtmp even if detected [no]],
939 [ AC_DEFINE(DISABLE_WTMP) ]
940)
941AC_ARG_ENABLE(wtmpx,
942 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
943 [ AC_DEFINE(DISABLE_WTMPX) ]
944)
945AC_ARG_ENABLE(libutil,
946 [ --disable-libutil disable use of libutil (login() etc.) [no]],
947 [ AC_DEFINE(DISABLE_LOGIN) ]
948)
949AC_ARG_ENABLE(pututline,
950 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
951 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
952)
953AC_ARG_ENABLE(pututxline,
954 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
955 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
956)
957AC_ARG_WITH(lastlog,
958 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
959 [ conf_lastlog_location="$withval"; ],)
960
961dnl lastlog, [uw]tmpx? detection
962dnl NOTE: set the paths in the platform section to avoid the
963dnl need for command-line parameters
964dnl lastlog and [uw]tmp are subject to a file search if all else fails
965
966dnl lastlog detection
967dnl NOTE: the code itself will detect if lastlog is a directory
968AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
969AC_TRY_COMPILE([
970#include <sys/types.h>
971#include <utmp.h>
972#ifdef HAVE_LASTLOG_H
973# include <lastlog.h>
974#endif
Damien Miller2994e082000-06-04 15:51:47 +1000975#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +0000976# include <paths.h>
977#endif
978 ],
979 [ char *lastlog = LASTLOG_FILE; ],
980 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +1000981 [
982 AC_MSG_RESULT(no)
983 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
984 AC_TRY_COMPILE([
985#include <sys/types.h>
986#include <utmp.h>
987#ifdef HAVE_LASTLOG_H
988# include <lastlog.h>
989#endif
990#ifdef HAVE_PATHS_H
991# include <paths.h>
992#endif
993 ],
994 [ char *lastlog = _PATH_LASTLOG; ],
995 [ AC_MSG_RESULT(yes) ],
996 [
997 AC_MSG_RESULT(no),
998 system_lastlog_path=no
999 ])
1000 ]
andre2ff7b5d2000-06-03 14:57:40 +00001001)
Damien Miller2994e082000-06-04 15:51:47 +10001002
andre2ff7b5d2000-06-03 14:57:40 +00001003if test -z "$conf_lastlog_location"; then
1004 if test x"$system_lastlog_path" = x"no" ; then
1005 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Miller2994e082000-06-04 15:51:47 +10001006 if test -d "$f" -o -e "$f" ; then
andre2ff7b5d2000-06-03 14:57:40 +00001007 conf_lastlog_location=$f
1008 fi
1009 done
1010 if test -z "$conf_lastlog_location"; then
1011 AC_MSG_WARN([** Cannot find lastlog - disabling feature **])
1012 AC_DEFINE(DISABLE_LASTLOG)
1013 fi
1014 fi
1015fi
1016
1017if test -n "$conf_lastlog_location"; then
1018 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
1019fi
1020
1021dnl utmp detection
1022AC_MSG_CHECKING([if your system defines UTMP_FILE])
1023AC_TRY_COMPILE([
1024#include <sys/types.h>
1025#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10001026#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001027# include <paths.h>
1028#endif
1029 ],
1030 [ char *utmp = UTMP_FILE; ],
1031 [ AC_MSG_RESULT(yes) ],
1032 [ AC_MSG_RESULT(no)
1033 system_utmp_path=no ]
1034)
1035if test -z "$conf_utmp_location"; then
1036 if test x"$system_utmp_path" = x"no" ; then
1037 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
1038 if test -f $f ; then
1039 conf_utmp_location=$f
1040 fi
1041 done
1042 if test -z "$conf_utmp_location"; then
1043 AC_DEFINE(DISABLE_UTMP)
1044 fi
1045 fi
1046fi
1047if test -n "$conf_utmp_location"; then
1048 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
1049fi
1050
1051dnl wtmp detection
1052AC_MSG_CHECKING([if your system defines WTMP_FILE])
1053AC_TRY_COMPILE([
1054#include <sys/types.h>
1055#include <utmp.h>
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 *wtmp = WTMP_FILE; ],
1061 [ AC_MSG_RESULT(yes) ],
1062 [ AC_MSG_RESULT(no)
1063 system_wtmp_path=no ]
1064)
1065if test -z "$conf_wtmp_location"; then
1066 if test x"$system_wtmp_path" = x"no" ; then
1067 for f in /usr/adm/wtmp /var/log/wtmp; do
1068 if test -f $f ; then
1069 conf_wtmp_location=$f
1070 fi
1071 done
1072 if test -z "$conf_wtmp_location"; then
1073 AC_DEFINE(DISABLE_WTMP)
1074 fi
1075 fi
1076fi
1077if test -n "$conf_wtmp_location"; then
1078 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1079fi
1080
1081
1082dnl utmpx detection - I don't know any system so perverse as to require
1083dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1084dnl there, though.
1085AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1086AC_TRY_COMPILE([
1087#include <sys/types.h>
1088#include <utmp.h>
1089#ifdef HAVE_UTMPX_H
1090#include <utmpx.h>
1091#endif
Damien Miller2994e082000-06-04 15:51:47 +10001092#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001093# include <paths.h>
1094#endif
1095 ],
1096 [ char *utmpx = UTMPX_FILE; ],
1097 [ AC_MSG_RESULT(yes) ],
1098 [ AC_MSG_RESULT(no)
1099 system_utmpx_path=no ]
1100)
1101if test -z "$conf_utmpx_location"; then
1102 if test x"$system_utmpx_path" = x"no" ; then
1103 AC_DEFINE(DISABLE_UTMPX)
1104 fi
1105else
1106 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1107fi
1108
1109dnl wtmpx detection
1110AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1111AC_TRY_COMPILE([
1112#include <sys/types.h>
1113#include <utmp.h>
1114#ifdef HAVE_UTMPX_H
1115#include <utmpx.h>
1116#endif
Damien Miller2994e082000-06-04 15:51:47 +10001117#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00001118# include <paths.h>
1119#endif
1120 ],
1121 [ char *wtmpx = WTMPX_FILE; ],
1122 [ AC_MSG_RESULT(yes) ],
1123 [ AC_MSG_RESULT(no)
1124 system_wtmpx_path=no ]
1125)
1126if test -z "$conf_wtmpx_location"; then
1127 if test x"$system_wtmpx_path" = x"no" ; then
1128 AC_DEFINE(DISABLE_WTMPX)
1129 fi
1130else
1131 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1132fi
1133
Damien Miller4018c192000-04-30 09:30:44 +10001134
1135# Change default command timeout for builtin PRNG
Damien Miller14c12cb2000-06-07 22:20:23 +10001136entropy_timeout=200
Damien Miller4018c192000-04-30 09:30:44 +10001137AC_ARG_WITH(entropy-timeout,
1138 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1139 [
1140 if test "x$withval" != "xno" ; then
1141 entropy_timeout=$withval
1142 fi
1143 ]
1144)
1145AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1146
1147
Damien Miller29ea30d2000-03-17 10:54:15 +11001148if test ! -z "$blibpath" ; then
1149 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1150 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1151fi
1152
Damien Miller0437b332000-05-02 09:56:41 +10001153AC_OUTPUT(Makefile ssh_prng_cmds)
1154
1155