]> andersk Git - openssh.git/blame - configure.in
Added new login recording code
[openssh.git] / configure.in
CommitLineData
4cca272e 1AC_INIT(ssh.c)
5881cd60 2
3AC_CONFIG_HEADER(config.h)
b14b2ae7 4AC_PROG_CC
a7effaac 5AC_CANONICAL_HOST
5881cd60 6
a0391976 7# Checks for programs.
4cca272e 8AC_PROG_CPP
5881cd60 9AC_PROG_RANLIB
cf8dd513 10AC_PROG_INSTALL
d4f11b59 11AC_CHECK_PROG(AR, ar, ar)
a0f84251 12AC_PATH_PROG(PERL, perl)
13AC_SUBST(PERL)
ad85db64 14AC_PATH_PROG(ENT, ent)
15AC_SUBST(ENT)
f498ed15 16
d423d822 17if 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
a0391976 28# Check for some target-specific stuff
a7effaac 29case "$host" in
9d6b1b96 30*-*-aix*)
31 AFS_LIBS="-lld"
84afc958 32 CFLAGS="$CFLAGS -I/usr/local/include"
33 LDFLAGS="$LDFLAGS -L/usr/local/lib"
bd499f9e 34 if test "$LD" != "gcc" -a -z "$blibpath"; then
35 blibpath="/usr/lib:/lib:/usr/local/lib"
36 fi
c1ef8333 37 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)])
4c8ef3fb 38 AC_DEFINE(BROKEN_GETADDRINFO)
9d6b1b96 39 ;;
a7effaac 40*-*-hpux10*)
41 if test -z "$GCC"; then
fc1e8bf4 42 CFLAGS="$CFLAGS -Ae"
a7effaac 43 fi
44 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
45 AC_DEFINE(IPADDR_IN_DISPLAY)
46 AC_MSG_CHECKING(for HPUX trusted system password database)
47 if test -f /tcb/files/auth/system/default; then
48 AC_MSG_RESULT(yes)
49 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
50 LIBS="$LIBS -lsec"
dfb95100 51 AC_MSG_WARN([This configuration is untested])
a7effaac 52 else
53 AC_MSG_RESULT(no)
54 AC_DEFINE(DISABLE_SHADOW)
55 fi
c54a6257 56 MANTYPE='$(CATMAN)'
57 mansubdir=cat
a7effaac 58 ;;
2b763e31 59*-*-hpux11*)
60 if test -z "$GCC"; then
61 CFLAGS="$CFLAGS -Ae"
62 fi
63 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
2b763e31 64 AC_DEFINE(IPADDR_IN_DISPLAY)
2b763e31 65 AC_MSG_CHECKING(for HPUX trusted system password database)
66 if test -f /tcb/files/auth/system/default; then
67 AC_MSG_RESULT(yes)
68 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
69 LIBS="$LIBS -lsec"
70 AC_MSG_WARN([This configuration is untested])
71 else
72 AC_MSG_RESULT(no)
73 AC_DEFINE(DISABLE_SHADOW)
74 fi
75 MANTYPE='$(CATMAN)'
76 mansubdir=cat
77 ;;
d94aa2ae 78*-*-irix5*)
84afc958 79 CFLAGS="$CFLAGS -I/usr/local/include"
80 LDFLAGS="$LDFLAGS -L/usr/local/lib"
8eb34e02 81 MANTYPE='$(CATMAN)'
b9795b89 82 no_libsocket=1
83 no_libnsl=1
84 ;;
85*-*-irix6*)
84afc958 86 CFLAGS="$CFLAGS -I/usr/local/include"
87 LDFLAGS="$LDFLAGS -L/usr/local/lib"
8eb34e02 88 MANTYPE='$(CATMAN)'
89 AC_MSG_WARN([*** Irix 6.x is not tested, please report you experiences *** ])
d94aa2ae 90 no_libsocket=1
91 no_libnsl=1
92 ;;
5cdfe03f 93*-*-linux*)
94 no_dev_ptmx=1
80faa19f 95 AC_DEFINE(DONT_TRY_OTHER_AF)
96 inet6_default_4in6=yes
5cdfe03f 97 ;;
d468fc76 98*-*-netbsd*)
a0391976 99 need_dash_r=1
d468fc76 100 ;;
9d6b1b96 101*-*-solaris*)
84afc958 102 CFLAGS="$CFLAGS -I/usr/local/include"
4696775a 103 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
a0391976 104 need_dash_r=1
1d7b9b20 105 # hardwire lastlog location (can't detect it on some versions)
106 conf_lastlog_location="/var/adm/lastlog"
9d6b1b96 107 ;;
a423beaf 108*-*-sunos4*)
109 CFLAGS="$CFLAGS -DSUNOS4"
110 AC_CHECK_FUNCS(getpwanam)
111 ;;
9d6b1b96 112*-*-sysv*)
84afc958 113 CFLAGS="$CFLAGS -I/usr/local/include"
114 LDFLAGS="$LDFLAGS -L/usr/local/lib"
9755cbdb 115 MANTYPE='$(CATMAN)'
116 mansubdir=cat
9d6b1b96 117 LIBS="$LIBS -lgen -lsocket"
118 ;;
a7effaac 119esac
120
a0391976 121# Checks for libraries.
4cca272e 122AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first ***]))
123AC_CHECK_LIB(util, login, AC_DEFINE(HAVE_LIBUTIL_LOGIN) LIBS="$LIBS -lutil")
4cca272e 124
d94aa2ae 125if test -z "$no_libsocket" ; then
126 AC_CHECK_LIB(nsl, yp_match, , )
127fi
128if test -z "$no_libnsl" ; then
129 AC_CHECK_LIB(socket, main, , )
f74efc8d 130fi
4cca272e 131
a0391976 132# Checks for header files.
1d7b9b20 133AC_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)
4cca272e 134
a0391976 135# Checks for library functions.
1d7b9b20 136AC_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)
137dnl checks for time functions
138AC_CHECK_FUNCS(gettimeofday time)
139dnl checks for libutil functions
140AC_CHECK_FUNCS(login logout updwtmp logwtmp)
141dnl checks for utmp functions
142AC_CHECK_FUNCS(entutent getutent getutid getutline pututline setutent)
143AC_CHECK_FUNCS(utmpname)
144dnl checks for utmpx functions
145AC_CHECK_FUNCS(entutxent getutxent getutxid getutxline pututxline )
146AC_CHECK_FUNCS(setutxent utmpxname)
76cd7316 147
beb43d31 148AC_CHECK_FUNC(login,
149 [AC_DEFINE(HAVE_LOGIN)],
150 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
151)
152
153AC_CHECK_FUNC(daemon,
154 [AC_DEFINE(HAVE_DAEMON)],
155 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
156)
157
aa6bd60a 158AC_CHECK_FUNC(getpagesize,
159 [AC_DEFINE(HAVE_GETPAGESIZE)],
160 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
161)
162
a0391976 163AC_ARG_WITH(pam,
164 [ --without-pam Disable PAM support ],
165 [
166 if test "x$withval" = "xno" ; then
167 no_pam=1
168 AC_DEFINE(DISABLE_PAM)
169 fi
170 ]
171)
172if test -z "$no_pam" -a "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then
173 AC_CHECK_LIB(dl, dlopen, , )
174 LIBS="$LIBS -lpam"
175
28c1d5ce 176 AC_CHECK_FUNCS(pam_getenvlist)
2b763e31 177
a0391976 178 # Check PAM strerror arguments (old PAM)
179 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
180 AC_TRY_COMPILE(
181 [
18ba2aab 182#include <stdlib.h>
183#include <security/pam_appl.h>
a0391976 184 ],
185 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
186 [AC_MSG_RESULT(no)],
187 [
188 AC_DEFINE(HAVE_OLD_PAM)
189 AC_MSG_RESULT(yes)
190 ]
191 )
192fi
193
194# The big search for OpenSSL
195AC_ARG_WITH(ssl-dir,
196 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
197 [
198 if test "x$withval" != "$xno" ; then
199 tryssldir=$withval
200 fi
201 ]
202)
203
204saved_LIBS="$LIBS"
cb0b7ea4 205saved_LDFLAGS="$LDFLAGS"
a0391976 206saved_CFLAGS="$CFLAGS"
207if test "x$prefix" != "xNONE" ; then
208 tryssldir="$tryssldir $prefix"
209fi
58d100bf 210AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
211
212 for ssldir in "" $tryssldir /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
213 if test ! -z "$ssldir" ; then
214 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
215 CFLAGS="$saved_CFLAGS -I$ssldir/include"
216 if test ! -z "$need_dash_r" ; then
217 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
218 fi
219 else
220 LDFLAGS="$saved_LDFLAGS"
a0391976 221 fi
a0391976 222
d45e3d76 223 LIBS="$saved_LIBS -lcrypto"
bcf36c78 224
d45e3d76 225 # Basic test to check for compatible version and correct linking
226 # *does not* test for RSA - that comes later.
227 AC_TRY_RUN(
228 [
44fb55e9 229#include <string.h>
230#include <openssl/rand.h>
18ba2aab 231int main(void)
232{
d45e3d76 233 char a[2048];
234 memset(a, 0, sizeof(a));
18ba2aab 235 RAND_add(a, sizeof(a), sizeof(a));
d45e3d76 236 return(RAND_status() <= 0);
18ba2aab 237}
d45e3d76 238 ],
239 [
240 found_crypto=1
241 break;
242 ], []
243 )
58d100bf 244
245 if test ! -z "$found_crypto" ; then
246 break;
247 fi
bcf36c78 248 done
249
58d100bf 250 if test -z "$found_crypto" ; then
251 AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])
252 fi
253 if test -z "$ssldir" ; then
254 ssldir="(system)"
bcf36c78 255 fi
a0391976 256
58d100bf 257 ac_cv_openssldir=$ssldir
258])
259
260if test ! -z "$ac_cv_openssldir" -a ! "x$ac_cv_openssldir" = "x(system)" ; then
261 AC_DEFINE(HAVE_OPENSSL)
262 dnl Need to recover ssldir - test above runs in subshell
263 ssldir=$ac_cv_openssldir
cb0b7ea4 264 CFLAGS="$saved_CFLAGS -I$ssldir/include"
265 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
266 if test ! -z "$need_dash_r" ; then
267 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
a0391976 268 fi
bd499f9e 269 if test ! -z "$blibpath" ; then
270 blibpath="$blibpath:$ssldir:$ssldir/lib"
271 fi
a0391976 272fi
d45e3d76 273LIBS="$saved_LIBS -lcrypto"
274
275# Now test RSA support
276saved_LIBS="$LIBS"
277AC_MSG_CHECKING([for RSA support])
278for WANTS_RSAREF in "" 1 ; do
279 if test -z "$WANTS_RSAREF" ; then
280 LIBS="$saved_LIBS"
281 else
282 LIBS="$saved_LIBS -lRSAglue -lrsaref"
283 fi
284 AC_TRY_RUN([
285#include <string.h>
286#include <openssl/rand.h>
287#include <openssl/rsa.h>
288#include <openssl/bn.h>
289#include <openssl/sha.h>
290int main(void)
291{
292 int num; RSA *key; static unsigned char p_in[] = "blahblah";
293 unsigned char c[256], p[256];
294 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
295 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
296 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
297 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
298}
299 ],
300 [
301 rsa_works=1
302 break;
303 ], [])
304done
305
306if test ! -z "$no_rsa" ; then
307 AC_MSG_RESULT(disabled)
cb0b7ea4 308else
d45e3d76 309 if test -z "$rsa_works" ; then
310 AC_MSG_WARN([*** No RSA support found *** ])
311 else
312 if test -z "$WANTS_RSAREF" ; then
313 AC_MSG_RESULT(yes)
314 else
315 AC_MSG_RESULT(using RSAref)
316 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
317 fi
318 fi
bcf36c78 319fi
58d100bf 320
a0391976 321# Checks for data types
976f7e19 322AC_CHECK_SIZEOF(char, 1)
2b942fe0 323AC_CHECK_SIZEOF(short int, 2)
324AC_CHECK_SIZEOF(int, 4)
325AC_CHECK_SIZEOF(long int, 4)
326AC_CHECK_SIZEOF(long long int, 8)
327
a0391976 328# More checks for data types
58d100bf 329AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
330 AC_TRY_COMPILE(
331 [ #include <sys/types.h> ],
332 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
333 [ ac_cv_have_intxx_t="yes" ],
334 [ ac_cv_have_intxx_t="no" ]
335 )
336])
337if test "x$ac_cv_have_intxx_t" = "xyes" ; then
338 AC_DEFINE(HAVE_INTXX_T)
339 have_intxx_t=1
340fi
341
342AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
343 AC_TRY_COMPILE(
344 [ #include <sys/types.h> ],
345 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
346 [ ac_cv_have_u_intxx_t="yes" ],
347 [ ac_cv_have_u_intxx_t="no" ]
348 )
349])
350if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
351 AC_DEFINE(HAVE_U_INTXX_T)
352 have_u_intxx_t=1
353fi
2b942fe0 354
2b942fe0 355
20af321f 356if test -z "$have_u_intxx_t" -o -z "$have_intxx_t" -a \
5cdfe03f 357 "x$ac_cv_header_sys_bitypes_h" = "xyes"
358then
359 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
360 AC_TRY_COMPILE(
58d100bf 361 [
362#include <sys/bitypes.h>
363 ],
5cdfe03f 364 [
837c30b8 365 int8_t a; int16_t b; int32_t c;
366 u_int8_t e; u_int16_t f; u_int32_t g;
367 a = b = c = e = f = g = 1;
5cdfe03f 368 ],
369 [
370 AC_DEFINE(HAVE_U_INTXX_T)
371 AC_DEFINE(HAVE_INTXX_T)
372 AC_MSG_RESULT(yes)
373 ],
374 [AC_MSG_RESULT(no)]
375 )
376fi
377
474b5fef 378if test -z "$have_u_intxx_t" ; then
58d100bf 379 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
380 AC_TRY_COMPILE(
381 [
382#include <sys/types.h>
383 ],
384 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
385 [ ac_cv_have_uintxx_t="yes" ],
386 [ ac_cv_have_uintxx_t="no" ]
387 )
388 ])
389 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
390 AC_DEFINE(HAVE_UINTXX_T)
391 fi
392fi
393
394AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
474b5fef 395 AC_TRY_COMPILE(
474b5fef 396 [
58d100bf 397#include <sys/types.h>
398#include <sys/socket.h>
474b5fef 399 ],
58d100bf 400 [socklen_t foo; foo = 1235;],
401 [ ac_cv_have_socklen_t="yes" ],
402 [ ac_cv_have_socklen_t="no" ]
403 )
404])
405if test "x$ac_cv_have_socklen_t" = "xyes" ; then
406 AC_DEFINE(HAVE_SOCKLEN_T)
474b5fef 407fi
2b942fe0 408
58d100bf 409AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
410 AC_TRY_COMPILE(
411 [
18ba2aab 412#include <sys/types.h>
58d100bf 413 ],
414 [ size_t foo; foo = 1235; ],
415 [ ac_cv_have_size_t="yes" ],
416 [ ac_cv_have_size_t="no" ]
417 )
418])
419if test "x$ac_cv_have_size_t" = "xyes" ; then
420 AC_DEFINE(HAVE_SIZE_T)
421fi
ea1970a3 422
c04f75f1 423AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
424 AC_TRY_COMPILE(
425 [
426#include <sys/types.h>
427 ],
428 [ ssize_t foo; foo = 1235; ],
429 [ ac_cv_have_ssize_t="yes" ],
430 [ ac_cv_have_ssize_t="no" ]
431 )
432])
433if test "x$ac_cv_have_ssize_t" = "xyes" ; then
434 AC_DEFINE(HAVE_SSIZE_T)
435fi
436
e3a93db0 437
58d100bf 438AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
439 AC_TRY_COMPILE(
440 [
18ba2aab 441#include <sys/types.h>
442#include <sys/socket.h>
58d100bf 443 ],
444 [ struct sockaddr_storage s; ],
445 [ ac_cv_have_struct_sockaddr_storage="yes" ],
446 [ ac_cv_have_struct_sockaddr_storage="no" ]
447 )
448])
449if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
450 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
451fi
48e671d5 452
58d100bf 453AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
454 AC_TRY_COMPILE(
455 [
456#include <netinet/in.h>
457 ],
458 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
459 [ ac_cv_have_struct_sockaddr_in6="yes" ],
460 [ ac_cv_have_struct_sockaddr_in6="no" ]
461 )
462])
463if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
464 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
465fi
48e671d5 466
58d100bf 467AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
468 AC_TRY_COMPILE(
469 [
470#include <netinet/in.h>
471 ],
472 [ struct in6_addr s; s.s6_addr[0] = 0; ],
473 [ ac_cv_have_struct_in6_addr="yes" ],
474 [ ac_cv_have_struct_in6_addr="no" ]
475 )
476])
477if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
478 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
479fi
48e671d5 480
58d100bf 481AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
482 AC_TRY_COMPILE(
483 [
18ba2aab 484#include <sys/types.h>
485#include <sys/socket.h>
486#include <netdb.h>
58d100bf 487 ],
488 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
489 [ ac_cv_have_struct_addrinfo="yes" ],
490 [ ac_cv_have_struct_addrinfo="no" ]
491 )
492])
493if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
494 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
495fi
496
48e671d5 497
a0391976 498# Checks for structure members
48e671d5 499
58d100bf 500OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
501OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
502OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
503OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
504OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
25422c70 505OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
58d100bf 506OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
507OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
508OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
509OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
510OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
511OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1d7b9b20 512OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
513OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
514OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
515OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
516
58d100bf 517
518
519AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
520 ac_cv_have_ss_family_in_struct_ss, [
521 AC_TRY_COMPILE(
522 [
18ba2aab 523#include <sys/types.h>
524#include <sys/socket.h>
58d100bf 525 ],
526 [ struct sockaddr_storage s; s.ss_family = 1; ],
527 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
528 [ ac_cv_have_ss_family_in_struct_ss="no" ],
529 )
530])
531if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
532 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
533fi
534
535
536AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
537 ac_cv_have___ss_family_in_struct_ss, [
538 AC_TRY_COMPILE(
539 [
18ba2aab 540#include <sys/types.h>
541#include <sys/socket.h>
58d100bf 542 ],
543 [ struct sockaddr_storage s; s.__ss_family = 1; ],
544 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
545 [ ac_cv_have___ss_family_in_struct_ss="no" ]
546 )
547])
548if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
549 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
550fi
551
552
553AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
554 AC_TRY_LINK([],
555 [ extern char *__progname; printf("%s", __progname); ],
556 [ ac_cv_libc_defines___progname="yes" ],
557 [ ac_cv_libc_defines___progname="no" ]
558 )
559])
560if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
561 AC_DEFINE(HAVE___PROGNAME)
562fi
8946db53 563
a0391976 564
565# Looking for programs, paths and files
566AC_ARG_WITH(rsh,
567 [ --with-rsh=PATH Specify path to remote shell program ],
568 [
bcf36c78 569 if test "x$withval" != "$no" ; then
a0391976 570 AC_DEFINE_UNQUOTED(RSH_PATH, "$withval")
571 fi
572 ],
573 [
574 AC_PATH_PROG(rsh_path, rsh)
575 ]
576)
577
578AC_ARG_WITH(xauth,
579 [ --with-xauth=PATH Specify path to xauth program ],
580 [
581 if test "x$withval" != "$xno" ; then
582 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$withval")
583 fi
584 ],
585 [
586 AC_PATH_PROG(xauth_path, xauth)
587 if test ! -z "$xauth_path" -a -x "/usr/openwin/bin/xauth" ; then
588 xauth_path="/usr/openwin/bin/xauth"
589 fi
590 ]
591)
592
593if test ! -z "$xauth_path" ; then
594 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
595fi
596if test ! -z "$rsh_path" ; then
597 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
598fi
599
600# Check for mail directory (last resort if we cannot get it from headers)
601if test ! -z "$MAIL" ; then
602 maildir=`dirname $MAIL`
603 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
604fi
605
a0391976 606if test -z "$no_dev_ptmx" ; then
3276571c 607 AC_CHECK_FILE("/dev/ptmx",
608 [
609 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
610 have_dev_ptmx=1
611 ]
612 )
613fi
614AC_CHECK_FILE("/dev/ptc",
615 [
616 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
617 have_dev_ptc=1
618 ]
619)
620
a0391976 621# Options from here on. Some of these are preset by platform above
622
a0391976 623# Check for user-specified random device, otherwise check /dev/urandom
624AC_ARG_WITH(random,
625 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
626 [
bfc9a610 627 if test "x$withval" != "xno" ; then
628 RANDOM_POOL="$withval";
629 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
630 fi
a0391976 631 ],
632 [
633 # Check for random device
634 AC_CHECK_FILE("/dev/urandom",
635 [
636 RANDOM_POOL="/dev/urandom";
637 AC_SUBST(RANDOM_POOL)
638 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
639 ]
640 )
641 ]
642)
643
644# Check for EGD pool file
645AC_ARG_WITH(egd-pool,
646 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
647 [
bfc9a610 648 if test "x$withval" != "xno" ; then
649 EGD_SOCKET="$withval";
650 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
651 fi
a0391976 652 ]
653)
654
d3083fbd 655# detect pathnames for entropy gathering commands, if we need them
656INSTALL_SSH_PRNG_CMDS=""
657rm -f prng_commands
9d98aaf6 658if test -z "$RANDOM_POOL" -a -z "$EGD_SOCKET" ; then
659 # Use these commands to collect entropy
58d100bf 660 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
661 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
662 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
663 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
664 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
665 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
666 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
667 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
668 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
669 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
670 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
671 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
672 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
673 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
674 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
d3083fbd 675
676 INSTALL_SSH_PRNG_CMDS="yes"
9d98aaf6 677fi
d3083fbd 678AC_SUBST(INSTALL_SSH_PRNG_CMDS)
679
9d98aaf6 680
c54a6257 681AC_ARG_WITH(catman,
682 [ --with-catman=man|cat Install preformatted manpages[no]],
683 [
684 MANTYPE='$(CATMAN)'
685 if test x"$withval" != x"yes" ; then
686 mansubdir=$withval
687 else
688 mansubdir=cat
689 fi
690 ], [
691 if test -z "$MANTYPE" ; then
692 MANTYPE='$(TROFFMAN)'
693 mansubdir=man
694 fi
695 ]
696)
697AC_SUBST(MANTYPE)
698AC_SUBST(mansubdir)
0bc5b6fb 699
a0391976 700# Check whether user wants Kerberos support
91b8065d 701AC_ARG_WITH(kerberos4,
dfb95100 702 [ --with-kerberos4=PATH Enable Kerberos 4 support],
91b8065d 703 [
bcf36c78 704 if test "x$withval" != "xno" ; then
dfb95100 705
706 if test "x$withval" != "$xyes" ; then
707 CFLAGS="$CFLAGS -I${withval}/include"
708 LDFLAGS="$LDFLAGS -L${withval}/lib"
bd499f9e 709 if test ! -z "$need_dash_r" ; then
710 LDFLAGS="$LDFLAGS -R${withval}/lib"
711 fi
712 if test ! -z "$blibpath" ; then
713 blibpath="$blibpath:${withval}/lib"
714 fi
dfb95100 715 else
716 if test -d /usr/include/kerberosIV ; then
717 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
718 fi
719 fi
720
721 AC_CHECK_HEADERS(krb.h)
722 AC_CHECK_LIB(krb, main)
723 if test "$ac_cv_header_krb_h" != yes; then
724 AC_MSG_WARN([Cannot find krb.h, build may fail])
725 fi
726 if test "$ac_cv_lib_krb_main" != yes; then
727 AC_MSG_WARN([Cannot find libkrb, build may fail])
728 fi
729
587120ad 730 KLIBS="-lkrb -ldes"
dfb95100 731 AC_CHECK_LIB(resolv, dn_expand, , )
732 KRB4=yes
0bc5b6fb 733 AC_DEFINE(KRB4)
0bc5b6fb 734 fi
91b8065d 735 ]
736)
737
a0391976 738# Check whether user wants AFS support
2b942fe0 739AC_ARG_WITH(afs,
dfb95100 740 [ --with-afs=PATH Enable AFS support],
91b8065d 741 [
bcf36c78 742 if test "x$withval" != "xno" ; then
dfb95100 743
744 if test "x$withval" != "$xyes" ; then
745 CFLAGS="$CFLAGS -I${withval}/include"
746 LFLAGS="$LFLAGS -L${withval}/lib"
747 fi
748
749 if test -z "$KRB4" ; then
750 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
751 fi
752
0bc5b6fb 753 LIBS="$LIBS -lkafs"
dfb95100 754 if test ! -z "$AFS_LIBS" ; then
755 LIBS="$LIBS $AFS_LIBS"
756 fi
757 AC_DEFINE(AFS)
0bc5b6fb 758 fi
91b8065d 759 ]
760)
587120ad 761LIBS="$LIBS $KLIBS"
91b8065d 762
a0391976 763# Check whether user wants S/Key support
91b8065d 764AC_ARG_WITH(skey,
765 [ --with-skey Enable S/Key support],
766 [
bcf36c78 767 if test "x$withval" != "xno" ; then
0bc5b6fb 768 AC_DEFINE(SKEY)
769 LIBS="$LIBS -lskey"
770 fi
91b8065d 771 ]
772)
773
a0391976 774# Check whether user wants TCP wrappers support
2ddcfdf3 775AC_ARG_WITH(tcp-wrappers,
91b8065d 776 [ --with-tcp-wrappers Enable tcpwrappers support],
777 [
bcf36c78 778 if test "x$withval" != "xno" ; then
9fc7867e 779 saved_LIBS="$LIBS"
dfb95100 780 LIBS="$LIBS -lwrap"
9fc7867e 781 AC_MSG_CHECKING(for libwrap)
782 AC_TRY_LINK(
783 [
18ba2aab 784#include <tcpd.h>
9fc7867e 785 int deny_severity = 0, allow_severity = 0;
786 ],
787 [hosts_access(0);],
788 [
789 AC_MSG_RESULT(yes)
790 AC_DEFINE(LIBWRAP)
791 ],
792 [
793 AC_MSG_RESULT(no)
794 AC_MSG_WARN([*** libwrap missing - tcpwrapper support disabled ***])
795 LIBS="$saved_LIBS"
796 ]
797 )
0bc5b6fb 798 fi
91b8065d 799 ]
800)
801
a0391976 802# Check whether to enable MD5 passwords
2ddcfdf3 803AC_ARG_WITH(md5-passwords,
caf3bc51 804 [ --with-md5-passwords Enable use of MD5 passwords],
0bc5b6fb 805 [
bcf36c78 806 if test "x$withval" != "xno" ; then
0bc5b6fb 807 AC_DEFINE(HAVE_MD5_PASSWORDS)
808 fi
809 ]
caf3bc51 810)
811
a0391976 812# Whether to disable shadow password support
a7effaac 813AC_ARG_WITH(shadow,
814 [ --without-shadow Disable shadow password support],
815 [
816 if test "x$withval" = "xno" ; then
817 AC_DEFINE(DISABLE_SHADOW)
818 fi
819 ]
820)
821
a0391976 822# Use ip address instead of hostname in $DISPLAY
a7effaac 823AC_ARG_WITH(ipaddr-display,
824 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
825 [
5957fd29 826 if test "x$withval" = "xno" ; then
a7effaac 827 AC_DEFINE(IPADDR_IN_DISPLAY)
828 fi
829 ]
830)
831
a0391976 832# Whether to mess with the default path
c43d69a9 833AC_ARG_WITH(default-path,
cb807f40 834 [ --with-default-path=PATH Specify default \$PATH environment for server],
835 [
836 if test "x$withval" != "xno" ; then
c73a0cb5 837 AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
cb807f40 838 fi
839 ]
840)
841
a0391976 842# Whether to force IPv4 by default (needed on broken glibc Linux)
59e76f33 843AC_ARG_WITH(ipv4-default,
844 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
845 [
846 if test "x$withval" != "xno" ; then
847 AC_DEFINE(IPV4_DEFAULT)
848 fi
849 ]
850)
851
58d100bf 852AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
80faa19f 853AC_ARG_WITH(4in6,
854 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
855 [
856 if test "x$withval" != "xno" ; then
857 AC_MSG_RESULT(yes)
858 AC_DEFINE(IPV4_IN_IPV6)
859 else
860 AC_MSG_RESULT(no)
861 fi
862 ],[
863 if test "x$inet6_default_4in6" = "xyes"; then
864 AC_MSG_RESULT([yes (default)])
865 AC_DEFINE(IPV4_IN_IPV6)
866 else
867 AC_MSG_RESULT([no (default)])
868 fi
869 ]
870)
871
a0391976 872# Where to place sshd.pid
19d9ac2a 873piddir=/var/run
47e45e44 874AC_ARG_WITH(pid-dir,
875 [ --with-pid-dir=PATH Specify location of ssh.pid file],
876 [
877 if test "x$withval" != "xno" ; then
19d9ac2a 878 piddir=$withval
47e45e44 879 fi
880 ]
881)
b7a87eea 882
a63a7f37 883AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
19d9ac2a 884AC_SUBST(piddir)
47e45e44 885
1d7b9b20 886dnl allow user to disable some login recording features
887AC_ARG_ENABLE(lastlog,
888 [ --disable-lastlog disable use of lastlog even if detected [no]],
889 [ AC_DEFINE(DISABLE_LASTLOG) ]
890)
891AC_ARG_ENABLE(utmp,
892 [ --disable-utmp disable use of utmp even if detected [no]],
893 [ AC_DEFINE(DISABLE_UTMP) ]
894)
895AC_ARG_ENABLE(utmpx,
896 [ --disable-utmpx disable use of utmpx even if detected [no]],
897 [ AC_DEFINE(DISABLE_UTMPX) ]
898)
899AC_ARG_ENABLE(wtmp,
900 [ --disable-wtmp disable use of wtmp even if detected [no]],
901 [ AC_DEFINE(DISABLE_WTMP) ]
902)
903AC_ARG_ENABLE(wtmpx,
904 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
905 [ AC_DEFINE(DISABLE_WTMPX) ]
906)
907AC_ARG_ENABLE(libutil,
908 [ --disable-libutil disable use of libutil (login() etc.) [no]],
909 [ AC_DEFINE(DISABLE_LOGIN) ]
910)
911AC_ARG_ENABLE(pututline,
912 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
913 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
914)
915AC_ARG_ENABLE(pututxline,
916 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
917 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
918)
919AC_ARG_WITH(lastlog,
920 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
921 [ conf_lastlog_location="$withval"; ],)
922
923dnl lastlog, [uw]tmpx? detection
924dnl NOTE: set the paths in the platform section to avoid the
925dnl need for command-line parameters
926dnl lastlog and [uw]tmp are subject to a file search if all else fails
927
928dnl lastlog detection
929dnl NOTE: the code itself will detect if lastlog is a directory
930AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
931AC_TRY_COMPILE([
932#include <sys/types.h>
933#include <utmp.h>
934#ifdef HAVE_LASTLOG_H
935# include <lastlog.h>
936#endif
937#ifdef PATHS_H
938# include <paths.h>
939#endif
940 ],
941 [ char *lastlog = LASTLOG_FILE; ],
942 [ AC_MSG_RESULT(yes) ],
943 [ AC_MSG_RESULT(no)
944 system_lastlog_path=no ]
945)
946if test -z "$conf_lastlog_location"; then
947 if test x"$system_lastlog_path" = x"no" ; then
948 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
949 if test -e $f ; then
950 conf_lastlog_location=$f
951 fi
952 done
953 if test -z "$conf_lastlog_location"; then
954 AC_MSG_WARN([** Cannot find lastlog - disabling feature **])
955 AC_DEFINE(DISABLE_LASTLOG)
956 fi
957 fi
958fi
959
960if test -n "$conf_lastlog_location"; then
961 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
962fi
963
964dnl utmp detection
965AC_MSG_CHECKING([if your system defines UTMP_FILE])
966AC_TRY_COMPILE([
967#include <sys/types.h>
968#include <utmp.h>
969#ifdef PATHS_H
970# include <paths.h>
971#endif
972 ],
973 [ char *utmp = UTMP_FILE; ],
974 [ AC_MSG_RESULT(yes) ],
975 [ AC_MSG_RESULT(no)
976 system_utmp_path=no ]
977)
978if test -z "$conf_utmp_location"; then
979 if test x"$system_utmp_path" = x"no" ; then
980 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
981 if test -f $f ; then
982 conf_utmp_location=$f
983 fi
984 done
985 if test -z "$conf_utmp_location"; then
986 AC_DEFINE(DISABLE_UTMP)
987 fi
988 fi
989fi
990if test -n "$conf_utmp_location"; then
991 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
992fi
993
994dnl wtmp detection
995AC_MSG_CHECKING([if your system defines WTMP_FILE])
996AC_TRY_COMPILE([
997#include <sys/types.h>
998#include <utmp.h>
999#ifdef PATHS_H
1000# include <paths.h>
1001#endif
1002 ],
1003 [ char *wtmp = WTMP_FILE; ],
1004 [ AC_MSG_RESULT(yes) ],
1005 [ AC_MSG_RESULT(no)
1006 system_wtmp_path=no ]
1007)
1008if test -z "$conf_wtmp_location"; then
1009 if test x"$system_wtmp_path" = x"no" ; then
1010 for f in /usr/adm/wtmp /var/log/wtmp; do
1011 if test -f $f ; then
1012 conf_wtmp_location=$f
1013 fi
1014 done
1015 if test -z "$conf_wtmp_location"; then
1016 AC_DEFINE(DISABLE_WTMP)
1017 fi
1018 fi
1019fi
1020if test -n "$conf_wtmp_location"; then
1021 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
1022fi
1023
1024
1025dnl utmpx detection - I don't know any system so perverse as to require
1026dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
1027dnl there, though.
1028AC_MSG_CHECKING([if your system defines UTMPX_FILE])
1029AC_TRY_COMPILE([
1030#include <sys/types.h>
1031#include <utmp.h>
1032#ifdef HAVE_UTMPX_H
1033#include <utmpx.h>
1034#endif
1035#ifdef PATHS_H
1036# include <paths.h>
1037#endif
1038 ],
1039 [ char *utmpx = UTMPX_FILE; ],
1040 [ AC_MSG_RESULT(yes) ],
1041 [ AC_MSG_RESULT(no)
1042 system_utmpx_path=no ]
1043)
1044if test -z "$conf_utmpx_location"; then
1045 if test x"$system_utmpx_path" = x"no" ; then
1046 AC_DEFINE(DISABLE_UTMPX)
1047 fi
1048else
1049 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
1050fi
1051
1052dnl wtmpx detection
1053AC_MSG_CHECKING([if your system defines WTMPX_FILE])
1054AC_TRY_COMPILE([
1055#include <sys/types.h>
1056#include <utmp.h>
1057#ifdef HAVE_UTMPX_H
1058#include <utmpx.h>
1059#endif
1060#ifdef PATHS_H
1061# include <paths.h>
1062#endif
1063 ],
1064 [ char *wtmpx = WTMPX_FILE; ],
1065 [ AC_MSG_RESULT(yes) ],
1066 [ AC_MSG_RESULT(no)
1067 system_wtmpx_path=no ]
1068)
1069if test -z "$conf_wtmpx_location"; then
1070 if test x"$system_wtmpx_path" = x"no" ; then
1071 AC_DEFINE(DISABLE_WTMPX)
1072 fi
1073else
1074 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
1075fi
1076
b7a87eea 1077
1078# Change default command timeout for builtin PRNG
1079entropy_timeout=100
1080AC_ARG_WITH(entropy-timeout,
1081 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1082 [
1083 if test "x$withval" != "xno" ; then
1084 entropy_timeout=$withval
1085 fi
1086 ]
1087)
1088AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1089
1090
bd499f9e 1091if test ! -z "$blibpath" ; then
1092 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
1093 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
1094fi
1095
d3083fbd 1096AC_OUTPUT(Makefile ssh_prng_cmds)
1097
1098
This page took 0.443649 seconds and 5 git commands to generate.