]> andersk Git - openssh.git/blame - configure.in
- Detect OpenSSL seperatly from RSA
[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
42 CFLAGS="$CFLAGS -Aa"
43 fi
44 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
84afc958 45 CFLAGS="$CFLAGS -I/usr/local/include"
46 LDFLAGS="$LDFLAGS -L/usr/local/lib"
a7effaac 47 AC_DEFINE(IPADDR_IN_DISPLAY)
f498ed15 48 AC_DEFINE(USE_UTMPX)
a7effaac 49 AC_MSG_CHECKING(for HPUX trusted system password database)
50 if test -f /tcb/files/auth/system/default; then
51 AC_MSG_RESULT(yes)
52 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
53 LIBS="$LIBS -lsec"
dfb95100 54 AC_MSG_WARN([This configuration is untested])
a7effaac 55 else
56 AC_MSG_RESULT(no)
57 AC_DEFINE(DISABLE_SHADOW)
58 fi
c54a6257 59 MANTYPE='$(CATMAN)'
60 mansubdir=cat
a7effaac 61 ;;
2b763e31 62*-*-hpux11*)
63 if test -z "$GCC"; then
64 CFLAGS="$CFLAGS -Ae"
65 fi
66 CFLAGS="$CFLAGS -D_HPUX_SOURCE"
67 CFLAGS="$CFLAGS -I/usr/local/include"
68 LDFLAGS="$LDFLAGS -L/usr/local/lib"
69 AC_DEFINE(IPADDR_IN_DISPLAY)
70 AC_DEFINE(USE_UTMPX)
71 AC_MSG_CHECKING(for HPUX trusted system password database)
72 if test -f /tcb/files/auth/system/default; then
73 AC_MSG_RESULT(yes)
74 AC_DEFINE(HAVE_HPUX_TRUSTED_SYSTEM_PW)
75 LIBS="$LIBS -lsec"
76 AC_MSG_WARN([This configuration is untested])
77 else
78 AC_MSG_RESULT(no)
79 AC_DEFINE(DISABLE_SHADOW)
80 fi
81 MANTYPE='$(CATMAN)'
82 mansubdir=cat
83 ;;
d94aa2ae 84*-*-irix5*)
84afc958 85 CFLAGS="$CFLAGS -I/usr/local/include"
86 LDFLAGS="$LDFLAGS -L/usr/local/lib"
8eb34e02 87 MANTYPE='$(CATMAN)'
b9795b89 88 no_libsocket=1
89 no_libnsl=1
90 ;;
91*-*-irix6*)
84afc958 92 CFLAGS="$CFLAGS -I/usr/local/include"
93 LDFLAGS="$LDFLAGS -L/usr/local/lib"
8eb34e02 94 MANTYPE='$(CATMAN)'
95 AC_MSG_WARN([*** Irix 6.x is not tested, please report you experiences *** ])
d94aa2ae 96 no_libsocket=1
97 no_libnsl=1
98 ;;
5cdfe03f 99*-*-linux*)
100 no_dev_ptmx=1
80faa19f 101 AC_DEFINE(DONT_TRY_OTHER_AF)
102 inet6_default_4in6=yes
5cdfe03f 103 ;;
d468fc76 104*-*-netbsd*)
a0391976 105 need_dash_r=1
d468fc76 106 ;;
9d6b1b96 107*-*-solaris*)
84afc958 108 CFLAGS="$CFLAGS -I/usr/local/include"
4696775a 109 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib -L/usr/ucblib -R/usr/ucblib"
a0391976 110 need_dash_r=1
9d6b1b96 111 AC_DEFINE(USE_UTMPX)
112 ;;
113*-*-sysv*)
84afc958 114 CFLAGS="$CFLAGS -I/usr/local/include"
115 LDFLAGS="$LDFLAGS -L/usr/local/lib"
9755cbdb 116 AC_DEFINE(USE_UTMPX)
117 MANTYPE='$(CATMAN)'
118 mansubdir=cat
9d6b1b96 119 LIBS="$LIBS -lgen -lsocket"
120 ;;
a7effaac 121esac
122
a0391976 123# Checks for libraries.
4cca272e 124AC_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")
4cca272e 126
d94aa2ae 127if 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, , )
f74efc8d 132fi
4cca272e 133
a0391976 134# Checks for header files.
52bcc044 135AC_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 util.h utmp.h utmpx.h)
4cca272e 136
a0391976 137# Checks for library functions.
c04f75f1 138AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_af clock freeaddrinfo gai_strerror getaddrinfo getnameinfo getrusage innetgr md5_crypt memmove mkdtemp openpty rresvport_af setenv seteuid setlogin setproctitle setreuid snprintf strlcat strlcpy updwtmpx vsnprintf vhangup _getpty __b64_ntop)
76cd7316 139
beb43d31 140AC_CHECK_FUNC(login,
141 [AC_DEFINE(HAVE_LOGIN)],
142 [AC_CHECK_LIB(bsd, login, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_LOGIN)])]
143)
144
145AC_CHECK_FUNC(daemon,
146 [AC_DEFINE(HAVE_DAEMON)],
147 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
148)
149
aa6bd60a 150AC_CHECK_FUNC(getpagesize,
151 [AC_DEFINE(HAVE_GETPAGESIZE)],
152 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
153)
154
a0391976 155AC_ARG_WITH(pam,
156 [ --without-pam Disable PAM support ],
157 [
158 if test "x$withval" = "xno" ; then
159 no_pam=1
160 AC_DEFINE(DISABLE_PAM)
161 fi
162 ]
163)
164if test -z "$no_pam" -a "x$ac_cv_header_security_pam_appl_h" = "xyes" ; then
165 AC_CHECK_LIB(dl, dlopen, , )
166 LIBS="$LIBS -lpam"
167
28c1d5ce 168 AC_CHECK_FUNCS(pam_getenvlist)
2b763e31 169
a0391976 170 # Check PAM strerror arguments (old PAM)
171 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
172 AC_TRY_COMPILE(
173 [
18ba2aab 174#include <stdlib.h>
175#include <security/pam_appl.h>
a0391976 176 ],
177 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
178 [AC_MSG_RESULT(no)],
179 [
180 AC_DEFINE(HAVE_OLD_PAM)
181 AC_MSG_RESULT(yes)
182 ]
183 )
184fi
185
186# The big search for OpenSSL
187AC_ARG_WITH(ssl-dir,
188 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
189 [
190 if test "x$withval" != "$xno" ; then
191 tryssldir=$withval
192 fi
193 ]
194)
195
196saved_LIBS="$LIBS"
cb0b7ea4 197saved_LDFLAGS="$LDFLAGS"
a0391976 198saved_CFLAGS="$CFLAGS"
199if test "x$prefix" != "xNONE" ; then
200 tryssldir="$tryssldir $prefix"
201fi
58d100bf 202AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [
203
204 for ssldir in "" $tryssldir /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do
205 if test ! -z "$ssldir" ; then
206 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
207 CFLAGS="$saved_CFLAGS -I$ssldir/include"
208 if test ! -z "$need_dash_r" ; then
209 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
210 fi
211 else
212 LDFLAGS="$saved_LDFLAGS"
a0391976 213 fi
a0391976 214
d45e3d76 215 LIBS="$saved_LIBS -lcrypto"
bcf36c78 216
d45e3d76 217 # Basic test to check for compatible version and correct linking
218 # *does not* test for RSA - that comes later.
219 AC_TRY_RUN(
220 [
44fb55e9 221#include <string.h>
222#include <openssl/rand.h>
18ba2aab 223int main(void)
224{
d45e3d76 225 char a[2048];
226 memset(a, 0, sizeof(a));
18ba2aab 227 RAND_add(a, sizeof(a), sizeof(a));
d45e3d76 228 return(RAND_status() <= 0);
18ba2aab 229}
d45e3d76 230 ],
231 [
232 found_crypto=1
233 break;
234 ], []
235 )
58d100bf 236
237 if test ! -z "$found_crypto" ; then
238 break;
239 fi
bcf36c78 240 done
241
58d100bf 242 if test -z "$found_crypto" ; then
243 AC_MSG_ERROR([Could not find working SSLeay / OpenSSL libraries, please install])
244 fi
245 if test -z "$ssldir" ; then
246 ssldir="(system)"
bcf36c78 247 fi
a0391976 248
58d100bf 249 ac_cv_openssldir=$ssldir
250])
251
252if test ! -z "$ac_cv_openssldir" -a ! "x$ac_cv_openssldir" = "x(system)" ; then
253 AC_DEFINE(HAVE_OPENSSL)
254 dnl Need to recover ssldir - test above runs in subshell
255 ssldir=$ac_cv_openssldir
cb0b7ea4 256 CFLAGS="$saved_CFLAGS -I$ssldir/include"
257 LDFLAGS="$saved_LDFLAGS -L$ssldir/lib -L$ssldir"
258 if test ! -z "$need_dash_r" ; then
259 LDFLAGS="$LDFLAGS -R$ssldir/lib -R$ssldir"
a0391976 260 fi
bd499f9e 261 if test ! -z "$blibpath" ; then
262 blibpath="$blibpath:$ssldir:$ssldir/lib"
263 fi
a0391976 264fi
d45e3d76 265LIBS="$saved_LIBS -lcrypto"
266
267# Now test RSA support
268saved_LIBS="$LIBS"
269AC_MSG_CHECKING([for RSA support])
270for WANTS_RSAREF in "" 1 ; do
271 if test -z "$WANTS_RSAREF" ; then
272 LIBS="$saved_LIBS"
273 else
274 LIBS="$saved_LIBS -lRSAglue -lrsaref"
275 fi
276 AC_TRY_RUN([
277#include <string.h>
278#include <openssl/rand.h>
279#include <openssl/rsa.h>
280#include <openssl/bn.h>
281#include <openssl/sha.h>
282int main(void)
283{
284 int num; RSA *key; static unsigned char p_in[] = "blahblah";
285 unsigned char c[256], p[256];
286 memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c));
287 if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1);
288 num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING);
289 return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING));
290}
291 ],
292 [
293 rsa_works=1
294 break;
295 ], [])
296done
297
298if test ! -z "$no_rsa" ; then
299 AC_MSG_RESULT(disabled)
cb0b7ea4 300else
d45e3d76 301 if test -z "$rsa_works" ; then
302 AC_MSG_WARN([*** No RSA support found *** ])
303 else
304 if test -z "$WANTS_RSAREF" ; then
305 AC_MSG_RESULT(yes)
306 else
307 AC_MSG_RESULT(using RSAref)
308 LIBS="$saved_LIBS -lcrypto -lRSAglue -lrsaref"
309 fi
310 fi
bcf36c78 311fi
58d100bf 312
a0391976 313# Checks for data types
976f7e19 314AC_CHECK_SIZEOF(char, 1)
2b942fe0 315AC_CHECK_SIZEOF(short int, 2)
316AC_CHECK_SIZEOF(int, 4)
317AC_CHECK_SIZEOF(long int, 4)
318AC_CHECK_SIZEOF(long long int, 8)
319
a0391976 320# More checks for data types
58d100bf 321AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
322 AC_TRY_COMPILE(
323 [ #include <sys/types.h> ],
324 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
325 [ ac_cv_have_intxx_t="yes" ],
326 [ ac_cv_have_intxx_t="no" ]
327 )
328])
329if test "x$ac_cv_have_intxx_t" = "xyes" ; then
330 AC_DEFINE(HAVE_INTXX_T)
331 have_intxx_t=1
332fi
333
334AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
335 AC_TRY_COMPILE(
336 [ #include <sys/types.h> ],
337 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
338 [ ac_cv_have_u_intxx_t="yes" ],
339 [ ac_cv_have_u_intxx_t="no" ]
340 )
341])
342if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
343 AC_DEFINE(HAVE_U_INTXX_T)
344 have_u_intxx_t=1
345fi
2b942fe0 346
2b942fe0 347
20af321f 348if test -z "$have_u_intxx_t" -o -z "$have_intxx_t" -a \
5cdfe03f 349 "x$ac_cv_header_sys_bitypes_h" = "xyes"
350then
351 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
352 AC_TRY_COMPILE(
58d100bf 353 [
354#include <sys/bitypes.h>
355 ],
5cdfe03f 356 [
837c30b8 357 int8_t a; int16_t b; int32_t c;
358 u_int8_t e; u_int16_t f; u_int32_t g;
359 a = b = c = e = f = g = 1;
5cdfe03f 360 ],
361 [
362 AC_DEFINE(HAVE_U_INTXX_T)
363 AC_DEFINE(HAVE_INTXX_T)
364 AC_MSG_RESULT(yes)
365 ],
366 [AC_MSG_RESULT(no)]
367 )
368fi
369
474b5fef 370if test -z "$have_u_intxx_t" ; then
58d100bf 371 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
372 AC_TRY_COMPILE(
373 [
374#include <sys/types.h>
375 ],
376 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
377 [ ac_cv_have_uintxx_t="yes" ],
378 [ ac_cv_have_uintxx_t="no" ]
379 )
380 ])
381 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
382 AC_DEFINE(HAVE_UINTXX_T)
383 fi
384fi
385
386AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
474b5fef 387 AC_TRY_COMPILE(
474b5fef 388 [
58d100bf 389#include <sys/types.h>
390#include <sys/socket.h>
474b5fef 391 ],
58d100bf 392 [socklen_t foo; foo = 1235;],
393 [ ac_cv_have_socklen_t="yes" ],
394 [ ac_cv_have_socklen_t="no" ]
395 )
396])
397if test "x$ac_cv_have_socklen_t" = "xyes" ; then
398 AC_DEFINE(HAVE_SOCKLEN_T)
474b5fef 399fi
2b942fe0 400
58d100bf 401AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
402 AC_TRY_COMPILE(
403 [
18ba2aab 404#include <sys/types.h>
58d100bf 405 ],
406 [ size_t foo; foo = 1235; ],
407 [ ac_cv_have_size_t="yes" ],
408 [ ac_cv_have_size_t="no" ]
409 )
410])
411if test "x$ac_cv_have_size_t" = "xyes" ; then
412 AC_DEFINE(HAVE_SIZE_T)
413fi
ea1970a3 414
c04f75f1 415AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
416 AC_TRY_COMPILE(
417 [
418#include <sys/types.h>
419 ],
420 [ ssize_t foo; foo = 1235; ],
421 [ ac_cv_have_ssize_t="yes" ],
422 [ ac_cv_have_ssize_t="no" ]
423 )
424])
425if test "x$ac_cv_have_ssize_t" = "xyes" ; then
426 AC_DEFINE(HAVE_SSIZE_T)
427fi
428
e3a93db0 429
58d100bf 430AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
431 AC_TRY_COMPILE(
432 [
18ba2aab 433#include <sys/types.h>
434#include <sys/socket.h>
58d100bf 435 ],
436 [ struct sockaddr_storage s; ],
437 [ ac_cv_have_struct_sockaddr_storage="yes" ],
438 [ ac_cv_have_struct_sockaddr_storage="no" ]
439 )
440])
441if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
442 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
443fi
48e671d5 444
58d100bf 445AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
446 AC_TRY_COMPILE(
447 [
448#include <netinet/in.h>
449 ],
450 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
451 [ ac_cv_have_struct_sockaddr_in6="yes" ],
452 [ ac_cv_have_struct_sockaddr_in6="no" ]
453 )
454])
455if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
456 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
457fi
48e671d5 458
58d100bf 459AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
460 AC_TRY_COMPILE(
461 [
462#include <netinet/in.h>
463 ],
464 [ struct in6_addr s; s.s6_addr[0] = 0; ],
465 [ ac_cv_have_struct_in6_addr="yes" ],
466 [ ac_cv_have_struct_in6_addr="no" ]
467 )
468])
469if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
470 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
471fi
48e671d5 472
58d100bf 473AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
474 AC_TRY_COMPILE(
475 [
18ba2aab 476#include <sys/types.h>
477#include <sys/socket.h>
478#include <netdb.h>
58d100bf 479 ],
480 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
481 [ ac_cv_have_struct_addrinfo="yes" ],
482 [ ac_cv_have_struct_addrinfo="no" ]
483 )
484])
485if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
486 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
487fi
488
48e671d5 489
a0391976 490# Checks for structure members
48e671d5 491
58d100bf 492OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
493OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
494OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
495OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
496OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
497OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
498OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
499OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
500OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
501OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
502OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
503
504
505AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
506 ac_cv_have_ss_family_in_struct_ss, [
507 AC_TRY_COMPILE(
508 [
18ba2aab 509#include <sys/types.h>
510#include <sys/socket.h>
58d100bf 511 ],
512 [ struct sockaddr_storage s; s.ss_family = 1; ],
513 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
514 [ ac_cv_have_ss_family_in_struct_ss="no" ],
515 )
516])
517if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
518 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
519fi
520
521
522AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
523 ac_cv_have___ss_family_in_struct_ss, [
524 AC_TRY_COMPILE(
525 [
18ba2aab 526#include <sys/types.h>
527#include <sys/socket.h>
58d100bf 528 ],
529 [ struct sockaddr_storage s; s.__ss_family = 1; ],
530 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
531 [ ac_cv_have___ss_family_in_struct_ss="no" ]
532 )
533])
534if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
535 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
536fi
537
538
539AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
540 AC_TRY_LINK([],
541 [ extern char *__progname; printf("%s", __progname); ],
542 [ ac_cv_libc_defines___progname="yes" ],
543 [ ac_cv_libc_defines___progname="no" ]
544 )
545])
546if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
547 AC_DEFINE(HAVE___PROGNAME)
548fi
8946db53 549
a0391976 550
551# Looking for programs, paths and files
552AC_ARG_WITH(rsh,
553 [ --with-rsh=PATH Specify path to remote shell program ],
554 [
bcf36c78 555 if test "x$withval" != "$no" ; then
a0391976 556 AC_DEFINE_UNQUOTED(RSH_PATH, "$withval")
557 fi
558 ],
559 [
560 AC_PATH_PROG(rsh_path, rsh)
561 ]
562)
563
564AC_ARG_WITH(xauth,
565 [ --with-xauth=PATH Specify path to xauth program ],
566 [
567 if test "x$withval" != "$xno" ; then
568 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$withval")
569 fi
570 ],
571 [
572 AC_PATH_PROG(xauth_path, xauth)
573 if test ! -z "$xauth_path" -a -x "/usr/openwin/bin/xauth" ; then
574 xauth_path="/usr/openwin/bin/xauth"
575 fi
576 ]
577)
578
579if test ! -z "$xauth_path" ; then
580 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
581fi
582if test ! -z "$rsh_path" ; then
583 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
584fi
585
586# Check for mail directory (last resort if we cannot get it from headers)
587if test ! -z "$MAIL" ; then
588 maildir=`dirname $MAIL`
589 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
590fi
591
592# Look for lastlog location
a7effaac 593AC_ARG_WITH(lastlog,
cb807f40 594 [ --with-lastlog=FILE Location of lastlog file],
a7effaac 595 [
596 if test "x$withval" = "xno" ; then
597 AC_DEFINE(DISABLE_LASTLOG)
598 else
599 AC_DEFINE_UNQUOTED(LASTLOG_LOCATION, "$withval")
600 fi
601 ],
602 [
603 AC_MSG_CHECKING([location of lastlog file])
f9507c24 604 for lastlog in /var/log/lastlog /var/adm/lastlog /usr/adm/lastlog /etc/security/lastlog ; do
a7effaac 605 if test -f $lastlog ; then
606 gotlastlog="file"
607 break
608 fi
609 if test -d $lastlog ; then
610 gotlastlog="dir"
611 break
612 fi
613 done
614 if test -z "$gotlastlog" ; then
d94aa2ae 615 AC_MSG_RESULT(not found)
a7effaac 616 nolastlog=1
617 else
618 if test "x$gotlastlog" = "xdir" ; then
d94aa2ae 619 AC_MSG_RESULT(${lastlog}/)
a7effaac 620 AC_DEFINE(LASTLOG_IS_DIR)
d94aa2ae 621 else
622 AC_MSG_RESULT($lastlog)
623 AC_DEFINE_UNQUOTED(LASTLOG_LOCATION, "$lastlog")
a7effaac 624 fi
a7effaac 625 fi
626 ]
627)
628
629if test ! -z "$nolastlog" ; then
630 AC_MSG_WARN([*** Disabling lastlog support *** ])
631 AC_DEFINE(DISABLE_LASTLOG)
632fi
f601d847 633
a0391976 634if test -z "$no_dev_ptmx" ; then
3276571c 635 AC_CHECK_FILE("/dev/ptmx",
636 [
637 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
638 have_dev_ptmx=1
639 ]
640 )
641fi
642AC_CHECK_FILE("/dev/ptc",
643 [
644 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
645 have_dev_ptc=1
646 ]
647)
648
a0391976 649# Options from here on. Some of these are preset by platform above
650
a0391976 651# Check for user-specified random device, otherwise check /dev/urandom
652AC_ARG_WITH(random,
653 [ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
654 [
bfc9a610 655 if test "x$withval" != "xno" ; then
656 RANDOM_POOL="$withval";
657 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
658 fi
a0391976 659 ],
660 [
661 # Check for random device
662 AC_CHECK_FILE("/dev/urandom",
663 [
664 RANDOM_POOL="/dev/urandom";
665 AC_SUBST(RANDOM_POOL)
666 AC_DEFINE_UNQUOTED(RANDOM_POOL, "$RANDOM_POOL")
667 ]
668 )
669 ]
670)
671
672# Check for EGD pool file
673AC_ARG_WITH(egd-pool,
674 [ --with-egd-pool=FILE read randomness from EGD pool FILE (default none)],
675 [
bfc9a610 676 if test "x$withval" != "xno" ; then
677 EGD_SOCKET="$withval";
678 AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
679 fi
a0391976 680 ]
681)
682
d3083fbd 683# detect pathnames for entropy gathering commands, if we need them
684INSTALL_SSH_PRNG_CMDS=""
685rm -f prng_commands
9d98aaf6 686if test -z "$RANDOM_POOL" -a -z "$EGD_SOCKET" ; then
687 # Use these commands to collect entropy
58d100bf 688 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
689 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
690 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
691 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
692 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
693 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
694 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
695 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
696 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
697 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
698 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
699 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
700 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
701 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
702 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
d3083fbd 703
704 INSTALL_SSH_PRNG_CMDS="yes"
9d98aaf6 705fi
d3083fbd 706AC_SUBST(INSTALL_SSH_PRNG_CMDS)
707
9d98aaf6 708
c54a6257 709AC_ARG_WITH(catman,
710 [ --with-catman=man|cat Install preformatted manpages[no]],
711 [
712 MANTYPE='$(CATMAN)'
713 if test x"$withval" != x"yes" ; then
714 mansubdir=$withval
715 else
716 mansubdir=cat
717 fi
718 ], [
719 if test -z "$MANTYPE" ; then
720 MANTYPE='$(TROFFMAN)'
721 mansubdir=man
722 fi
723 ]
724)
725AC_SUBST(MANTYPE)
726AC_SUBST(mansubdir)
0bc5b6fb 727
a0391976 728# Check whether user wants Kerberos support
91b8065d 729AC_ARG_WITH(kerberos4,
dfb95100 730 [ --with-kerberos4=PATH Enable Kerberos 4 support],
91b8065d 731 [
bcf36c78 732 if test "x$withval" != "xno" ; then
dfb95100 733
734 if test "x$withval" != "$xyes" ; then
735 CFLAGS="$CFLAGS -I${withval}/include"
736 LDFLAGS="$LDFLAGS -L${withval}/lib"
bd499f9e 737 if test ! -z "$need_dash_r" ; then
738 LDFLAGS="$LDFLAGS -R${withval}/lib"
739 fi
740 if test ! -z "$blibpath" ; then
741 blibpath="$blibpath:${withval}/lib"
742 fi
dfb95100 743 else
744 if test -d /usr/include/kerberosIV ; then
745 CFLAGS="$CFLAGS -I/usr/include/kerberosIV"
746 fi
747 fi
748
749 AC_CHECK_HEADERS(krb.h)
750 AC_CHECK_LIB(krb, main)
751 if test "$ac_cv_header_krb_h" != yes; then
752 AC_MSG_WARN([Cannot find krb.h, build may fail])
753 fi
754 if test "$ac_cv_lib_krb_main" != yes; then
755 AC_MSG_WARN([Cannot find libkrb, build may fail])
756 fi
757
587120ad 758 KLIBS="-lkrb -ldes"
dfb95100 759 AC_CHECK_LIB(resolv, dn_expand, , )
760 KRB4=yes
0bc5b6fb 761 AC_DEFINE(KRB4)
0bc5b6fb 762 fi
91b8065d 763 ]
764)
765
a0391976 766# Check whether user wants AFS support
2b942fe0 767AC_ARG_WITH(afs,
dfb95100 768 [ --with-afs=PATH Enable AFS support],
91b8065d 769 [
bcf36c78 770 if test "x$withval" != "xno" ; then
dfb95100 771
772 if test "x$withval" != "$xyes" ; then
773 CFLAGS="$CFLAGS -I${withval}/include"
774 LFLAGS="$LFLAGS -L${withval}/lib"
775 fi
776
777 if test -z "$KRB4" ; then
778 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
779 fi
780
0bc5b6fb 781 LIBS="$LIBS -lkafs"
dfb95100 782 if test ! -z "$AFS_LIBS" ; then
783 LIBS="$LIBS $AFS_LIBS"
784 fi
785 AC_DEFINE(AFS)
0bc5b6fb 786 fi
91b8065d 787 ]
788)
587120ad 789LIBS="$LIBS $KLIBS"
91b8065d 790
a0391976 791# Check whether user wants S/Key support
91b8065d 792AC_ARG_WITH(skey,
793 [ --with-skey Enable S/Key support],
794 [
bcf36c78 795 if test "x$withval" != "xno" ; then
0bc5b6fb 796 AC_DEFINE(SKEY)
797 LIBS="$LIBS -lskey"
798 fi
91b8065d 799 ]
800)
801
a0391976 802# Check whether user wants TCP wrappers support
2ddcfdf3 803AC_ARG_WITH(tcp-wrappers,
91b8065d 804 [ --with-tcp-wrappers Enable tcpwrappers support],
805 [
bcf36c78 806 if test "x$withval" != "xno" ; then
9fc7867e 807 saved_LIBS="$LIBS"
dfb95100 808 LIBS="$LIBS -lwrap"
9fc7867e 809 AC_MSG_CHECKING(for libwrap)
810 AC_TRY_LINK(
811 [
18ba2aab 812#include <tcpd.h>
9fc7867e 813 int deny_severity = 0, allow_severity = 0;
814 ],
815 [hosts_access(0);],
816 [
817 AC_MSG_RESULT(yes)
818 AC_DEFINE(LIBWRAP)
819 ],
820 [
821 AC_MSG_RESULT(no)
822 AC_MSG_WARN([*** libwrap missing - tcpwrapper support disabled ***])
823 LIBS="$saved_LIBS"
824 ]
825 )
0bc5b6fb 826 fi
91b8065d 827 ]
828)
829
a0391976 830# Check whether to enable MD5 passwords
2ddcfdf3 831AC_ARG_WITH(md5-passwords,
caf3bc51 832 [ --with-md5-passwords Enable use of MD5 passwords],
0bc5b6fb 833 [
bcf36c78 834 if test "x$withval" != "xno" ; then
0bc5b6fb 835 AC_DEFINE(HAVE_MD5_PASSWORDS)
836 fi
837 ]
caf3bc51 838)
839
a0391976 840# Check whether to enable utmpx support
92f90c57 841AC_ARG_WITH(utmpx,
842 [ --with-utmpx Enable utmpx support],
a7effaac 843 [
844 if test "x$withval" != "xno" ; then
845 AC_DEFINE(USE_UTMPX)
846 fi
847 ]
92f90c57 848)
849
a0391976 850# Whether to disable shadow password support
a7effaac 851AC_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
a0391976 860# Use ip address instead of hostname in $DISPLAY
a7effaac 861AC_ARG_WITH(ipaddr-display,
862 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
863 [
5957fd29 864 if test "x$withval" = "xno" ; then
a7effaac 865 AC_DEFINE(IPADDR_IN_DISPLAY)
866 fi
867 ]
868)
869
a0391976 870# Whether to mess with the default path
c43d69a9 871AC_ARG_WITH(default-path,
cb807f40 872 [ --with-default-path=PATH Specify default \$PATH environment for server],
873 [
874 if test "x$withval" != "xno" ; then
c73a0cb5 875 AC_DEFINE_UNQUOTED(USER_PATH, "$withval")
cb807f40 876 fi
877 ]
878)
879
a0391976 880# Whether to force IPv4 by default (needed on broken glibc Linux)
59e76f33 881AC_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
58d100bf 890AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
80faa19f 891AC_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
a0391976 910# Where to place sshd.pid
19d9ac2a 911piddir=/var/run
47e45e44 912AC_ARG_WITH(pid-dir,
913 [ --with-pid-dir=PATH Specify location of ssh.pid file],
914 [
915 if test "x$withval" != "xno" ; then
19d9ac2a 916 piddir=$withval
47e45e44 917 fi
918 ]
919)
b7a87eea 920
a63a7f37 921AC_DEFINE_UNQUOTED(PIDDIR, "$piddir")
19d9ac2a 922AC_SUBST(piddir)
47e45e44 923
b7a87eea 924
925# Change default command timeout for builtin PRNG
926entropy_timeout=100
927AC_ARG_WITH(entropy-timeout,
928 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
929 [
930 if test "x$withval" != "xno" ; then
931 entropy_timeout=$withval
932 fi
933 ]
934)
935AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
936
937
bd499f9e 938if test ! -z "$blibpath" ; then
939 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
940 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
941fi
942
d3083fbd 943AC_OUTPUT(Makefile ssh_prng_cmds)
944
945
This page took 3.065345 seconds and 5 git commands to generate.