]> andersk Git - openssh.git/blame_incremental - configure.ac
- (dtucker) [configure.ac] Add --without-zlib-version-check. Feedback from
[openssh.git] / configure.ac
... / ...
CommitLineData
1# $Id$
2
3AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
5
6AC_CONFIG_HEADER(config.h)
7AC_PROG_CC
8AC_CANONICAL_HOST
9AC_C_BIGENDIAN
10
11# Checks for programs.
12AC_PROG_AWK
13AC_PROG_CPP
14AC_PROG_RANLIB
15AC_PROG_INSTALL
16AC_PATH_PROG(AR, ar)
17AC_PATH_PROGS(PERL, perl5 perl)
18AC_PATH_PROG(SED, sed)
19AC_SUBST(PERL)
20AC_PATH_PROG(ENT, ent)
21AC_SUBST(ENT)
22AC_PATH_PROG(TEST_MINUS_S_SH, bash)
23AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
24AC_PATH_PROG(TEST_MINUS_S_SH, sh)
25AC_PATH_PROG(SH, sh)
26
27# System features
28AC_SYS_LARGEFILE
29
30if test -z "$AR" ; then
31 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
32fi
33
34# Use LOGIN_PROGRAM from environment if possible
35if test ! -z "$LOGIN_PROGRAM" ; then
36 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
37else
38 # Search for login
39 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
40 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
41 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
42 fi
43fi
44
45if test -z "$LD" ; then
46 LD=$CC
47fi
48AC_SUBST(LD)
49
50AC_C_INLINE
51if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
52 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
53fi
54
55AC_ARG_WITH(rpath,
56 [ --without-rpath Disable auto-added -R linker paths],
57 [
58 if test "x$withval" = "xno" ; then
59 need_dash_r=""
60 fi
61 if test "x$withval" = "xyes" ; then
62 need_dash_r=1
63 fi
64 ]
65)
66
67# Check for some target-specific stuff
68case "$host" in
69*-*-aix*)
70 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
71 if (test -z "$blibpath"); then
72 blibpath="/usr/lib:/lib"
73 fi
74 saved_LDFLAGS="$LDFLAGS"
75 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
76 if (test -z "$blibflags"); then
77 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
78 AC_TRY_LINK([], [], [blibflags=$tryflags])
79 fi
80 done
81 if (test -z "$blibflags"); then
82 AC_MSG_RESULT(not found)
83 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
84 else
85 AC_MSG_RESULT($blibflags)
86 fi
87 LDFLAGS="$saved_LDFLAGS"
88 dnl Check for authenticate. Might be in libs.a on older AIXes
89 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
90 [AC_CHECK_LIB(s,authenticate,
91 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
92 LIBS="$LIBS -ls"
93 ])
94 ])
95 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
96 AC_CHECK_DECL(loginfailed,
97 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
98 AC_TRY_COMPILE(
99 [#include <usersec.h>],
100 [(void)loginfailed("user","host","tty",0);],
101 [AC_MSG_RESULT(yes)
102 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
103 [AC_MSG_RESULT(no)]
104 )],
105 [],
106 [#include <usersec.h>]
107 )
108 AC_CHECK_FUNCS(setauthdb)
109 AC_DEFINE(BROKEN_GETADDRINFO)
110 AC_DEFINE(BROKEN_REALPATH)
111 AC_DEFINE(SETEUID_BREAKS_SETUID)
112 AC_DEFINE(BROKEN_SETREUID)
113 AC_DEFINE(BROKEN_SETREGID)
114 dnl AIX handles lastlog as part of its login message
115 AC_DEFINE(DISABLE_LASTLOG)
116 AC_DEFINE(LOGIN_NEEDS_UTMPX)
117 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
118 ;;
119*-*-cygwin*)
120 check_for_libcrypt_later=1
121 LIBS="$LIBS /usr/lib/textmode.o"
122 AC_DEFINE(HAVE_CYGWIN)
123 AC_DEFINE(USE_PIPES)
124 AC_DEFINE(DISABLE_SHADOW)
125 AC_DEFINE(IP_TOS_IS_BROKEN)
126 AC_DEFINE(NO_X11_UNIX_SOCKETS)
127 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
128 AC_DEFINE(DISABLE_FD_PASSING)
129 AC_DEFINE(SETGROUPS_NOOP)
130 ;;
131*-*-dgux*)
132 AC_DEFINE(IP_TOS_IS_BROKEN)
133 AC_DEFINE(SETEUID_BREAKS_SETUID)
134 AC_DEFINE(BROKEN_SETREUID)
135 AC_DEFINE(BROKEN_SETREGID)
136 ;;
137*-*-darwin*)
138 AC_MSG_CHECKING(if we have working getaddrinfo)
139 AC_TRY_RUN([#include <mach-o/dyld.h>
140main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
141 exit(0);
142 else
143 exit(1);
144}], [AC_MSG_RESULT(working)],
145 [AC_MSG_RESULT(buggy)
146 AC_DEFINE(BROKEN_GETADDRINFO)],
147 [AC_MSG_RESULT(assume it is working)])
148 AC_DEFINE(SETEUID_BREAKS_SETUID)
149 AC_DEFINE(BROKEN_SETREUID)
150 AC_DEFINE(BROKEN_SETREGID)
151 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
152 ;;
153*-*-hpux10.26)
154 if test -z "$GCC"; then
155 CFLAGS="$CFLAGS -Ae"
156 fi
157 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
158 IPADDR_IN_DISPLAY=yes
159 AC_DEFINE(HAVE_SECUREWARE)
160 AC_DEFINE(USE_PIPES)
161 AC_DEFINE(LOGIN_NO_ENDOPT)
162 AC_DEFINE(LOGIN_NEEDS_UTMPX)
163 AC_DEFINE(DISABLE_UTMP)
164 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
165 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
166 LIBS="$LIBS -lsec -lsecpw"
167 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
168 disable_ptmx_check=yes
169 ;;
170*-*-hpux10*)
171 if test -z "$GCC"; then
172 CFLAGS="$CFLAGS -Ae"
173 fi
174 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
175 IPADDR_IN_DISPLAY=yes
176 AC_DEFINE(USE_PIPES)
177 AC_DEFINE(LOGIN_NO_ENDOPT)
178 AC_DEFINE(LOGIN_NEEDS_UTMPX)
179 AC_DEFINE(DISABLE_UTMP)
180 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
181 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
182 LIBS="$LIBS -lsec"
183 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
184 ;;
185*-*-hpux11*)
186 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
187 IPADDR_IN_DISPLAY=yes
188 AC_DEFINE(PAM_SUN_CODEBASE)
189 AC_DEFINE(USE_PIPES)
190 AC_DEFINE(LOGIN_NO_ENDOPT)
191 AC_DEFINE(LOGIN_NEEDS_UTMPX)
192 AC_DEFINE(DISABLE_UTMP)
193 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
194 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
195 LIBS="$LIBS -lsec"
196 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
197 ;;
198*-*-irix5*)
199 PATH="$PATH:/usr/etc"
200 AC_DEFINE(BROKEN_INET_NTOA)
201 AC_DEFINE(SETEUID_BREAKS_SETUID)
202 AC_DEFINE(BROKEN_SETREUID)
203 AC_DEFINE(BROKEN_SETREGID)
204 AC_DEFINE(WITH_ABBREV_NO_TTY)
205 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
206 ;;
207*-*-irix6*)
208 PATH="$PATH:/usr/etc"
209 AC_DEFINE(WITH_IRIX_ARRAY)
210 AC_DEFINE(WITH_IRIX_PROJECT)
211 AC_DEFINE(WITH_IRIX_AUDIT)
212 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
213 AC_DEFINE(BROKEN_INET_NTOA)
214 AC_DEFINE(SETEUID_BREAKS_SETUID)
215 AC_DEFINE(BROKEN_SETREUID)
216 AC_DEFINE(BROKEN_SETREGID)
217 AC_DEFINE(WITH_ABBREV_NO_TTY)
218 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
219 ;;
220*-*-linux*)
221 no_dev_ptmx=1
222 check_for_libcrypt_later=1
223 check_for_openpty_ctty_bug=1
224 AC_DEFINE(DONT_TRY_OTHER_AF)
225 AC_DEFINE(PAM_TTY_KLUDGE)
226 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
227 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
228 inet6_default_4in6=yes
229 case `uname -r` in
230 1.*|2.0.*)
231 AC_DEFINE(BROKEN_CMSG_TYPE)
232 ;;
233 esac
234 ;;
235mips-sony-bsd|mips-sony-newsos4)
236 AC_DEFINE(HAVE_NEWS4)
237 SONY=1
238 ;;
239*-*-netbsd*)
240 check_for_libcrypt_before=1
241 if test "x$withval" != "xno" ; then
242 need_dash_r=1
243 fi
244 ;;
245*-*-freebsd*)
246 check_for_libcrypt_later=1
247 ;;
248*-*-bsdi*)
249 AC_DEFINE(SETEUID_BREAKS_SETUID)
250 AC_DEFINE(BROKEN_SETREUID)
251 AC_DEFINE(BROKEN_SETREGID)
252 ;;
253*-next-*)
254 conf_lastlog_location="/usr/adm/lastlog"
255 conf_utmp_location=/etc/utmp
256 conf_wtmp_location=/usr/adm/wtmp
257 MAIL=/usr/spool/mail
258 AC_DEFINE(HAVE_NEXT)
259 AC_DEFINE(BROKEN_REALPATH)
260 AC_DEFINE(USE_PIPES)
261 AC_DEFINE(BROKEN_SAVED_UIDS)
262 ;;
263*-*-solaris*)
264 AC_DEFINE(PAM_SUN_CODEBASE)
265 AC_DEFINE(LOGIN_NEEDS_UTMPX)
266 AC_DEFINE(LOGIN_NEEDS_TERM)
267 AC_DEFINE(PAM_TTY_KLUDGE)
268 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
269 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
270 AC_DEFINE(SSHD_ACQUIRES_CTTY)
271 external_path_file=/etc/default/login
272 # hardwire lastlog location (can't detect it on some versions)
273 conf_lastlog_location="/var/adm/lastlog"
274 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
275 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
276 if test "$sol2ver" -ge 8; then
277 AC_MSG_RESULT(yes)
278 AC_DEFINE(DISABLE_UTMP)
279 AC_DEFINE(DISABLE_WTMP)
280 else
281 AC_MSG_RESULT(no)
282 fi
283 ;;
284*-*-sunos4*)
285 CPPFLAGS="$CPPFLAGS -DSUNOS4"
286 AC_CHECK_FUNCS(getpwanam)
287 AC_DEFINE(PAM_SUN_CODEBASE)
288 conf_utmp_location=/etc/utmp
289 conf_wtmp_location=/var/adm/wtmp
290 conf_lastlog_location=/var/adm/lastlog
291 AC_DEFINE(USE_PIPES)
292 ;;
293*-ncr-sysv*)
294 LIBS="$LIBS -lc89"
295 AC_DEFINE(USE_PIPES)
296 AC_DEFINE(SSHD_ACQUIRES_CTTY)
297 AC_DEFINE(SETEUID_BREAKS_SETUID)
298 AC_DEFINE(BROKEN_SETREUID)
299 AC_DEFINE(BROKEN_SETREGID)
300 ;;
301*-sni-sysv*)
302 # /usr/ucblib MUST NOT be searched on ReliantUNIX
303 AC_CHECK_LIB(dl, dlsym, ,)
304 IPADDR_IN_DISPLAY=yes
305 AC_DEFINE(USE_PIPES)
306 AC_DEFINE(IP_TOS_IS_BROKEN)
307 AC_DEFINE(SETEUID_BREAKS_SETUID)
308 AC_DEFINE(BROKEN_SETREUID)
309 AC_DEFINE(BROKEN_SETREGID)
310 AC_DEFINE(SSHD_ACQUIRES_CTTY)
311 external_path_file=/etc/default/login
312 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
313 # Attention: always take care to bind libsocket and libnsl before libc,
314 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
315 ;;
316*-*-sysv4.2*)
317 AC_DEFINE(USE_PIPES)
318 AC_DEFINE(SETEUID_BREAKS_SETUID)
319 AC_DEFINE(BROKEN_SETREUID)
320 AC_DEFINE(BROKEN_SETREGID)
321 ;;
322*-*-sysv5*)
323 AC_DEFINE(USE_PIPES)
324 AC_DEFINE(SETEUID_BREAKS_SETUID)
325 AC_DEFINE(BROKEN_SETREUID)
326 AC_DEFINE(BROKEN_SETREGID)
327 ;;
328*-*-sysv*)
329 ;;
330*-*-sco3.2v4*)
331 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
332 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
333 RANLIB=true
334 no_dev_ptmx=1
335 AC_DEFINE(BROKEN_SYS_TERMIO_H)
336 AC_DEFINE(USE_PIPES)
337 AC_DEFINE(HAVE_SECUREWARE)
338 AC_DEFINE(DISABLE_SHADOW)
339 AC_DEFINE(BROKEN_SAVED_UIDS)
340 AC_DEFINE(WITH_ABBREV_NO_TTY)
341 AC_CHECK_FUNCS(getluid setluid)
342 MANTYPE=man
343 do_sco3_extra_lib_check=yes
344 ;;
345*-*-sco3.2v5*)
346 if test -z "$GCC"; then
347 CFLAGS="$CFLAGS -belf"
348 fi
349 LIBS="$LIBS -lprot -lx -ltinfo -lm"
350 no_dev_ptmx=1
351 AC_DEFINE(USE_PIPES)
352 AC_DEFINE(HAVE_SECUREWARE)
353 AC_DEFINE(DISABLE_SHADOW)
354 AC_DEFINE(DISABLE_FD_PASSING)
355 AC_DEFINE(SETEUID_BREAKS_SETUID)
356 AC_DEFINE(BROKEN_SETREUID)
357 AC_DEFINE(BROKEN_SETREGID)
358 AC_DEFINE(WITH_ABBREV_NO_TTY)
359 AC_CHECK_FUNCS(getluid setluid)
360 MANTYPE=man
361 ;;
362*-*-unicosmk*)
363 AC_DEFINE(USE_PIPES)
364 AC_DEFINE(DISABLE_FD_PASSING)
365 LDFLAGS="$LDFLAGS"
366 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
367 MANTYPE=cat
368 ;;
369*-*-unicosmp*)
370 AC_DEFINE(WITH_ABBREV_NO_TTY)
371 AC_DEFINE(USE_PIPES)
372 AC_DEFINE(DISABLE_FD_PASSING)
373 LDFLAGS="$LDFLAGS"
374 LIBS="$LIBS -lgen -lacid"
375 MANTYPE=cat
376 ;;
377*-*-unicos*)
378 AC_DEFINE(USE_PIPES)
379 AC_DEFINE(DISABLE_FD_PASSING)
380 AC_DEFINE(NO_SSH_LASTLOG)
381 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
382 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
383 MANTYPE=cat
384 ;;
385*-dec-osf*)
386 AC_MSG_CHECKING(for Digital Unix SIA)
387 no_osfsia=""
388 AC_ARG_WITH(osfsia,
389 [ --with-osfsia Enable Digital Unix SIA],
390 [
391 if test "x$withval" = "xno" ; then
392 AC_MSG_RESULT(disabled)
393 no_osfsia=1
394 fi
395 ],
396 )
397 if test -z "$no_osfsia" ; then
398 if test -f /etc/sia/matrix.conf; then
399 AC_MSG_RESULT(yes)
400 AC_DEFINE(HAVE_OSF_SIA)
401 AC_DEFINE(DISABLE_LOGIN)
402 AC_DEFINE(DISABLE_FD_PASSING)
403 LIBS="$LIBS -lsecurity -ldb -lm -laud"
404 else
405 AC_MSG_RESULT(no)
406 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
407 fi
408 fi
409 AC_DEFINE(BROKEN_GETADDRINFO)
410 AC_DEFINE(SETEUID_BREAKS_SETUID)
411 AC_DEFINE(BROKEN_SETREUID)
412 AC_DEFINE(BROKEN_SETREGID)
413 ;;
414
415*-*-nto-qnx)
416 AC_DEFINE(USE_PIPES)
417 AC_DEFINE(NO_X11_UNIX_SOCKETS)
418 AC_DEFINE(MISSING_NFDBITS)
419 AC_DEFINE(MISSING_HOWMANY)
420 AC_DEFINE(MISSING_FD_MASK)
421 ;;
422esac
423
424# Allow user to specify flags
425AC_ARG_WITH(cflags,
426 [ --with-cflags Specify additional flags to pass to compiler],
427 [
428 if test "x$withval" != "xno" ; then
429 CFLAGS="$CFLAGS $withval"
430 fi
431 ]
432)
433AC_ARG_WITH(cppflags,
434 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
435 [
436 if test "x$withval" != "xno"; then
437 CPPFLAGS="$CPPFLAGS $withval"
438 fi
439 ]
440)
441AC_ARG_WITH(ldflags,
442 [ --with-ldflags Specify additional flags to pass to linker],
443 [
444 if test "x$withval" != "xno" ; then
445 LDFLAGS="$LDFLAGS $withval"
446 fi
447 ]
448)
449AC_ARG_WITH(libs,
450 [ --with-libs Specify additional libraries to link with],
451 [
452 if test "x$withval" != "xno" ; then
453 LIBS="$LIBS $withval"
454 fi
455 ]
456)
457
458AC_MSG_CHECKING(compiler and flags for sanity)
459AC_TRY_RUN([
460#include <stdio.h>
461int main(){exit(0);}
462 ],
463 [ AC_MSG_RESULT(yes) ],
464 [
465 AC_MSG_RESULT(no)
466 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
467 ]
468)
469
470# Checks for header files.
471AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
472 getopt.h glob.h ia.h lastlog.h limits.h login.h \
473 login_cap.h maillock.h netdb.h netgroup.h \
474 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
475 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
476 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
477 sys/cdefs.h sys/mman.h sys/pstat.h sys/ptms.h sys/select.h sys/stat.h \
478 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
479 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
480 util.h utime.h utmp.h utmpx.h vis.h)
481
482# Checks for libraries.
483AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
484AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
485
486dnl SCO OS3 needs this for libwrap
487if test "x$with_tcp_wrappers" != "xno" ; then
488 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
489 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
490 fi
491fi
492
493dnl IRIX and Solaris 2.5.1 have dirname() in libgen
494AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
495 AC_CHECK_LIB(gen, dirname,[
496 AC_CACHE_CHECK([for broken dirname],
497 ac_cv_have_broken_dirname, [
498 save_LIBS="$LIBS"
499 LIBS="$LIBS -lgen"
500 AC_TRY_RUN(
501 [
502#include <libgen.h>
503#include <string.h>
504
505int main(int argc, char **argv) {
506 char *s, buf[32];
507
508 strncpy(buf,"/etc", 32);
509 s = dirname(buf);
510 if (!s || strncmp(s, "/", 32) != 0) {
511 exit(1);
512 } else {
513 exit(0);
514 }
515}
516 ],
517 [ ac_cv_have_broken_dirname="no" ],
518 [ ac_cv_have_broken_dirname="yes" ]
519 )
520 LIBS="$save_LIBS"
521 ])
522 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
523 LIBS="$LIBS -lgen"
524 AC_DEFINE(HAVE_DIRNAME)
525 AC_CHECK_HEADERS(libgen.h)
526 fi
527 ])
528])
529
530AC_CHECK_FUNC(getspnam, ,
531 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
532AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
533
534dnl zlib is required
535AC_ARG_WITH(zlib,
536 [ --with-zlib=PATH Use zlib in PATH],
537 [
538 if test "x$withval" = "xno" ; then
539 AC_MSG_ERROR([*** zlib is required ***])
540 fi
541 if test -d "$withval/lib"; then
542 if test -n "${need_dash_r}"; then
543 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
544 else
545 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
546 fi
547 else
548 if test -n "${need_dash_r}"; then
549 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
550 else
551 LDFLAGS="-L${withval} ${LDFLAGS}"
552 fi
553 fi
554 if test -d "$withval/include"; then
555 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
556 else
557 CPPFLAGS="-I${withval} ${CPPFLAGS}"
558 fi
559 ]
560)
561
562AC_CHECK_LIB(z, deflate, ,
563 [
564 saved_CPPFLAGS="$CPPFLAGS"
565 saved_LDFLAGS="$LDFLAGS"
566 save_LIBS="$LIBS"
567 dnl Check default zlib install dir
568 if test -n "${need_dash_r}"; then
569 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
570 else
571 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
572 fi
573 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
574 LIBS="$LIBS -lz"
575 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
576 [
577 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
578 ]
579 )
580 ]
581)
582AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
583
584AC_ARG_WITH(zlib-version-check,
585 [ --without-zlib-version-check Disable zlib version check],
586 [ if test "x$withval" = "xno" ; then
587 zlib_check_nonfatal=1
588 fi
589 ]
590)
591
592AC_MSG_CHECKING(for zlib 1.1.4 or greater)
593AC_TRY_RUN([
594#include <zlib.h>
595int main()
596{
597 int a, b, c, v;
598 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
599 exit(1);
600 v = a*1000000 + b*1000 + c;
601 if (v >= 1001004)
602 exit(0);
603 exit(2);
604}
605 ],
606 AC_MSG_RESULT(yes),
607 [ AC_MSG_RESULT(no)
608 if test -z "$zlib_check_nonfatal" ; then
609 AC_MSG_ERROR([*** zlib too old - check config.log ***
610Your reported zlib version has known security problems. It's possible your
611vendor has fixed these problems without changing the version number. If you
612are sure this is the case, you can disable the check by running
613"./configure --without-zlib-version-check".
614If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
615 else
616 AC_MSG_WARN([zlib version may have security problems])
617 fi
618 ]
619)
620
621dnl UnixWare 2.x
622AC_CHECK_FUNC(strcasecmp,
623 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
624)
625AC_CHECK_FUNC(utimes,
626 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
627 LIBS="$LIBS -lc89"]) ]
628)
629
630dnl Checks for libutil functions
631AC_CHECK_HEADERS(libutil.h)
632AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
633AC_CHECK_FUNCS(logout updwtmp logwtmp)
634
635AC_FUNC_STRFTIME
636
637# Check for ALTDIRFUNC glob() extension
638AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
639AC_EGREP_CPP(FOUNDIT,
640 [
641 #include <glob.h>
642 #ifdef GLOB_ALTDIRFUNC
643 FOUNDIT
644 #endif
645 ],
646 [
647 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
648 AC_MSG_RESULT(yes)
649 ],
650 [
651 AC_MSG_RESULT(no)
652 ]
653)
654
655# Check for g.gl_matchc glob() extension
656AC_MSG_CHECKING(for gl_matchc field in glob_t)
657AC_EGREP_CPP(FOUNDIT,
658 [
659 #include <glob.h>
660 int main(void){glob_t g; g.gl_matchc = 1;}
661 ],
662 [
663 AC_DEFINE(GLOB_HAS_GL_MATCHC)
664 AC_MSG_RESULT(yes)
665 ],
666 [
667 AC_MSG_RESULT(no)
668 ]
669)
670
671AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
672AC_TRY_RUN(
673 [
674#include <sys/types.h>
675#include <dirent.h>
676int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
677 ],
678 [AC_MSG_RESULT(yes)],
679 [
680 AC_MSG_RESULT(no)
681 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
682 ]
683)
684
685# Check whether user wants S/Key support
686SKEY_MSG="no"
687AC_ARG_WITH(skey,
688 [ --with-skey[[=PATH]] Enable S/Key support
689 (optionally in PATH)],
690 [
691 if test "x$withval" != "xno" ; then
692
693 if test "x$withval" != "xyes" ; then
694 CPPFLAGS="$CPPFLAGS -I${withval}/include"
695 LDFLAGS="$LDFLAGS -L${withval}/lib"
696 fi
697
698 AC_DEFINE(SKEY)
699 LIBS="-lskey $LIBS"
700 SKEY_MSG="yes"
701
702 AC_MSG_CHECKING([for s/key support])
703 AC_TRY_RUN(
704 [
705#include <stdio.h>
706#include <skey.h>
707int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
708 ],
709 [AC_MSG_RESULT(yes)],
710 [
711 AC_MSG_RESULT(no)
712 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
713 ])
714 fi
715 ]
716)
717
718# Check whether user wants TCP wrappers support
719TCPW_MSG="no"
720AC_ARG_WITH(tcp-wrappers,
721 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
722 (optionally in PATH)],
723 [
724 if test "x$withval" != "xno" ; then
725 saved_LIBS="$LIBS"
726 saved_LDFLAGS="$LDFLAGS"
727 saved_CPPFLAGS="$CPPFLAGS"
728 if test -n "${withval}" -a "${withval}" != "yes"; then
729 if test -d "${withval}/lib"; then
730 if test -n "${need_dash_r}"; then
731 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
732 else
733 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
734 fi
735 else
736 if test -n "${need_dash_r}"; then
737 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
738 else
739 LDFLAGS="-L${withval} ${LDFLAGS}"
740 fi
741 fi
742 if test -d "${withval}/include"; then
743 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
744 else
745 CPPFLAGS="-I${withval} ${CPPFLAGS}"
746 fi
747 fi
748 LIBWRAP="-lwrap"
749 LIBS="$LIBWRAP $LIBS"
750 AC_MSG_CHECKING(for libwrap)
751 AC_TRY_LINK(
752 [
753#include <tcpd.h>
754 int deny_severity = 0, allow_severity = 0;
755 ],
756 [hosts_access(0);],
757 [
758 AC_MSG_RESULT(yes)
759 AC_DEFINE(LIBWRAP)
760 AC_SUBST(LIBWRAP)
761 TCPW_MSG="yes"
762 ],
763 [
764 AC_MSG_ERROR([*** libwrap missing])
765 ]
766 )
767 LIBS="$saved_LIBS"
768 fi
769 ]
770)
771
772dnl Checks for library functions. Please keep in alphabetical order
773AC_CHECK_FUNCS(\
774 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
775 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
776 getaddrinfo getcwd getgrouplist getnameinfo getopt \
777 getpeereid _getpty getrlimit getttyent glob inet_aton \
778 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
779 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
780 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
781 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
782 setproctitle setregid setreuid setrlimit \
783 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
784 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
785 truncate utimes vhangup vsnprintf waitpid \
786)
787
788# IRIX has a const char return value for gai_strerror()
789AC_CHECK_FUNCS(gai_strerror,[
790 AC_DEFINE(HAVE_GAI_STRERROR)
791 AC_TRY_COMPILE([
792#include <sys/types.h>
793#include <sys/socket.h>
794#include <netdb.h>
795
796const char *gai_strerror(int);],[
797char *str;
798
799str = gai_strerror(0);],[
800 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
801 [Define if gai_strerror() returns const char *])])])
802
803AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
804
805dnl Make sure prototypes are defined for these before using them.
806AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
807AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
808
809dnl tcsendbreak might be a macro
810AC_CHECK_DECL(tcsendbreak,
811 [AC_DEFINE(HAVE_TCSENDBREAK)],
812 [AC_CHECK_FUNCS(tcsendbreak)],
813 [#include <termios.h>]
814)
815
816AC_CHECK_FUNCS(setresuid, [
817 dnl Some platorms have setresuid that isn't implemented, test for this
818 AC_MSG_CHECKING(if setresuid seems to work)
819 AC_TRY_RUN([
820#include <stdlib.h>
821#include <errno.h>
822int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
823 ],
824 [AC_MSG_RESULT(yes)],
825 [AC_DEFINE(BROKEN_SETRESUID)
826 AC_MSG_RESULT(not implemented)]
827 )
828])
829
830AC_CHECK_FUNCS(setresgid, [
831 dnl Some platorms have setresgid that isn't implemented, test for this
832 AC_MSG_CHECKING(if setresgid seems to work)
833 AC_TRY_RUN([
834#include <stdlib.h>
835#include <errno.h>
836int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
837 ],
838 [AC_MSG_RESULT(yes)],
839 [AC_DEFINE(BROKEN_SETRESGID)
840 AC_MSG_RESULT(not implemented)]
841 )
842])
843
844dnl Checks for time functions
845AC_CHECK_FUNCS(gettimeofday time)
846dnl Checks for utmp functions
847AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
848AC_CHECK_FUNCS(utmpname)
849dnl Checks for utmpx functions
850AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
851AC_CHECK_FUNCS(setutxent utmpxname)
852
853AC_CHECK_FUNC(daemon,
854 [AC_DEFINE(HAVE_DAEMON)],
855 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
856)
857
858AC_CHECK_FUNC(getpagesize,
859 [AC_DEFINE(HAVE_GETPAGESIZE)],
860 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
861)
862
863# Check for broken snprintf
864if test "x$ac_cv_func_snprintf" = "xyes" ; then
865 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
866 AC_TRY_RUN(
867 [
868#include <stdio.h>
869int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
870 ],
871 [AC_MSG_RESULT(yes)],
872 [
873 AC_MSG_RESULT(no)
874 AC_DEFINE(BROKEN_SNPRINTF)
875 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
876 ]
877 )
878fi
879
880dnl see whether mkstemp() requires XXXXXX
881if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
882AC_MSG_CHECKING([for (overly) strict mkstemp])
883AC_TRY_RUN(
884 [
885#include <stdlib.h>
886main() { char template[]="conftest.mkstemp-test";
887if (mkstemp(template) == -1)
888 exit(1);
889unlink(template); exit(0);
890}
891 ],
892 [
893 AC_MSG_RESULT(no)
894 ],
895 [
896 AC_MSG_RESULT(yes)
897 AC_DEFINE(HAVE_STRICT_MKSTEMP)
898 ],
899 [
900 AC_MSG_RESULT(yes)
901 AC_DEFINE(HAVE_STRICT_MKSTEMP)
902 ]
903)
904fi
905
906dnl make sure that openpty does not reacquire controlling terminal
907if test ! -z "$check_for_openpty_ctty_bug"; then
908 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
909 AC_TRY_RUN(
910 [
911#include <stdio.h>
912#include <sys/fcntl.h>
913#include <sys/types.h>
914#include <sys/wait.h>
915
916int
917main()
918{
919 pid_t pid;
920 int fd, ptyfd, ttyfd, status;
921
922 pid = fork();
923 if (pid < 0) { /* failed */
924 exit(1);
925 } else if (pid > 0) { /* parent */
926 waitpid(pid, &status, 0);
927 if (WIFEXITED(status))
928 exit(WEXITSTATUS(status));
929 else
930 exit(2);
931 } else { /* child */
932 close(0); close(1); close(2);
933 setsid();
934 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
935 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
936 if (fd >= 0)
937 exit(3); /* Acquired ctty: broken */
938 else
939 exit(0); /* Did not acquire ctty: OK */
940 }
941}
942 ],
943 [
944 AC_MSG_RESULT(yes)
945 ],
946 [
947 AC_MSG_RESULT(no)
948 AC_DEFINE(SSHD_ACQUIRES_CTTY)
949 ]
950 )
951fi
952
953AC_FUNC_GETPGRP
954
955# Check for PAM libs
956PAM_MSG="no"
957AC_ARG_WITH(pam,
958 [ --with-pam Enable PAM support ],
959 [
960 if test "x$withval" != "xno" ; then
961 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
962 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
963 AC_MSG_ERROR([PAM headers not found])
964 fi
965
966 AC_CHECK_LIB(dl, dlopen, , )
967 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
968 AC_CHECK_FUNCS(pam_getenvlist)
969 AC_CHECK_FUNCS(pam_putenv)
970
971 PAM_MSG="yes"
972
973 AC_DEFINE(USE_PAM)
974 if test $ac_cv_lib_dl_dlopen = yes; then
975 LIBPAM="-lpam -ldl"
976 else
977 LIBPAM="-lpam"
978 fi
979 AC_SUBST(LIBPAM)
980 fi
981 ]
982)
983
984# Check for older PAM
985if test "x$PAM_MSG" = "xyes" ; then
986 # Check PAM strerror arguments (old PAM)
987 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
988 AC_TRY_COMPILE(
989 [
990#include <stdlib.h>
991#if defined(HAVE_SECURITY_PAM_APPL_H)
992#include <security/pam_appl.h>
993#elif defined (HAVE_PAM_PAM_APPL_H)
994#include <pam/pam_appl.h>
995#endif
996 ],
997 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
998 [AC_MSG_RESULT(no)],
999 [
1000 AC_DEFINE(HAVE_OLD_PAM)
1001 AC_MSG_RESULT(yes)
1002 PAM_MSG="yes (old library)"
1003 ]
1004 )
1005fi
1006
1007# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1008# because the system crypt() is more featureful.
1009if test "x$check_for_libcrypt_before" = "x1"; then
1010 AC_CHECK_LIB(crypt, crypt)
1011fi
1012
1013# Search for OpenSSL
1014saved_CPPFLAGS="$CPPFLAGS"
1015saved_LDFLAGS="$LDFLAGS"
1016AC_ARG_WITH(ssl-dir,
1017 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1018 [
1019 if test "x$withval" != "xno" ; then
1020 if test -d "$withval/lib"; then
1021 if test -n "${need_dash_r}"; then
1022 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1023 else
1024 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1025 fi
1026 else
1027 if test -n "${need_dash_r}"; then
1028 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1029 else
1030 LDFLAGS="-L${withval} ${LDFLAGS}"
1031 fi
1032 fi
1033 if test -d "$withval/include"; then
1034 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1035 else
1036 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1037 fi
1038 fi
1039 ]
1040)
1041LIBS="$LIBS -lcrypto"
1042AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1043 [
1044 dnl Check default openssl install dir
1045 if test -n "${need_dash_r}"; then
1046 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1047 else
1048 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1049 fi
1050 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1051 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1052 [
1053 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1054 ]
1055 )
1056 ]
1057)
1058
1059# Determine OpenSSL header version
1060AC_MSG_CHECKING([OpenSSL header version])
1061AC_TRY_RUN(
1062 [
1063#include <stdio.h>
1064#include <string.h>
1065#include <openssl/opensslv.h>
1066#define DATA "conftest.sslincver"
1067int main(void) {
1068 FILE *fd;
1069 int rc;
1070
1071 fd = fopen(DATA,"w");
1072 if(fd == NULL)
1073 exit(1);
1074
1075 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1076 exit(1);
1077
1078 exit(0);
1079}
1080 ],
1081 [
1082 ssl_header_ver=`cat conftest.sslincver`
1083 AC_MSG_RESULT($ssl_header_ver)
1084 ],
1085 [
1086 AC_MSG_RESULT(not found)
1087 AC_MSG_ERROR(OpenSSL version header not found.)
1088 ]
1089)
1090
1091# Determine OpenSSL library version
1092AC_MSG_CHECKING([OpenSSL library version])
1093AC_TRY_RUN(
1094 [
1095#include <stdio.h>
1096#include <string.h>
1097#include <openssl/opensslv.h>
1098#include <openssl/crypto.h>
1099#define DATA "conftest.ssllibver"
1100int main(void) {
1101 FILE *fd;
1102 int rc;
1103
1104 fd = fopen(DATA,"w");
1105 if(fd == NULL)
1106 exit(1);
1107
1108 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1109 exit(1);
1110
1111 exit(0);
1112}
1113 ],
1114 [
1115 ssl_library_ver=`cat conftest.ssllibver`
1116 AC_MSG_RESULT($ssl_library_ver)
1117 ],
1118 [
1119 AC_MSG_RESULT(not found)
1120 AC_MSG_ERROR(OpenSSL library not found.)
1121 ]
1122)
1123
1124# Sanity check OpenSSL headers
1125AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1126AC_TRY_RUN(
1127 [
1128#include <string.h>
1129#include <openssl/opensslv.h>
1130int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1131 ],
1132 [
1133 AC_MSG_RESULT(yes)
1134 ],
1135 [
1136 AC_MSG_RESULT(no)
1137 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1138Check config.log for details.
1139Also see contrib/findssl.sh for help identifying header/library mismatches.])
1140 ]
1141)
1142
1143# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1144# version in OpenSSL. Skip this for PAM
1145if test "x$check_for_libcrypt_later" = "x1"; then
1146 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1147fi
1148
1149
1150### Configure cryptographic random number support
1151
1152# Check wheter OpenSSL seeds itself
1153AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1154AC_TRY_RUN(
1155 [
1156#include <string.h>
1157#include <openssl/rand.h>
1158int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1159 ],
1160 [
1161 OPENSSL_SEEDS_ITSELF=yes
1162 AC_MSG_RESULT(yes)
1163 ],
1164 [
1165 AC_MSG_RESULT(no)
1166 # Default to use of the rand helper if OpenSSL doesn't
1167 # seed itself
1168 USE_RAND_HELPER=yes
1169 ]
1170)
1171
1172
1173# Do we want to force the use of the rand helper?
1174AC_ARG_WITH(rand-helper,
1175 [ --with-rand-helper Use subprocess to gather strong randomness ],
1176 [
1177 if test "x$withval" = "xno" ; then
1178 # Force use of OpenSSL's internal RNG, even if
1179 # the previous test showed it to be unseeded.
1180 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1181 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1182 OPENSSL_SEEDS_ITSELF=yes
1183 USE_RAND_HELPER=""
1184 fi
1185 else
1186 USE_RAND_HELPER=yes
1187 fi
1188 ],
1189)
1190
1191# Which randomness source do we use?
1192if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1193 # OpenSSL only
1194 AC_DEFINE(OPENSSL_PRNG_ONLY)
1195 RAND_MSG="OpenSSL internal ONLY"
1196 INSTALL_SSH_RAND_HELPER=""
1197elif test ! -z "$USE_RAND_HELPER" ; then
1198 # install rand helper
1199 RAND_MSG="ssh-rand-helper"
1200 INSTALL_SSH_RAND_HELPER="yes"
1201fi
1202AC_SUBST(INSTALL_SSH_RAND_HELPER)
1203
1204### Configuration of ssh-rand-helper
1205
1206# PRNGD TCP socket
1207AC_ARG_WITH(prngd-port,
1208 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1209 [
1210 case "$withval" in
1211 no)
1212 withval=""
1213 ;;
1214 [[0-9]]*)
1215 ;;
1216 *)
1217 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1218 ;;
1219 esac
1220 if test ! -z "$withval" ; then
1221 PRNGD_PORT="$withval"
1222 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1223 fi
1224 ]
1225)
1226
1227# PRNGD Unix domain socket
1228AC_ARG_WITH(prngd-socket,
1229 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1230 [
1231 case "$withval" in
1232 yes)
1233 withval="/var/run/egd-pool"
1234 ;;
1235 no)
1236 withval=""
1237 ;;
1238 /*)
1239 ;;
1240 *)
1241 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1242 ;;
1243 esac
1244
1245 if test ! -z "$withval" ; then
1246 if test ! -z "$PRNGD_PORT" ; then
1247 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1248 fi
1249 if test ! -r "$withval" ; then
1250 AC_MSG_WARN(Entropy socket is not readable)
1251 fi
1252 PRNGD_SOCKET="$withval"
1253 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1254 fi
1255 ],
1256 [
1257 # Check for existing socket only if we don't have a random device already
1258 if test "$USE_RAND_HELPER" = yes ; then
1259 AC_MSG_CHECKING(for PRNGD/EGD socket)
1260 # Insert other locations here
1261 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1262 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1263 PRNGD_SOCKET="$sock"
1264 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1265 break;
1266 fi
1267 done
1268 if test ! -z "$PRNGD_SOCKET" ; then
1269 AC_MSG_RESULT($PRNGD_SOCKET)
1270 else
1271 AC_MSG_RESULT(not found)
1272 fi
1273 fi
1274 ]
1275)
1276
1277# Change default command timeout for hashing entropy source
1278entropy_timeout=200
1279AC_ARG_WITH(entropy-timeout,
1280 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1281 [
1282 if test "x$withval" != "xno" ; then
1283 entropy_timeout=$withval
1284 fi
1285 ]
1286)
1287AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1288
1289SSH_PRIVSEP_USER=sshd
1290AC_ARG_WITH(privsep-user,
1291 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1292 [
1293 if test -n "$withval"; then
1294 SSH_PRIVSEP_USER=$withval
1295 fi
1296 ]
1297)
1298AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1299AC_SUBST(SSH_PRIVSEP_USER)
1300
1301# We do this little dance with the search path to insure
1302# that programs that we select for use by installed programs
1303# (which may be run by the super-user) come from trusted
1304# locations before they come from the user's private area.
1305# This should help avoid accidentally configuring some
1306# random version of a program in someone's personal bin.
1307
1308OPATH=$PATH
1309PATH=/bin:/usr/bin
1310test -h /bin 2> /dev/null && PATH=/usr/bin
1311test -d /sbin && PATH=$PATH:/sbin
1312test -d /usr/sbin && PATH=$PATH:/usr/sbin
1313PATH=$PATH:/etc:$OPATH
1314
1315# These programs are used by the command hashing source to gather entropy
1316OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1317OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1318OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1319OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1320OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1321OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1322OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1323OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1324OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1325OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1326OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1327OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1328OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1329OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1330OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1331OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1332# restore PATH
1333PATH=$OPATH
1334
1335# Where does ssh-rand-helper get its randomness from?
1336INSTALL_SSH_PRNG_CMDS=""
1337if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1338 if test ! -z "$PRNGD_PORT" ; then
1339 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1340 elif test ! -z "$PRNGD_SOCKET" ; then
1341 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1342 else
1343 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1344 RAND_HELPER_CMDHASH=yes
1345 INSTALL_SSH_PRNG_CMDS="yes"
1346 fi
1347fi
1348AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1349
1350
1351# Cheap hack to ensure NEWS-OS libraries are arranged right.
1352if test ! -z "$SONY" ; then
1353 LIBS="$LIBS -liberty";
1354fi
1355
1356# Checks for data types
1357AC_CHECK_SIZEOF(char, 1)
1358AC_CHECK_SIZEOF(short int, 2)
1359AC_CHECK_SIZEOF(int, 4)
1360AC_CHECK_SIZEOF(long int, 4)
1361AC_CHECK_SIZEOF(long long int, 8)
1362
1363# Sanity check long long for some platforms (AIX)
1364if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1365 ac_cv_sizeof_long_long_int=0
1366fi
1367
1368# More checks for data types
1369AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1370 AC_TRY_COMPILE(
1371 [ #include <sys/types.h> ],
1372 [ u_int a; a = 1;],
1373 [ ac_cv_have_u_int="yes" ],
1374 [ ac_cv_have_u_int="no" ]
1375 )
1376])
1377if test "x$ac_cv_have_u_int" = "xyes" ; then
1378 AC_DEFINE(HAVE_U_INT)
1379 have_u_int=1
1380fi
1381
1382AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1383 AC_TRY_COMPILE(
1384 [ #include <sys/types.h> ],
1385 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1386 [ ac_cv_have_intxx_t="yes" ],
1387 [ ac_cv_have_intxx_t="no" ]
1388 )
1389])
1390if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1391 AC_DEFINE(HAVE_INTXX_T)
1392 have_intxx_t=1
1393fi
1394
1395if (test -z "$have_intxx_t" && \
1396 test "x$ac_cv_header_stdint_h" = "xyes")
1397then
1398 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1399 AC_TRY_COMPILE(
1400 [ #include <stdint.h> ],
1401 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1402 [
1403 AC_DEFINE(HAVE_INTXX_T)
1404 AC_MSG_RESULT(yes)
1405 ],
1406 [ AC_MSG_RESULT(no) ]
1407 )
1408fi
1409
1410AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1411 AC_TRY_COMPILE(
1412 [
1413#include <sys/types.h>
1414#ifdef HAVE_STDINT_H
1415# include <stdint.h>
1416#endif
1417#include <sys/socket.h>
1418#ifdef HAVE_SYS_BITYPES_H
1419# include <sys/bitypes.h>
1420#endif
1421 ],
1422 [ int64_t a; a = 1;],
1423 [ ac_cv_have_int64_t="yes" ],
1424 [ ac_cv_have_int64_t="no" ]
1425 )
1426])
1427if test "x$ac_cv_have_int64_t" = "xyes" ; then
1428 AC_DEFINE(HAVE_INT64_T)
1429fi
1430
1431AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1432 AC_TRY_COMPILE(
1433 [ #include <sys/types.h> ],
1434 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1435 [ ac_cv_have_u_intxx_t="yes" ],
1436 [ ac_cv_have_u_intxx_t="no" ]
1437 )
1438])
1439if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1440 AC_DEFINE(HAVE_U_INTXX_T)
1441 have_u_intxx_t=1
1442fi
1443
1444if test -z "$have_u_intxx_t" ; then
1445 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1446 AC_TRY_COMPILE(
1447 [ #include <sys/socket.h> ],
1448 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1449 [
1450 AC_DEFINE(HAVE_U_INTXX_T)
1451 AC_MSG_RESULT(yes)
1452 ],
1453 [ AC_MSG_RESULT(no) ]
1454 )
1455fi
1456
1457AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1458 AC_TRY_COMPILE(
1459 [ #include <sys/types.h> ],
1460 [ u_int64_t a; a = 1;],
1461 [ ac_cv_have_u_int64_t="yes" ],
1462 [ ac_cv_have_u_int64_t="no" ]
1463 )
1464])
1465if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1466 AC_DEFINE(HAVE_U_INT64_T)
1467 have_u_int64_t=1
1468fi
1469
1470if test -z "$have_u_int64_t" ; then
1471 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1472 AC_TRY_COMPILE(
1473 [ #include <sys/bitypes.h> ],
1474 [ u_int64_t a; a = 1],
1475 [
1476 AC_DEFINE(HAVE_U_INT64_T)
1477 AC_MSG_RESULT(yes)
1478 ],
1479 [ AC_MSG_RESULT(no) ]
1480 )
1481fi
1482
1483if test -z "$have_u_intxx_t" ; then
1484 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1485 AC_TRY_COMPILE(
1486 [
1487#include <sys/types.h>
1488 ],
1489 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1490 [ ac_cv_have_uintxx_t="yes" ],
1491 [ ac_cv_have_uintxx_t="no" ]
1492 )
1493 ])
1494 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1495 AC_DEFINE(HAVE_UINTXX_T)
1496 fi
1497fi
1498
1499if test -z "$have_uintxx_t" ; then
1500 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1501 AC_TRY_COMPILE(
1502 [ #include <stdint.h> ],
1503 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1504 [
1505 AC_DEFINE(HAVE_UINTXX_T)
1506 AC_MSG_RESULT(yes)
1507 ],
1508 [ AC_MSG_RESULT(no) ]
1509 )
1510fi
1511
1512if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1513 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1514then
1515 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1516 AC_TRY_COMPILE(
1517 [
1518#include <sys/bitypes.h>
1519 ],
1520 [
1521 int8_t a; int16_t b; int32_t c;
1522 u_int8_t e; u_int16_t f; u_int32_t g;
1523 a = b = c = e = f = g = 1;
1524 ],
1525 [
1526 AC_DEFINE(HAVE_U_INTXX_T)
1527 AC_DEFINE(HAVE_INTXX_T)
1528 AC_MSG_RESULT(yes)
1529 ],
1530 [AC_MSG_RESULT(no)]
1531 )
1532fi
1533
1534
1535AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1536 AC_TRY_COMPILE(
1537 [
1538#include <sys/types.h>
1539 ],
1540 [ u_char foo; foo = 125; ],
1541 [ ac_cv_have_u_char="yes" ],
1542 [ ac_cv_have_u_char="no" ]
1543 )
1544])
1545if test "x$ac_cv_have_u_char" = "xyes" ; then
1546 AC_DEFINE(HAVE_U_CHAR)
1547fi
1548
1549TYPE_SOCKLEN_T
1550
1551AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1552
1553AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1554 AC_TRY_COMPILE(
1555 [
1556#include <sys/types.h>
1557 ],
1558 [ size_t foo; foo = 1235; ],
1559 [ ac_cv_have_size_t="yes" ],
1560 [ ac_cv_have_size_t="no" ]
1561 )
1562])
1563if test "x$ac_cv_have_size_t" = "xyes" ; then
1564 AC_DEFINE(HAVE_SIZE_T)
1565fi
1566
1567AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1568 AC_TRY_COMPILE(
1569 [
1570#include <sys/types.h>
1571 ],
1572 [ ssize_t foo; foo = 1235; ],
1573 [ ac_cv_have_ssize_t="yes" ],
1574 [ ac_cv_have_ssize_t="no" ]
1575 )
1576])
1577if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1578 AC_DEFINE(HAVE_SSIZE_T)
1579fi
1580
1581AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1582 AC_TRY_COMPILE(
1583 [
1584#include <time.h>
1585 ],
1586 [ clock_t foo; foo = 1235; ],
1587 [ ac_cv_have_clock_t="yes" ],
1588 [ ac_cv_have_clock_t="no" ]
1589 )
1590])
1591if test "x$ac_cv_have_clock_t" = "xyes" ; then
1592 AC_DEFINE(HAVE_CLOCK_T)
1593fi
1594
1595AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1596 AC_TRY_COMPILE(
1597 [
1598#include <sys/types.h>
1599#include <sys/socket.h>
1600 ],
1601 [ sa_family_t foo; foo = 1235; ],
1602 [ ac_cv_have_sa_family_t="yes" ],
1603 [ AC_TRY_COMPILE(
1604 [
1605#include <sys/types.h>
1606#include <sys/socket.h>
1607#include <netinet/in.h>
1608 ],
1609 [ sa_family_t foo; foo = 1235; ],
1610 [ ac_cv_have_sa_family_t="yes" ],
1611
1612 [ ac_cv_have_sa_family_t="no" ]
1613 )]
1614 )
1615])
1616if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1617 AC_DEFINE(HAVE_SA_FAMILY_T)
1618fi
1619
1620AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1621 AC_TRY_COMPILE(
1622 [
1623#include <sys/types.h>
1624 ],
1625 [ pid_t foo; foo = 1235; ],
1626 [ ac_cv_have_pid_t="yes" ],
1627 [ ac_cv_have_pid_t="no" ]
1628 )
1629])
1630if test "x$ac_cv_have_pid_t" = "xyes" ; then
1631 AC_DEFINE(HAVE_PID_T)
1632fi
1633
1634AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1635 AC_TRY_COMPILE(
1636 [
1637#include <sys/types.h>
1638 ],
1639 [ mode_t foo; foo = 1235; ],
1640 [ ac_cv_have_mode_t="yes" ],
1641 [ ac_cv_have_mode_t="no" ]
1642 )
1643])
1644if test "x$ac_cv_have_mode_t" = "xyes" ; then
1645 AC_DEFINE(HAVE_MODE_T)
1646fi
1647
1648
1649AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1650 AC_TRY_COMPILE(
1651 [
1652#include <sys/types.h>
1653#include <sys/socket.h>
1654 ],
1655 [ struct sockaddr_storage s; ],
1656 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1657 [ ac_cv_have_struct_sockaddr_storage="no" ]
1658 )
1659])
1660if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1661 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1662fi
1663
1664AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1665 AC_TRY_COMPILE(
1666 [
1667#include <sys/types.h>
1668#include <netinet/in.h>
1669 ],
1670 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1671 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1672 [ ac_cv_have_struct_sockaddr_in6="no" ]
1673 )
1674])
1675if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1676 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1677fi
1678
1679AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1680 AC_TRY_COMPILE(
1681 [
1682#include <sys/types.h>
1683#include <netinet/in.h>
1684 ],
1685 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1686 [ ac_cv_have_struct_in6_addr="yes" ],
1687 [ ac_cv_have_struct_in6_addr="no" ]
1688 )
1689])
1690if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1691 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1692fi
1693
1694AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1695 AC_TRY_COMPILE(
1696 [
1697#include <sys/types.h>
1698#include <sys/socket.h>
1699#include <netdb.h>
1700 ],
1701 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1702 [ ac_cv_have_struct_addrinfo="yes" ],
1703 [ ac_cv_have_struct_addrinfo="no" ]
1704 )
1705])
1706if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1707 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1708fi
1709
1710AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1711 AC_TRY_COMPILE(
1712 [ #include <sys/time.h> ],
1713 [ struct timeval tv; tv.tv_sec = 1;],
1714 [ ac_cv_have_struct_timeval="yes" ],
1715 [ ac_cv_have_struct_timeval="no" ]
1716 )
1717])
1718if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1719 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1720 have_struct_timeval=1
1721fi
1722
1723AC_CHECK_TYPES(struct timespec)
1724
1725# We need int64_t or else certian parts of the compile will fail.
1726if test "x$ac_cv_have_int64_t" = "xno" -a \
1727 "x$ac_cv_sizeof_long_int" != "x8" -a \
1728 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1729 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1730 echo "an alternative compiler (I.E., GCC) before continuing."
1731 echo ""
1732 exit 1;
1733else
1734dnl test snprintf (broken on SCO w/gcc)
1735 AC_TRY_RUN(
1736 [
1737#include <stdio.h>
1738#include <string.h>
1739#ifdef HAVE_SNPRINTF
1740main()
1741{
1742 char buf[50];
1743 char expected_out[50];
1744 int mazsize = 50 ;
1745#if (SIZEOF_LONG_INT == 8)
1746 long int num = 0x7fffffffffffffff;
1747#else
1748 long long num = 0x7fffffffffffffffll;
1749#endif
1750 strcpy(expected_out, "9223372036854775807");
1751 snprintf(buf, mazsize, "%lld", num);
1752 if(strcmp(buf, expected_out) != 0)
1753 exit(1);
1754 exit(0);
1755}
1756#else
1757main() { exit(0); }
1758#endif
1759 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1760 )
1761fi
1762
1763dnl Checks for structure members
1764OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1765OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1766OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1767OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1768OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1769OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1770OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1771OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1772OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1773OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1774OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1775OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1776OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1777OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1778OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1779OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1780OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1781
1782AC_CHECK_MEMBERS([struct stat.st_blksize])
1783
1784AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1785 ac_cv_have_ss_family_in_struct_ss, [
1786 AC_TRY_COMPILE(
1787 [
1788#include <sys/types.h>
1789#include <sys/socket.h>
1790 ],
1791 [ struct sockaddr_storage s; s.ss_family = 1; ],
1792 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1793 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1794 )
1795])
1796if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1797 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1798fi
1799
1800AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1801 ac_cv_have___ss_family_in_struct_ss, [
1802 AC_TRY_COMPILE(
1803 [
1804#include <sys/types.h>
1805#include <sys/socket.h>
1806 ],
1807 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1808 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1809 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1810 )
1811])
1812if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1813 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1814fi
1815
1816AC_CACHE_CHECK([for pw_class field in struct passwd],
1817 ac_cv_have_pw_class_in_struct_passwd, [
1818 AC_TRY_COMPILE(
1819 [
1820#include <pwd.h>
1821 ],
1822 [ struct passwd p; p.pw_class = 0; ],
1823 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1824 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1825 )
1826])
1827if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1828 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1829fi
1830
1831AC_CACHE_CHECK([for pw_expire field in struct passwd],
1832 ac_cv_have_pw_expire_in_struct_passwd, [
1833 AC_TRY_COMPILE(
1834 [
1835#include <pwd.h>
1836 ],
1837 [ struct passwd p; p.pw_expire = 0; ],
1838 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1839 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1840 )
1841])
1842if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1843 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1844fi
1845
1846AC_CACHE_CHECK([for pw_change field in struct passwd],
1847 ac_cv_have_pw_change_in_struct_passwd, [
1848 AC_TRY_COMPILE(
1849 [
1850#include <pwd.h>
1851 ],
1852 [ struct passwd p; p.pw_change = 0; ],
1853 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1854 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1855 )
1856])
1857if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1858 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1859fi
1860
1861dnl make sure we're using the real structure members and not defines
1862AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1863 ac_cv_have_accrights_in_msghdr, [
1864 AC_TRY_RUN(
1865 [
1866#include <sys/types.h>
1867#include <sys/socket.h>
1868#include <sys/uio.h>
1869int main() {
1870#ifdef msg_accrights
1871exit(1);
1872#endif
1873struct msghdr m;
1874m.msg_accrights = 0;
1875exit(0);
1876}
1877 ],
1878 [ ac_cv_have_accrights_in_msghdr="yes" ],
1879 [ ac_cv_have_accrights_in_msghdr="no" ]
1880 )
1881])
1882if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1883 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1884fi
1885
1886AC_CACHE_CHECK([for msg_control field in struct msghdr],
1887 ac_cv_have_control_in_msghdr, [
1888 AC_TRY_RUN(
1889 [
1890#include <sys/types.h>
1891#include <sys/socket.h>
1892#include <sys/uio.h>
1893int main() {
1894#ifdef msg_control
1895exit(1);
1896#endif
1897struct msghdr m;
1898m.msg_control = 0;
1899exit(0);
1900}
1901 ],
1902 [ ac_cv_have_control_in_msghdr="yes" ],
1903 [ ac_cv_have_control_in_msghdr="no" ]
1904 )
1905])
1906if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1907 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1908fi
1909
1910AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1911 AC_TRY_LINK([],
1912 [ extern char *__progname; printf("%s", __progname); ],
1913 [ ac_cv_libc_defines___progname="yes" ],
1914 [ ac_cv_libc_defines___progname="no" ]
1915 )
1916])
1917if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1918 AC_DEFINE(HAVE___PROGNAME)
1919fi
1920
1921AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1922 AC_TRY_LINK([
1923#include <stdio.h>
1924],
1925 [ printf("%s", __FUNCTION__); ],
1926 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1927 [ ac_cv_cc_implements___FUNCTION__="no" ]
1928 )
1929])
1930if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1931 AC_DEFINE(HAVE___FUNCTION__)
1932fi
1933
1934AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1935 AC_TRY_LINK([
1936#include <stdio.h>
1937],
1938 [ printf("%s", __func__); ],
1939 [ ac_cv_cc_implements___func__="yes" ],
1940 [ ac_cv_cc_implements___func__="no" ]
1941 )
1942])
1943if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1944 AC_DEFINE(HAVE___func__)
1945fi
1946
1947AC_CACHE_CHECK([whether getopt has optreset support],
1948 ac_cv_have_getopt_optreset, [
1949 AC_TRY_LINK(
1950 [
1951#include <getopt.h>
1952 ],
1953 [ extern int optreset; optreset = 0; ],
1954 [ ac_cv_have_getopt_optreset="yes" ],
1955 [ ac_cv_have_getopt_optreset="no" ]
1956 )
1957])
1958if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1959 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1960fi
1961
1962AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1963 AC_TRY_LINK([],
1964 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1965 [ ac_cv_libc_defines_sys_errlist="yes" ],
1966 [ ac_cv_libc_defines_sys_errlist="no" ]
1967 )
1968])
1969if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1970 AC_DEFINE(HAVE_SYS_ERRLIST)
1971fi
1972
1973
1974AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1975 AC_TRY_LINK([],
1976 [ extern int sys_nerr; printf("%i", sys_nerr);],
1977 [ ac_cv_libc_defines_sys_nerr="yes" ],
1978 [ ac_cv_libc_defines_sys_nerr="no" ]
1979 )
1980])
1981if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1982 AC_DEFINE(HAVE_SYS_NERR)
1983fi
1984
1985SCARD_MSG="no"
1986# Check whether user wants sectok support
1987AC_ARG_WITH(sectok,
1988 [ --with-sectok Enable smartcard support using libsectok],
1989 [
1990 if test "x$withval" != "xno" ; then
1991 if test "x$withval" != "xyes" ; then
1992 CPPFLAGS="$CPPFLAGS -I${withval}"
1993 LDFLAGS="$LDFLAGS -L${withval}"
1994 if test ! -z "$need_dash_r" ; then
1995 LDFLAGS="$LDFLAGS -R${withval}"
1996 fi
1997 if test ! -z "$blibpath" ; then
1998 blibpath="$blibpath:${withval}"
1999 fi
2000 fi
2001 AC_CHECK_HEADERS(sectok.h)
2002 if test "$ac_cv_header_sectok_h" != yes; then
2003 AC_MSG_ERROR(Can't find sectok.h)
2004 fi
2005 AC_CHECK_LIB(sectok, sectok_open)
2006 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2007 AC_MSG_ERROR(Can't find libsectok)
2008 fi
2009 AC_DEFINE(SMARTCARD)
2010 AC_DEFINE(USE_SECTOK)
2011 SCARD_MSG="yes, using sectok"
2012 fi
2013 ]
2014)
2015
2016# Check whether user wants OpenSC support
2017AC_ARG_WITH(opensc,
2018 AC_HELP_STRING([--with-opensc=PFX],
2019 [Enable smartcard support using OpenSC]),
2020 opensc_config_prefix="$withval", opensc_config_prefix="")
2021if test x$opensc_config_prefix != x ; then
2022 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2023 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2024 if test "$OPENSC_CONFIG" != "no"; then
2025 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2026 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2027 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2028 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2029 AC_DEFINE(SMARTCARD)
2030 AC_DEFINE(USE_OPENSC)
2031 SCARD_MSG="yes, using OpenSC"
2032 fi
2033fi
2034
2035# Check libraries needed by DNS fingerprint support
2036AC_SEARCH_LIBS(getrrsetbyname, resolv,
2037 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2038 [
2039 # Needed by our getrrsetbyname()
2040 AC_SEARCH_LIBS(res_query, resolv)
2041 AC_SEARCH_LIBS(dn_expand, resolv)
2042 AC_CHECK_FUNCS(_getshort _getlong)
2043 AC_CHECK_MEMBER(HEADER.ad,
2044 [AC_DEFINE(HAVE_HEADER_AD)],,
2045 [#include <arpa/nameser.h>])
2046 ])
2047
2048# Check whether user wants Kerberos 5 support
2049KRB5_MSG="no"
2050AC_ARG_WITH(kerberos5,
2051 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2052 [ if test "x$withval" != "xno" ; then
2053 if test "x$withval" = "xyes" ; then
2054 KRB5ROOT="/usr/local"
2055 else
2056 KRB5ROOT=${withval}
2057 fi
2058
2059 AC_DEFINE(KRB5)
2060 KRB5_MSG="yes"
2061
2062 AC_MSG_CHECKING(for krb5-config)
2063 if test -x $KRB5ROOT/bin/krb5-config ; then
2064 KRB5CONF=$KRB5ROOT/bin/krb5-config
2065 AC_MSG_RESULT($KRB5CONF)
2066
2067 AC_MSG_CHECKING(for gssapi support)
2068 if $KRB5CONF | grep gssapi >/dev/null ; then
2069 AC_MSG_RESULT(yes)
2070 K5CFLAGS="`$KRB5CONF --cflags gssapi`"
2071 dnl m4 quadragraphs: "sed 's/-l[^- ]*//g'"
2072 K5LDFLAGS="`$KRB5CONF --libs gssapi | sed 's/-l@<:@^- @:>@*//g'`"
2073 K5LIBS="`$KRB5CONF --libs gssapi | sed 's/-L@<:@^- @:>@*//g'`"
2074 else
2075 AC_MSG_RESULT(no)
2076 K5CFLAGS="`$KRB5CONF --cflags`"
2077 K5LDFLAGS="`$KRB5CONF --libs | sed 's/-l@<:@^- @:>@*//g'`"
2078 K5LIBS="`$KRB5CONF --libs | sed 's/-L@<:@^- @:>@*//g'`"
2079 fi
2080 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2081 LDFLAGS="$LDFLAGS $K5LDFLAGS"
2082 AC_MSG_CHECKING(whether we are using Heimdal)
2083 AC_TRY_COMPILE([ #include <krb5.h> ],
2084 [ char *tmp = heimdal_version; ],
2085 [ AC_MSG_RESULT(yes)
2086 AC_DEFINE(HEIMDAL) ],
2087 AC_MSG_RESULT(no)
2088 )
2089 else
2090 AC_MSG_RESULT(no)
2091 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2092 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2093 AC_MSG_CHECKING(whether we are using Heimdal)
2094 AC_TRY_COMPILE([ #include <krb5.h> ],
2095 [ char *tmp = heimdal_version; ],
2096 [ AC_MSG_RESULT(yes)
2097 AC_DEFINE(HEIMDAL)
2098 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2099 ],
2100 [ AC_MSG_RESULT(no)
2101 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2102 ]
2103 )
2104 AC_SEARCH_LIBS(dn_expand, resolv)
2105
2106 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2107 [ AC_DEFINE(GSSAPI)
2108 K5LIBS="-lgssapi $K5LIBS" ],
2109 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2110 [ AC_DEFINE(GSSAPI)
2111 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2112 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2113 $K5LIBS)
2114 ],
2115 $K5LIBS)
2116
2117 AC_CHECK_HEADER(gssapi.h, ,
2118 [ unset ac_cv_header_gssapi_h
2119 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2120 AC_CHECK_HEADERS(gssapi.h, ,
2121 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2122 )
2123 ]
2124 )
2125
2126 oldCPP="$CPPFLAGS"
2127 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2128 AC_CHECK_HEADER(gssapi_krb5.h, ,
2129 [ CPPFLAGS="$oldCPP" ])
2130
2131 fi
2132 if test ! -z "$need_dash_r" ; then
2133 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2134 fi
2135 if test ! -z "$blibpath" ; then
2136 blibpath="$blibpath:${KRB5ROOT}/lib"
2137 fi
2138 fi ]
2139 AC_SEARCH_LIBS(k_hasafs, kafs,
2140 [ AC_DEFINE(USE_AFS)
2141 K5LIBS="-lkafs $K5LIBS"
2142 ]
2143 )
2144)
2145LIBS="$LIBS $K5LIBS"
2146
2147# Looking for programs, paths and files
2148
2149PRIVSEP_PATH=/var/empty
2150AC_ARG_WITH(privsep-path,
2151 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2152 [
2153 if test "x$withval" != "$no" ; then
2154 PRIVSEP_PATH=$withval
2155 fi
2156 ]
2157)
2158AC_SUBST(PRIVSEP_PATH)
2159
2160AC_ARG_WITH(xauth,
2161 [ --with-xauth=PATH Specify path to xauth program ],
2162 [
2163 if test "x$withval" != "xno" ; then
2164 xauth_path=$withval
2165 fi
2166 ],
2167 [
2168 TestPath="$PATH"
2169 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2170 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2171 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2172 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2173 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2174 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2175 xauth_path="/usr/openwin/bin/xauth"
2176 fi
2177 ]
2178)
2179
2180STRIP_OPT=-s
2181AC_ARG_ENABLE(strip,
2182 [ --disable-strip Disable calling strip(1) on install],
2183 [
2184 if test "x$enableval" = "xno" ; then
2185 STRIP_OPT=
2186 fi
2187 ]
2188)
2189AC_SUBST(STRIP_OPT)
2190
2191if test -z "$xauth_path" ; then
2192 XAUTH_PATH="undefined"
2193 AC_SUBST(XAUTH_PATH)
2194else
2195 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2196 XAUTH_PATH=$xauth_path
2197 AC_SUBST(XAUTH_PATH)
2198fi
2199
2200# Check for mail directory (last resort if we cannot get it from headers)
2201if test ! -z "$MAIL" ; then
2202 maildir=`dirname $MAIL`
2203 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2204fi
2205
2206if test -z "$no_dev_ptmx" ; then
2207 if test "x$disable_ptmx_check" != "xyes" ; then
2208 AC_CHECK_FILE("/dev/ptmx",
2209 [
2210 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2211 have_dev_ptmx=1
2212 ]
2213 )
2214 fi
2215fi
2216AC_CHECK_FILE("/dev/ptc",
2217 [
2218 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2219 have_dev_ptc=1
2220 ]
2221)
2222
2223# Options from here on. Some of these are preset by platform above
2224AC_ARG_WITH(mantype,
2225 [ --with-mantype=man|cat|doc Set man page type],
2226 [
2227 case "$withval" in
2228 man|cat|doc)
2229 MANTYPE=$withval
2230 ;;
2231 *)
2232 AC_MSG_ERROR(invalid man type: $withval)
2233 ;;
2234 esac
2235 ]
2236)
2237if test -z "$MANTYPE"; then
2238 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2239 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2240 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2241 MANTYPE=doc
2242 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2243 MANTYPE=man
2244 else
2245 MANTYPE=cat
2246 fi
2247fi
2248AC_SUBST(MANTYPE)
2249if test "$MANTYPE" = "doc"; then
2250 mansubdir=man;
2251else
2252 mansubdir=$MANTYPE;
2253fi
2254AC_SUBST(mansubdir)
2255
2256# Check whether to enable MD5 passwords
2257MD5_MSG="no"
2258AC_ARG_WITH(md5-passwords,
2259 [ --with-md5-passwords Enable use of MD5 passwords],
2260 [
2261 if test "x$withval" != "xno" ; then
2262 AC_DEFINE(HAVE_MD5_PASSWORDS)
2263 MD5_MSG="yes"
2264 fi
2265 ]
2266)
2267
2268# Whether to disable shadow password support
2269AC_ARG_WITH(shadow,
2270 [ --without-shadow Disable shadow password support],
2271 [
2272 if test "x$withval" = "xno" ; then
2273 AC_DEFINE(DISABLE_SHADOW)
2274 disable_shadow=yes
2275 fi
2276 ]
2277)
2278
2279if test -z "$disable_shadow" ; then
2280 AC_MSG_CHECKING([if the systems has expire shadow information])
2281 AC_TRY_COMPILE(
2282 [
2283#include <sys/types.h>
2284#include <shadow.h>
2285 struct spwd sp;
2286 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2287 [ sp_expire_available=yes ], []
2288 )
2289
2290 if test "x$sp_expire_available" = "xyes" ; then
2291 AC_MSG_RESULT(yes)
2292 AC_DEFINE(HAS_SHADOW_EXPIRE)
2293 else
2294 AC_MSG_RESULT(no)
2295 fi
2296fi
2297
2298# Use ip address instead of hostname in $DISPLAY
2299if test ! -z "$IPADDR_IN_DISPLAY" ; then
2300 DISPLAY_HACK_MSG="yes"
2301 AC_DEFINE(IPADDR_IN_DISPLAY)
2302else
2303 DISPLAY_HACK_MSG="no"
2304 AC_ARG_WITH(ipaddr-display,
2305 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2306 [
2307 if test "x$withval" != "xno" ; then
2308 AC_DEFINE(IPADDR_IN_DISPLAY)
2309 DISPLAY_HACK_MSG="yes"
2310 fi
2311 ]
2312 )
2313fi
2314
2315# check for /etc/default/login and use it if present.
2316AC_ARG_ENABLE(etc-default-login,
2317 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2318[
2319AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2320
2321if test "x$external_path_file" = "x/etc/default/login"; then
2322 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2323fi
2324])
2325
2326dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2327if test $ac_cv_func_login_getcapbool = "yes" -a \
2328 $ac_cv_header_login_cap_h = "yes" ; then
2329 external_path_file=/etc/login.conf
2330fi
2331
2332# Whether to mess with the default path
2333SERVER_PATH_MSG="(default)"
2334AC_ARG_WITH(default-path,
2335 [ --with-default-path= Specify default \$PATH environment for server],
2336 [
2337 if test "x$external_path_file" = "x/etc/login.conf" ; then
2338 AC_MSG_WARN([
2339--with-default-path=PATH has no effect on this system.
2340Edit /etc/login.conf instead.])
2341 elif test "x$withval" != "xno" ; then
2342 if test ! -z "$external_path_file" ; then
2343 AC_MSG_WARN([
2344--with-default-path=PATH will only be used if PATH is not defined in
2345$external_path_file .])
2346 fi
2347 user_path="$withval"
2348 SERVER_PATH_MSG="$withval"
2349 fi
2350 ],
2351 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2352 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2353 else
2354 if test ! -z "$external_path_file" ; then
2355 AC_MSG_WARN([
2356If PATH is defined in $external_path_file, ensure the path to scp is included,
2357otherwise scp will not work.])
2358 fi
2359 AC_TRY_RUN(
2360 [
2361/* find out what STDPATH is */
2362#include <stdio.h>
2363#ifdef HAVE_PATHS_H
2364# include <paths.h>
2365#endif
2366#ifndef _PATH_STDPATH
2367# ifdef _PATH_USERPATH /* Irix */
2368# define _PATH_STDPATH _PATH_USERPATH
2369# else
2370# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2371# endif
2372#endif
2373#include <sys/types.h>
2374#include <sys/stat.h>
2375#include <fcntl.h>
2376#define DATA "conftest.stdpath"
2377
2378main()
2379{
2380 FILE *fd;
2381 int rc;
2382
2383 fd = fopen(DATA,"w");
2384 if(fd == NULL)
2385 exit(1);
2386
2387 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2388 exit(1);
2389
2390 exit(0);
2391}
2392 ], [ user_path=`cat conftest.stdpath` ],
2393 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2394 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2395 )
2396# make sure $bindir is in USER_PATH so scp will work
2397 t_bindir=`eval echo ${bindir}`
2398 case $t_bindir in
2399 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2400 esac
2401 case $t_bindir in
2402 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2403 esac
2404 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2405 if test $? -ne 0 ; then
2406 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2407 if test $? -ne 0 ; then
2408 user_path=$user_path:$t_bindir
2409 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2410 fi
2411 fi
2412 fi ]
2413)
2414if test "x$external_path_file" != "x/etc/login.conf" ; then
2415 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2416 AC_SUBST(user_path)
2417fi
2418
2419# Set superuser path separately to user path
2420AC_ARG_WITH(superuser-path,
2421 [ --with-superuser-path= Specify different path for super-user],
2422 [
2423 if test "x$withval" != "xno" ; then
2424 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2425 superuser_path=$withval
2426 fi
2427 ]
2428)
2429
2430
2431AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2432IPV4_IN6_HACK_MSG="no"
2433AC_ARG_WITH(4in6,
2434 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2435 [
2436 if test "x$withval" != "xno" ; then
2437 AC_MSG_RESULT(yes)
2438 AC_DEFINE(IPV4_IN_IPV6)
2439 IPV4_IN6_HACK_MSG="yes"
2440 else
2441 AC_MSG_RESULT(no)
2442 fi
2443 ],[
2444 if test "x$inet6_default_4in6" = "xyes"; then
2445 AC_MSG_RESULT([yes (default)])
2446 AC_DEFINE(IPV4_IN_IPV6)
2447 IPV4_IN6_HACK_MSG="yes"
2448 else
2449 AC_MSG_RESULT([no (default)])
2450 fi
2451 ]
2452)
2453
2454# Whether to enable BSD auth support
2455BSD_AUTH_MSG=no
2456AC_ARG_WITH(bsd-auth,
2457 [ --with-bsd-auth Enable BSD auth support],
2458 [
2459 if test "x$withval" != "xno" ; then
2460 AC_DEFINE(BSD_AUTH)
2461 BSD_AUTH_MSG=yes
2462 fi
2463 ]
2464)
2465
2466# Where to place sshd.pid
2467piddir=/var/run
2468# make sure the directory exists
2469if test ! -d $piddir ; then
2470 piddir=`eval echo ${sysconfdir}`
2471 case $piddir in
2472 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2473 esac
2474fi
2475
2476AC_ARG_WITH(pid-dir,
2477 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2478 [
2479 if test "x$withval" != "xno" ; then
2480 piddir=$withval
2481 if test ! -d $piddir ; then
2482 AC_MSG_WARN([** no $piddir directory on this system **])
2483 fi
2484 fi
2485 ]
2486)
2487
2488AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2489AC_SUBST(piddir)
2490
2491dnl allow user to disable some login recording features
2492AC_ARG_ENABLE(lastlog,
2493 [ --disable-lastlog disable use of lastlog even if detected [no]],
2494 [
2495 if test "x$enableval" = "xno" ; then
2496 AC_DEFINE(DISABLE_LASTLOG)
2497 fi
2498 ]
2499)
2500AC_ARG_ENABLE(utmp,
2501 [ --disable-utmp disable use of utmp even if detected [no]],
2502 [
2503 if test "x$enableval" = "xno" ; then
2504 AC_DEFINE(DISABLE_UTMP)
2505 fi
2506 ]
2507)
2508AC_ARG_ENABLE(utmpx,
2509 [ --disable-utmpx disable use of utmpx even if detected [no]],
2510 [
2511 if test "x$enableval" = "xno" ; then
2512 AC_DEFINE(DISABLE_UTMPX)
2513 fi
2514 ]
2515)
2516AC_ARG_ENABLE(wtmp,
2517 [ --disable-wtmp disable use of wtmp even if detected [no]],
2518 [
2519 if test "x$enableval" = "xno" ; then
2520 AC_DEFINE(DISABLE_WTMP)
2521 fi
2522 ]
2523)
2524AC_ARG_ENABLE(wtmpx,
2525 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2526 [
2527 if test "x$enableval" = "xno" ; then
2528 AC_DEFINE(DISABLE_WTMPX)
2529 fi
2530 ]
2531)
2532AC_ARG_ENABLE(libutil,
2533 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2534 [
2535 if test "x$enableval" = "xno" ; then
2536 AC_DEFINE(DISABLE_LOGIN)
2537 fi
2538 ]
2539)
2540AC_ARG_ENABLE(pututline,
2541 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2542 [
2543 if test "x$enableval" = "xno" ; then
2544 AC_DEFINE(DISABLE_PUTUTLINE)
2545 fi
2546 ]
2547)
2548AC_ARG_ENABLE(pututxline,
2549 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2550 [
2551 if test "x$enableval" = "xno" ; then
2552 AC_DEFINE(DISABLE_PUTUTXLINE)
2553 fi
2554 ]
2555)
2556AC_ARG_WITH(lastlog,
2557 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2558 [
2559 if test "x$withval" = "xno" ; then
2560 AC_DEFINE(DISABLE_LASTLOG)
2561 else
2562 conf_lastlog_location=$withval
2563 fi
2564 ]
2565)
2566
2567dnl lastlog, [uw]tmpx? detection
2568dnl NOTE: set the paths in the platform section to avoid the
2569dnl need for command-line parameters
2570dnl lastlog and [uw]tmp are subject to a file search if all else fails
2571
2572dnl lastlog detection
2573dnl NOTE: the code itself will detect if lastlog is a directory
2574AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2575AC_TRY_COMPILE([
2576#include <sys/types.h>
2577#include <utmp.h>
2578#ifdef HAVE_LASTLOG_H
2579# include <lastlog.h>
2580#endif
2581#ifdef HAVE_PATHS_H
2582# include <paths.h>
2583#endif
2584#ifdef HAVE_LOGIN_H
2585# include <login.h>
2586#endif
2587 ],
2588 [ char *lastlog = LASTLOG_FILE; ],
2589 [ AC_MSG_RESULT(yes) ],
2590 [
2591 AC_MSG_RESULT(no)
2592 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2593 AC_TRY_COMPILE([
2594#include <sys/types.h>
2595#include <utmp.h>
2596#ifdef HAVE_LASTLOG_H
2597# include <lastlog.h>
2598#endif
2599#ifdef HAVE_PATHS_H
2600# include <paths.h>
2601#endif
2602 ],
2603 [ char *lastlog = _PATH_LASTLOG; ],
2604 [ AC_MSG_RESULT(yes) ],
2605 [
2606 AC_MSG_RESULT(no)
2607 system_lastlog_path=no
2608 ])
2609 ]
2610)
2611
2612if test -z "$conf_lastlog_location"; then
2613 if test x"$system_lastlog_path" = x"no" ; then
2614 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2615 if (test -d "$f" || test -f "$f") ; then
2616 conf_lastlog_location=$f
2617 fi
2618 done
2619 if test -z "$conf_lastlog_location"; then
2620 AC_MSG_WARN([** Cannot find lastlog **])
2621 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2622 fi
2623 fi
2624fi
2625
2626if test -n "$conf_lastlog_location"; then
2627 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2628fi
2629
2630dnl utmp detection
2631AC_MSG_CHECKING([if your system defines UTMP_FILE])
2632AC_TRY_COMPILE([
2633#include <sys/types.h>
2634#include <utmp.h>
2635#ifdef HAVE_PATHS_H
2636# include <paths.h>
2637#endif
2638 ],
2639 [ char *utmp = UTMP_FILE; ],
2640 [ AC_MSG_RESULT(yes) ],
2641 [ AC_MSG_RESULT(no)
2642 system_utmp_path=no ]
2643)
2644if test -z "$conf_utmp_location"; then
2645 if test x"$system_utmp_path" = x"no" ; then
2646 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2647 if test -f $f ; then
2648 conf_utmp_location=$f
2649 fi
2650 done
2651 if test -z "$conf_utmp_location"; then
2652 AC_DEFINE(DISABLE_UTMP)
2653 fi
2654 fi
2655fi
2656if test -n "$conf_utmp_location"; then
2657 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2658fi
2659
2660dnl wtmp detection
2661AC_MSG_CHECKING([if your system defines WTMP_FILE])
2662AC_TRY_COMPILE([
2663#include <sys/types.h>
2664#include <utmp.h>
2665#ifdef HAVE_PATHS_H
2666# include <paths.h>
2667#endif
2668 ],
2669 [ char *wtmp = WTMP_FILE; ],
2670 [ AC_MSG_RESULT(yes) ],
2671 [ AC_MSG_RESULT(no)
2672 system_wtmp_path=no ]
2673)
2674if test -z "$conf_wtmp_location"; then
2675 if test x"$system_wtmp_path" = x"no" ; then
2676 for f in /usr/adm/wtmp /var/log/wtmp; do
2677 if test -f $f ; then
2678 conf_wtmp_location=$f
2679 fi
2680 done
2681 if test -z "$conf_wtmp_location"; then
2682 AC_DEFINE(DISABLE_WTMP)
2683 fi
2684 fi
2685fi
2686if test -n "$conf_wtmp_location"; then
2687 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2688fi
2689
2690
2691dnl utmpx detection - I don't know any system so perverse as to require
2692dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2693dnl there, though.
2694AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2695AC_TRY_COMPILE([
2696#include <sys/types.h>
2697#include <utmp.h>
2698#ifdef HAVE_UTMPX_H
2699#include <utmpx.h>
2700#endif
2701#ifdef HAVE_PATHS_H
2702# include <paths.h>
2703#endif
2704 ],
2705 [ char *utmpx = UTMPX_FILE; ],
2706 [ AC_MSG_RESULT(yes) ],
2707 [ AC_MSG_RESULT(no)
2708 system_utmpx_path=no ]
2709)
2710if test -z "$conf_utmpx_location"; then
2711 if test x"$system_utmpx_path" = x"no" ; then
2712 AC_DEFINE(DISABLE_UTMPX)
2713 fi
2714else
2715 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2716fi
2717
2718dnl wtmpx detection
2719AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2720AC_TRY_COMPILE([
2721#include <sys/types.h>
2722#include <utmp.h>
2723#ifdef HAVE_UTMPX_H
2724#include <utmpx.h>
2725#endif
2726#ifdef HAVE_PATHS_H
2727# include <paths.h>
2728#endif
2729 ],
2730 [ char *wtmpx = WTMPX_FILE; ],
2731 [ AC_MSG_RESULT(yes) ],
2732 [ AC_MSG_RESULT(no)
2733 system_wtmpx_path=no ]
2734)
2735if test -z "$conf_wtmpx_location"; then
2736 if test x"$system_wtmpx_path" = x"no" ; then
2737 AC_DEFINE(DISABLE_WTMPX)
2738 fi
2739else
2740 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2741fi
2742
2743
2744if test ! -z "$blibpath" ; then
2745 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2746 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2747fi
2748
2749dnl remove pam and dl because they are in $LIBPAM
2750if test "$PAM_MSG" = yes ; then
2751 LIBS=`echo $LIBS | sed 's/-lpam //'`
2752fi
2753if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2754 LIBS=`echo $LIBS | sed 's/-ldl //'`
2755fi
2756
2757AC_EXEEXT
2758AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2759AC_OUTPUT
2760
2761# Print summary of options
2762
2763# Someone please show me a better way :)
2764A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2765B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2766C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2767D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2768E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2769F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2770G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2771H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2772I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2773J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2774
2775echo ""
2776echo "OpenSSH has been configured with the following options:"
2777echo " User binaries: $B"
2778echo " System binaries: $C"
2779echo " Configuration files: $D"
2780echo " Askpass program: $E"
2781echo " Manual pages: $F"
2782echo " PID file: $G"
2783echo " Privilege separation chroot path: $H"
2784if test "x$external_path_file" = "x/etc/login.conf" ; then
2785echo " At runtime, sshd will use the path defined in $external_path_file"
2786echo " Make sure the path to scp is present, otherwise scp will not work"
2787else
2788echo " sshd default user PATH: $I"
2789 if test ! -z "$external_path_file"; then
2790echo " (If PATH is set in $external_path_file it will be used instead. If"
2791echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2792 fi
2793fi
2794if test ! -z "$superuser_path" ; then
2795echo " sshd superuser user PATH: $J"
2796fi
2797echo " Manpage format: $MANTYPE"
2798echo " PAM support: $PAM_MSG"
2799echo " KerberosV support: $KRB5_MSG"
2800echo " Smartcard support: $SCARD_MSG"
2801echo " S/KEY support: $SKEY_MSG"
2802echo " TCP Wrappers support: $TCPW_MSG"
2803echo " MD5 password support: $MD5_MSG"
2804echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2805echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2806echo " BSD Auth support: $BSD_AUTH_MSG"
2807echo " Random number source: $RAND_MSG"
2808if test ! -z "$USE_RAND_HELPER" ; then
2809echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2810fi
2811
2812echo ""
2813
2814echo " Host: ${host}"
2815echo " Compiler: ${CC}"
2816echo " Compiler flags: ${CFLAGS}"
2817echo "Preprocessor flags: ${CPPFLAGS}"
2818echo " Linker flags: ${LDFLAGS}"
2819echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2820
2821echo ""
2822
2823if test "x$PAM_MSG" = "xyes" ; then
2824 echo "PAM is enabled. You may need to install a PAM control file "
2825 echo "for sshd, otherwise password authentication may fail. "
2826 echo "Example PAM control files can be found in the contrib/ "
2827 echo "subdirectory"
2828 echo ""
2829fi
2830
2831if test ! -z "$RAND_HELPER_CMDHASH" ; then
2832 echo "WARNING: you are using the builtin random number collection "
2833 echo "service. Please read WARNING.RNG and request that your OS "
2834 echo "vendor includes kernel-based random number collection in "
2835 echo "future versions of your OS."
2836 echo ""
2837fi
2838
This page took 0.147925 seconds and 5 git commands to generate.