]> andersk Git - gssapi-openssh.git/blame_incremental - openssh/configure.ac
merged OpenSSH 5.3p1 to trunk
[gssapi-openssh.git] / openssh / configure.ac
... / ...
CommitLineData
1# $Id$
2#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
17AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
18AC_REVISION($Revision$)
19AC_CONFIG_SRCDIR([ssh.c])
20
21AC_CONFIG_HEADER(config.h)
22
23# Handle Globus configuration right away, because the Globus flavor
24# determines our compiler options.
25
26# Check whether the user wants GSI (Globus) support
27gsi_path="no"
28AC_ARG_WITH(gsi,
29 [ --with-gsi Enable Globus GSI authentication support],
30 [
31 gsi_path="$withval"
32 ]
33)
34
35AC_ARG_WITH(globus,
36 [ --with-globus Enable Globus GSI authentication support],
37 [
38 gsi_path="$withval"
39 ]
40)
41
42AC_ARG_WITH(globus-static,
43 [ --with-globus-static Link statically with Globus GSI libraries],
44 [
45 gsi_static="-static"
46 if test "x$gsi_path" = "xno" ; then
47 gsi_path="$withval"
48 fi
49 ]
50)
51
52# Check whether the user has a Globus flavor type
53globus_flavor_type="no"
54AC_ARG_WITH(globus-flavor,
55 [ --with-globus-flavor=TYPE Specify Globus flavor type (ex: gcc32dbg)],
56 [
57 globus_flavor_type="$withval"
58 if test "x$gsi_path" = "xno" ; then
59 gsi_path="yes"
60 fi
61 ]
62)
63
64if test "x$gsi_path" != "xno" ; then
65 # Globus GSSAPI configuration
66 AC_MSG_CHECKING(for Globus GSI)
67 AC_DEFINE(GSI, 1, [Define if you want GSI/Globus authentication support.])
68
69 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
70 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus GSI.])
71 fi
72 if test -z "$GSSAPI"; then
73 AC_DEFINE(GSSAPI)
74 GSSAPI="GSI"
75 fi
76
77 if test "x$gsi_path" = "xyes" ; then
78 if test -z "$GLOBUS_LOCATION" ; then
79 AC_MSG_ERROR(GLOBUS_LOCATION environment variable must be set.)
80 else
81 gsi_path="$GLOBUS_LOCATION"
82 fi
83 fi
84 GLOBUS_LOCATION="$gsi_path"
85 export GLOBUS_LOCATION
86 if test ! -d "$GLOBUS_LOCATION" ; then
87 AC_MSG_ERROR(Cannot find Globus installation. Set GLOBUS_LOCATION environment variable.)
88 fi
89
90 if test "x$globus_flavor_type" = "xno" ; then
91 AC_MSG_ERROR(--with-globus-flavor=TYPE must be specified)
92 fi
93 if test "x$globus_flavor_type" = "xyes" ; then
94 AC_MSG_ERROR(--with-globus-flavor=TYPE must specify a flavor type)
95 fi
96
97 GLOBUS_INCLUDE="${gsi_path}/include/${globus_flavor_type}"
98 if test ! -d "$GLOBUS_INCLUDE" ; then
99 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_INCLUDE})
100 fi
101
102 if test -x ${gsi_path}/bin/globus-makefile-header ; then
103 ${gsi_path}/bin/globus-makefile-header --flavor=${globus_flavor_type} ${gsi_static} globus_gss_assist | sed 's/ = \(.*\)/="\1"/' > ./gpt_build_tmp.sh
104 elif test -x ${gsi_path}/sbin/globus-makefile-header ; then
105 ${gsi_path}/sbin/globus-makefile-header --flavor=${globus_flavor_type} ${gsi_static} globus_gss_assist | sed 's/ = \(.*\)/="\1"/' > ./gpt_build_tmp.sh
106 else
107 AC_MSG_ERROR(Cannot find globus-makefile-header: Globus installation is incomplete)
108 fi
109 . ./gpt_build_tmp.sh
110 if test -z "$GLOBUS_PKG_LIBS" ; then
111 AC_MSG_ERROR(globus-makefile-header failed)
112 fi
113
114 AC_MSG_RESULT($GLOBUS_LOCATION)
115 AC_DEFINE(HAVE_GSSAPI_H)
116
117 CC="$GLOBUS_CC"
118 CFLAGS="$GLOBUS_CFLAGS"
119 CPP="$GLOBUS_CPP"
120 CPPFLAGS="$GLOBUS_CPPFLAGS $GLOBUS_INCLUDES"
121 LIBS="$LIBS $GLOBUS_LIBS $GLOBUS_PKG_LIBS"
122 LD="$GLOBUS_LD"
123 LDFLAGS="$LDFLAGS $GLOBUS_LDFLAGS"
124
125 INSTALL_GSISSH="yes"
126else
127 INSTALL_GSISSH=""
128fi
129# End Globus/GSI section
130
131AC_PROG_CC
132AC_CANONICAL_HOST
133AC_C_BIGENDIAN
134
135# Checks for programs.
136AC_PROG_AWK
137AC_PROG_CPP
138AC_PROG_RANLIB
139AC_PROG_INSTALL
140AC_PROG_EGREP
141AC_PATH_PROG(AR, ar)
142AC_PATH_PROG(CAT, cat)
143AC_PATH_PROG(KILL, kill)
144AC_PATH_PROGS(PERL, perl5 perl)
145AC_PATH_PROG(SED, sed)
146AC_SUBST(PERL)
147AC_PATH_PROG(ENT, ent)
148AC_SUBST(ENT)
149AC_PATH_PROG(TEST_MINUS_S_SH, bash)
150AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
151AC_PATH_PROG(TEST_MINUS_S_SH, sh)
152AC_PATH_PROG(SH, sh)
153AC_SUBST(TEST_SHELL,sh)
154
155dnl for buildpkg.sh
156AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
157 [/usr/sbin${PATH_SEPARATOR}/etc])
158AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
159 [/usr/sbin${PATH_SEPARATOR}/etc])
160AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
161if test -x /sbin/sh; then
162 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
163else
164 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
165fi
166
167# System features
168AC_SYS_LARGEFILE
169
170if test -z "$AR" ; then
171 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
172fi
173
174# Use LOGIN_PROGRAM from environment if possible
175if test ! -z "$LOGIN_PROGRAM" ; then
176 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
177 [If your header files don't define LOGIN_PROGRAM,
178 then use this (detected) from environment and PATH])
179else
180 # Search for login
181 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
182 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
183 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
184 fi
185fi
186
187AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
188if test ! -z "$PATH_PASSWD_PROG" ; then
189 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
190 [Full path of your "passwd" program])
191fi
192
193if test -z "$LD" ; then
194 LD=$CC
195fi
196AC_SUBST(LD)
197
198AC_C_INLINE
199
200AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
201
202use_stack_protector=1
203AC_ARG_WITH(stackprotect,
204 [ --without-stackprotect Don't use compiler's stack protection], [
205 if test "x$withval" = "xno"; then
206 use_stack_protector=0
207 fi ])
208
209if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
210 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
211 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
212 case $GCC_VER in
213 1.*) no_attrib_nonnull=1 ;;
214 2.8* | 2.9*)
215 CFLAGS="$CFLAGS -Wsign-compare"
216 no_attrib_nonnull=1
217 ;;
218 2.*) no_attrib_nonnull=1 ;;
219 3.*) CFLAGS="$CFLAGS -Wsign-compare -Wformat-security" ;;
220 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign -Wformat-security" ;;
221 *) ;;
222 esac
223
224 AC_MSG_CHECKING(if $CC accepts -fno-builtin-memset)
225 saved_CFLAGS="$CFLAGS"
226 CFLAGS="$CFLAGS -fno-builtin-memset"
227 AC_LINK_IFELSE( [AC_LANG_SOURCE([[
228#include <string.h>
229int main(void){char b[10]; memset(b, 0, sizeof(b));}
230 ]])],
231 [ AC_MSG_RESULT(yes) ],
232 [ AC_MSG_RESULT(no)
233 CFLAGS="$saved_CFLAGS" ]
234)
235
236 # -fstack-protector-all doesn't always work for some GCC versions
237 # and/or platforms, so we test if we can. If it's not supported
238 # on a given platform gcc will emit a warning so we use -Werror.
239 if test "x$use_stack_protector" = "x1"; then
240 for t in -fstack-protector-all -fstack-protector; do
241 AC_MSG_CHECKING(if $CC supports $t)
242 saved_CFLAGS="$CFLAGS"
243 saved_LDFLAGS="$LDFLAGS"
244 CFLAGS="$CFLAGS $t -Werror"
245 LDFLAGS="$LDFLAGS $t -Werror"
246 AC_LINK_IFELSE(
247 [AC_LANG_SOURCE([
248#include <stdio.h>
249int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
250 ])],
251 [ AC_MSG_RESULT(yes)
252 CFLAGS="$saved_CFLAGS $t"
253 LDFLAGS="$saved_LDFLAGS $t"
254 AC_MSG_CHECKING(if $t works)
255 AC_RUN_IFELSE(
256 [AC_LANG_SOURCE([
257#include <stdio.h>
258int main(void){char x[[256]]; snprintf(x, sizeof(x), "XXX"); return 0;}
259 ])],
260 [ AC_MSG_RESULT(yes)
261 break ],
262 [ AC_MSG_RESULT(no) ],
263 [ AC_MSG_WARN([cross compiling: cannot test])
264 break ]
265 )
266 ],
267 [ AC_MSG_RESULT(no) ]
268 )
269 CFLAGS="$saved_CFLAGS"
270 LDFLAGS="$saved_LDFLAGS"
271 done
272 fi
273
274 if test -z "$have_llong_max"; then
275 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
276 unset ac_cv_have_decl_LLONG_MAX
277 saved_CFLAGS="$CFLAGS"
278 CFLAGS="$CFLAGS -std=gnu99"
279 AC_CHECK_DECL(LLONG_MAX,
280 [have_llong_max=1],
281 [CFLAGS="$saved_CFLAGS"],
282 [#include <limits.h>]
283 )
284 fi
285fi
286
287if test "x$no_attrib_nonnull" != "x1" ; then
288 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
289fi
290
291AC_ARG_WITH(rpath,
292 [ --without-rpath Disable auto-added -R linker paths],
293 [
294 if test "x$withval" = "xno" ; then
295 need_dash_r=""
296 fi
297 if test "x$withval" = "xyes" ; then
298 need_dash_r=1
299 fi
300 ]
301)
302
303# Allow user to specify flags
304AC_ARG_WITH(cflags,
305 [ --with-cflags Specify additional flags to pass to compiler],
306 [
307 if test -n "$withval" && test "x$withval" != "xno" && \
308 test "x${withval}" != "xyes"; then
309 CFLAGS="$CFLAGS $withval"
310 fi
311 ]
312)
313AC_ARG_WITH(cppflags,
314 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
315 [
316 if test -n "$withval" && test "x$withval" != "xno" && \
317 test "x${withval}" != "xyes"; then
318 CPPFLAGS="$CPPFLAGS $withval"
319 fi
320 ]
321)
322AC_ARG_WITH(ldflags,
323 [ --with-ldflags Specify additional flags to pass to linker],
324 [
325 if test -n "$withval" && test "x$withval" != "xno" && \
326 test "x${withval}" != "xyes"; then
327 LDFLAGS="$LDFLAGS $withval"
328 fi
329 ]
330)
331AC_ARG_WITH(libs,
332 [ --with-libs Specify additional libraries to link with],
333 [
334 if test -n "$withval" && test "x$withval" != "xno" && \
335 test "x${withval}" != "xyes"; then
336 LIBS="$LIBS $withval"
337 fi
338 ]
339)
340AC_ARG_WITH(Werror,
341 [ --with-Werror Build main code with -Werror],
342 [
343 if test -n "$withval" && test "x$withval" != "xno"; then
344 werror_flags="-Werror"
345 if test "x${withval}" != "xyes"; then
346 werror_flags="$withval"
347 fi
348 fi
349 ]
350)
351
352AC_CHECK_HEADERS( \
353 bstring.h \
354 crypt.h \
355 crypto/sha2.h \
356 dirent.h \
357 endian.h \
358 features.h \
359 fcntl.h \
360 floatingpoint.h \
361 getopt.h \
362 glob.h \
363 ia.h \
364 iaf.h \
365 limits.h \
366 login.h \
367 maillock.h \
368 ndir.h \
369 net/if_tun.h \
370 netdb.h \
371 netgroup.h \
372 pam/pam_appl.h \
373 paths.h \
374 poll.h \
375 pty.h \
376 readpassphrase.h \
377 rpc/types.h \
378 security/pam_appl.h \
379 sha2.h \
380 shadow.h \
381 stddef.h \
382 stdint.h \
383 string.h \
384 strings.h \
385 sys/audit.h \
386 sys/bitypes.h \
387 sys/bsdtty.h \
388 sys/cdefs.h \
389 sys/dir.h \
390 sys/mman.h \
391 sys/ndir.h \
392 sys/poll.h \
393 sys/prctl.h \
394 sys/pstat.h \
395 sys/select.h \
396 sys/stat.h \
397 sys/stream.h \
398 sys/stropts.h \
399 sys/strtio.h \
400 sys/statvfs.h \
401 sys/sysmacros.h \
402 sys/time.h \
403 sys/timers.h \
404 sys/un.h \
405 time.h \
406 tmpdir.h \
407 ttyent.h \
408 ucred.h \
409 unistd.h \
410 usersec.h \
411 util.h \
412 utime.h \
413 utmp.h \
414 utmpx.h \
415 vis.h \
416)
417
418# lastlog.h requires sys/time.h to be included first on Solaris
419AC_CHECK_HEADERS(lastlog.h, [], [], [
420#ifdef HAVE_SYS_TIME_H
421# include <sys/time.h>
422#endif
423])
424
425# sys/ptms.h requires sys/stream.h to be included first on Solaris
426AC_CHECK_HEADERS(sys/ptms.h, [], [], [
427#ifdef HAVE_SYS_STREAM_H
428# include <sys/stream.h>
429#endif
430])
431
432# login_cap.h requires sys/types.h on NetBSD
433AC_CHECK_HEADERS(login_cap.h, [], [], [
434#include <sys/types.h>
435])
436
437# older BSDs need sys/param.h before sys/mount.h
438AC_CHECK_HEADERS(sys/mount.h, [], [], [
439#include <sys/param.h>
440])
441
442# Messages for features tested for in target-specific section
443SIA_MSG="no"
444SPC_MSG="no"
445
446# Check for some target-specific stuff
447case "$host" in
448*-*-aix*)
449 # Some versions of VAC won't allow macro redefinitions at
450 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
451 # particularly with older versions of vac or xlc.
452 # It also throws errors about null macro argments, but these are
453 # not fatal.
454 AC_MSG_CHECKING(if compiler allows macro redefinitions)
455 AC_COMPILE_IFELSE(
456 [AC_LANG_SOURCE([[
457#define testmacro foo
458#define testmacro bar
459int main(void) { exit(0); }
460 ]])],
461 [ AC_MSG_RESULT(yes) ],
462 [ AC_MSG_RESULT(no)
463 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
464 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
465 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
466 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
467 ]
468 )
469
470 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
471 if (test -z "$blibpath"); then
472 blibpath="/usr/lib:/lib"
473 fi
474 saved_LDFLAGS="$LDFLAGS"
475 if test "$GCC" = "yes"; then
476 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
477 else
478 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
479 fi
480 for tryflags in $flags ;do
481 if (test -z "$blibflags"); then
482 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
483 AC_TRY_LINK([], [], [blibflags=$tryflags])
484 fi
485 done
486 if (test -z "$blibflags"); then
487 AC_MSG_RESULT(not found)
488 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
489 else
490 AC_MSG_RESULT($blibflags)
491 fi
492 LDFLAGS="$saved_LDFLAGS"
493 dnl Check for authenticate. Might be in libs.a on older AIXes
494 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
495 [Define if you want to enable AIX4's authenticate function])],
496 [AC_CHECK_LIB(s,authenticate,
497 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
498 LIBS="$LIBS -ls"
499 ])
500 ])
501 dnl Check for various auth function declarations in headers.
502 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
503 passwdexpired, setauthdb], , , [#include <usersec.h>])
504 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
505 AC_CHECK_DECLS(loginfailed,
506 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
507 AC_TRY_COMPILE(
508 [#include <usersec.h>],
509 [(void)loginfailed("user","host","tty",0);],
510 [AC_MSG_RESULT(yes)
511 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
512 [Define if your AIX loginfailed() function
513 takes 4 arguments (AIX >= 5.2)])],
514 [AC_MSG_RESULT(no)]
515 )],
516 [],
517 [#include <usersec.h>]
518 )
519 AC_CHECK_FUNCS(getgrset setauthdb)
520 AC_CHECK_DECL(F_CLOSEM,
521 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
522 [],
523 [ #include <limits.h>
524 #include <fcntl.h> ]
525 )
526 check_for_aix_broken_getaddrinfo=1
527 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
528 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
529 [Define if your platform breaks doing a seteuid before a setuid])
530 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
531 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
532 dnl AIX handles lastlog as part of its login message
533 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
534 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
535 [Some systems need a utmpx entry for /bin/login to work])
536 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
537 [Define to a Set Process Title type if your system is
538 supported by bsd-setproctitle.c])
539 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
540 [AIX 5.2 and 5.3 (and presumably newer) require this])
541 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
542 ;;
543*-*-cygwin*)
544 check_for_libcrypt_later=1
545 LIBS="$LIBS /usr/lib/textreadmode.o"
546 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
547 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
548 AC_DEFINE(DISABLE_SHADOW, 1,
549 [Define if you want to disable shadow passwords])
550 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
551 [Define if X11 doesn't support AF_UNIX sockets on that system])
552 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
553 [Define if the concept of ports only accessible to
554 superusers isn't known])
555 AC_DEFINE(DISABLE_FD_PASSING, 1,
556 [Define if your platform needs to skip post auth
557 file descriptor passing])
558 AC_DEFINE(SSH_IOBUFSZ, 65536, [Windows is sensitive to read buffer size])
559 ;;
560*-*-dgux*)
561 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
562 [Define if your system choked on IP TOS setting])
563 AC_DEFINE(SETEUID_BREAKS_SETUID)
564 AC_DEFINE(BROKEN_SETREUID)
565 AC_DEFINE(BROKEN_SETREGID)
566 ;;
567*-*-darwin*)
568 AC_DEFINE(BROKEN_GETADDRINFO, 1, [Define if getaddrinfo is broken)])
569 AC_DEFINE(BROKEN_GETADDRINFO)
570 AC_DEFINE(SETEUID_BREAKS_SETUID)
571 AC_DEFINE(BROKEN_SETREUID)
572 AC_DEFINE(BROKEN_SETREGID)
573 AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
574 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
575 [Define if your resolver libs need this for getrrsetbyname])
576 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
577 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
578 [Use tunnel device compatibility to OpenBSD])
579 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
580 [Prepend the address family to IP tunnel traffic])
581 AC_MSG_CHECKING(if we have the Security Authorization Session API)
582 AC_TRY_COMPILE([#include <Security/AuthSession.h>],
583 [SessionCreate(0, 0);],
584 [ac_cv_use_security_session_api="yes"
585 AC_DEFINE(USE_SECURITY_SESSION_API, 1,
586 [platform has the Security Authorization Session API])
587 LIBS="$LIBS -framework Security"
588 AC_MSG_RESULT(yes)],
589 [ac_cv_use_security_session_api="no"
590 AC_MSG_RESULT(no)])
591 AC_MSG_CHECKING(if we have an in-memory credentials cache)
592 AC_TRY_COMPILE(
593 [#include <Kerberos/Kerberos.h>],
594 [cc_context_t c;
595 (void) cc_initialize (&c, 0, NULL, NULL);],
596 [AC_DEFINE(USE_CCAPI, 1,
597 [platform uses an in-memory credentials cache])
598 LIBS="$LIBS -framework Security"
599 AC_MSG_RESULT(yes)
600 if test "x$ac_cv_use_security_session_api" = "xno"; then
601 AC_MSG_ERROR(*** Need a security framework to use the credentials cache API ***)
602 fi],
603 [AC_MSG_RESULT(no)]
604 )
605 m4_pattern_allow(AU_IPv)
606 AC_CHECK_DECL(AU_IPv4, [],
607 AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
608 [#include <bsm/audit.h>]
609 AC_DEFINE(LASTLOG_WRITE_PUTUTXLINE, 1,
610 [Define if pututxline updates lastlog too])
611 )
612 ;;
613*-*-dragonfly*)
614 SSHDLIBS="$SSHDLIBS -lcrypt"
615 ;;
616*-*-hpux*)
617 # first we define all of the options common to all HP-UX releases
618 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
619 IPADDR_IN_DISPLAY=yes
620 AC_DEFINE(USE_PIPES)
621 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
622 [Define if your login program cannot handle end of options ("--")])
623 AC_DEFINE(LOGIN_NEEDS_UTMPX)
624 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
625 [String used in /etc/passwd to denote locked account])
626 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
627 MAIL="/var/mail/username"
628 LIBS="$LIBS -lsec"
629 AC_CHECK_LIB(xnet, t_error, ,
630 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
631
632 # next, we define all of the options specific to major releases
633 case "$host" in
634 *-*-hpux10*)
635 if test -z "$GCC"; then
636 CFLAGS="$CFLAGS -Ae"
637 fi
638 ;;
639 *-*-hpux11*)
640 AC_DEFINE(PAM_SUN_CODEBASE, 1,
641 [Define if you are using Solaris-derived PAM which
642 passes pam_messages to the conversation function
643 with an extra level of indirection])
644 AC_DEFINE(DISABLE_UTMP, 1,
645 [Define if you don't want to use utmp])
646 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
647 check_for_hpux_broken_getaddrinfo=1
648 check_for_conflicting_getspnam=1
649 ;;
650 esac
651
652 # lastly, we define options specific to minor releases
653 case "$host" in
654 *-*-hpux10.26)
655 AC_DEFINE(HAVE_SECUREWARE, 1,
656 [Define if you have SecureWare-based
657 protected password database])
658 disable_ptmx_check=yes
659 LIBS="$LIBS -lsecpw"
660 ;;
661 esac
662 ;;
663*-*-irix5*)
664 PATH="$PATH:/usr/etc"
665 AC_DEFINE(BROKEN_INET_NTOA, 1,
666 [Define if you system's inet_ntoa is busted
667 (e.g. Irix gcc issue)])
668 AC_DEFINE(SETEUID_BREAKS_SETUID)
669 AC_DEFINE(BROKEN_SETREUID)
670 AC_DEFINE(BROKEN_SETREGID)
671 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
672 [Define if you shouldn't strip 'tty' from your
673 ttyname in [uw]tmp])
674 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
675 ;;
676*-*-irix6*)
677 PATH="$PATH:/usr/etc"
678 AC_DEFINE(WITH_IRIX_ARRAY, 1,
679 [Define if you have/want arrays
680 (cluster-wide session managment, not C arrays)])
681 AC_DEFINE(WITH_IRIX_PROJECT, 1,
682 [Define if you want IRIX project management])
683 AC_DEFINE(WITH_IRIX_AUDIT, 1,
684 [Define if you want IRIX audit trails])
685 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
686 [Define if you want IRIX kernel jobs])])
687 AC_DEFINE(BROKEN_INET_NTOA)
688 AC_DEFINE(SETEUID_BREAKS_SETUID)
689 AC_DEFINE(BROKEN_SETREUID)
690 AC_DEFINE(BROKEN_SETREGID)
691 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
692 AC_DEFINE(WITH_ABBREV_NO_TTY)
693 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
694 ;;
695*-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
696 check_for_libcrypt_later=1
697 AC_DEFINE(PAM_TTY_KLUDGE)
698 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
699 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
700 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
701 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
702 ;;
703*-*-linux*)
704 no_dev_ptmx=1
705 check_for_libcrypt_later=1
706 check_for_openpty_ctty_bug=1
707 AC_DEFINE(PAM_TTY_KLUDGE, 1,
708 [Work around problematic Linux PAM modules handling of PAM_TTY])
709 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
710 [String used in /etc/passwd to denote locked account])
711 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
712 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
713 [Define to whatever link() returns for "not supported"
714 if it doesn't return EOPNOTSUPP.])
715 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
716 AC_DEFINE(USE_BTMP)
717 inet6_default_4in6=yes
718 case `uname -r` in
719 1.*|2.0.*)
720 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
721 [Define if cmsg_type is not passed correctly])
722 ;;
723 esac
724 # tun(4) forwarding compat code
725 AC_CHECK_HEADERS(linux/if_tun.h)
726 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
727 AC_DEFINE(SSH_TUN_LINUX, 1,
728 [Open tunnel devices the Linux tun/tap way])
729 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
730 [Use tunnel device compatibility to OpenBSD])
731 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
732 [Prepend the address family to IP tunnel traffic])
733 fi
734 ;;
735mips-sony-bsd|mips-sony-newsos4)
736 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
737 SONY=1
738 ;;
739*-*-netbsd*)
740 check_for_libcrypt_before=1
741 if test "x$withval" != "xno" ; then
742 need_dash_r=1
743 fi
744 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
745 AC_CHECK_HEADER([net/if_tap.h], ,
746 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
747 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
748 [Prepend the address family to IP tunnel traffic])
749 ;;
750*-*-freebsd*)
751 check_for_libcrypt_later=1
752 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
753 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
754 AC_CHECK_HEADER([net/if_tap.h], ,
755 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
756 AC_DEFINE(BROKEN_GLOB, 1, [FreeBSD glob does not do what we need])
757 ;;
758*-*-bsdi*)
759 AC_DEFINE(SETEUID_BREAKS_SETUID)
760 AC_DEFINE(BROKEN_SETREUID)
761 AC_DEFINE(BROKEN_SETREGID)
762 ;;
763*-next-*)
764 conf_lastlog_location="/usr/adm/lastlog"
765 conf_utmp_location=/etc/utmp
766 conf_wtmp_location=/usr/adm/wtmp
767 MAIL=/usr/spool/mail
768 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
769 AC_DEFINE(BROKEN_REALPATH)
770 AC_DEFINE(USE_PIPES)
771 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
772 ;;
773*-*-openbsd*)
774 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
775 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
776 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
777 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
778 [syslog_r function is safe to use in in a signal handler])
779 ;;
780*-*-solaris*)
781 if test "x$withval" != "xno" ; then
782 need_dash_r=1
783 fi
784 AC_DEFINE(PAM_SUN_CODEBASE)
785 AC_DEFINE(LOGIN_NEEDS_UTMPX)
786 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
787 [Some versions of /bin/login need the TERM supplied
788 on the commandline])
789 AC_DEFINE(PAM_TTY_KLUDGE)
790 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
791 [Define if pam_chauthtok wants real uid set
792 to the unpriv'ed user])
793 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
794 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
795 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
796 [Define if sshd somehow reacquires a controlling TTY
797 after setsid()])
798 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
799 in case the name is longer than 8 chars])
800 AC_DEFINE(BROKEN_TCGETATTR_ICANON, 1, [tcgetattr with ICANON may hang])
801 external_path_file=/etc/default/login
802 # hardwire lastlog location (can't detect it on some versions)
803 conf_lastlog_location="/var/adm/lastlog"
804 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
805 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
806 if test "$sol2ver" -ge 8; then
807 AC_MSG_RESULT(yes)
808 AC_DEFINE(DISABLE_UTMP)
809 AC_DEFINE(DISABLE_WTMP, 1,
810 [Define if you don't want to use wtmp])
811 else
812 AC_MSG_RESULT(no)
813 fi
814 AC_ARG_WITH(solaris-contracts,
815 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
816 [
817 AC_CHECK_LIB(contract, ct_tmpl_activate,
818 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
819 [Define if you have Solaris process contracts])
820 SSHDLIBS="$SSHDLIBS -lcontract"
821 AC_SUBST(SSHDLIBS)
822 SPC_MSG="yes" ], )
823 ],
824 )
825 ;;
826*-*-sunos4*)
827 CPPFLAGS="$CPPFLAGS -DSUNOS4"
828 AC_CHECK_FUNCS(getpwanam)
829 AC_DEFINE(PAM_SUN_CODEBASE)
830 conf_utmp_location=/etc/utmp
831 conf_wtmp_location=/var/adm/wtmp
832 conf_lastlog_location=/var/adm/lastlog
833 AC_DEFINE(USE_PIPES)
834 ;;
835*-ncr-sysv*)
836 LIBS="$LIBS -lc89"
837 AC_DEFINE(USE_PIPES)
838 AC_DEFINE(SSHD_ACQUIRES_CTTY)
839 AC_DEFINE(SETEUID_BREAKS_SETUID)
840 AC_DEFINE(BROKEN_SETREUID)
841 AC_DEFINE(BROKEN_SETREGID)
842 ;;
843*-sni-sysv*)
844 # /usr/ucblib MUST NOT be searched on ReliantUNIX
845 AC_CHECK_LIB(dl, dlsym, ,)
846 # -lresolv needs to be at the end of LIBS or DNS lookups break
847 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
848 IPADDR_IN_DISPLAY=yes
849 AC_DEFINE(USE_PIPES)
850 AC_DEFINE(IP_TOS_IS_BROKEN)
851 AC_DEFINE(SETEUID_BREAKS_SETUID)
852 AC_DEFINE(BROKEN_SETREUID)
853 AC_DEFINE(BROKEN_SETREGID)
854 AC_DEFINE(SSHD_ACQUIRES_CTTY)
855 external_path_file=/etc/default/login
856 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
857 # Attention: always take care to bind libsocket and libnsl before libc,
858 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
859 ;;
860# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
861*-*-sysv4.2*)
862 AC_DEFINE(USE_PIPES)
863 AC_DEFINE(SETEUID_BREAKS_SETUID)
864 AC_DEFINE(BROKEN_SETREUID)
865 AC_DEFINE(BROKEN_SETREGID)
866 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
867 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
868 ;;
869# UnixWare 7.x, OpenUNIX 8
870*-*-sysv5*)
871 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
872 AC_DEFINE(USE_PIPES)
873 AC_DEFINE(SETEUID_BREAKS_SETUID)
874 AC_DEFINE(BROKEN_SETREUID)
875 AC_DEFINE(BROKEN_SETREGID)
876 AC_DEFINE(PASSWD_NEEDS_USERNAME)
877 case "$host" in
878 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
879 TEST_SHELL=/u95/bin/sh
880 AC_DEFINE(BROKEN_LIBIAF, 1,
881 [ia_uinfo routines not supported by OS yet])
882 AC_DEFINE(BROKEN_UPDWTMPX)
883 AC_CHECK_LIB(prot, getluid,[ LIBS="$LIBS -lprot"
884 AC_CHECK_FUNCS(getluid setluid,,,-lprot)
885 AC_DEFINE(HAVE_SECUREWARE)
886 AC_DEFINE(DISABLE_SHADOW)
887 ],,)
888 ;;
889 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
890 check_for_libcrypt_later=1
891 ;;
892 esac
893 ;;
894*-*-sysv*)
895 ;;
896# SCO UNIX and OEM versions of SCO UNIX
897*-*-sco3.2v4*)
898 AC_MSG_ERROR("This Platform is no longer supported.")
899 ;;
900# SCO OpenServer 5.x
901*-*-sco3.2v5*)
902 if test -z "$GCC"; then
903 CFLAGS="$CFLAGS -belf"
904 fi
905 LIBS="$LIBS -lprot -lx -ltinfo -lm"
906 no_dev_ptmx=1
907 AC_DEFINE(USE_PIPES)
908 AC_DEFINE(HAVE_SECUREWARE)
909 AC_DEFINE(DISABLE_SHADOW)
910 AC_DEFINE(DISABLE_FD_PASSING)
911 AC_DEFINE(SETEUID_BREAKS_SETUID)
912 AC_DEFINE(BROKEN_SETREUID)
913 AC_DEFINE(BROKEN_SETREGID)
914 AC_DEFINE(WITH_ABBREV_NO_TTY)
915 AC_DEFINE(BROKEN_UPDWTMPX)
916 AC_DEFINE(PASSWD_NEEDS_USERNAME)
917 AC_CHECK_FUNCS(getluid setluid)
918 MANTYPE=man
919 TEST_SHELL=ksh
920 ;;
921*-*-unicosmk*)
922 AC_DEFINE(NO_SSH_LASTLOG, 1,
923 [Define if you don't want to use lastlog in session.c])
924 AC_DEFINE(SETEUID_BREAKS_SETUID)
925 AC_DEFINE(BROKEN_SETREUID)
926 AC_DEFINE(BROKEN_SETREGID)
927 AC_DEFINE(USE_PIPES)
928 AC_DEFINE(DISABLE_FD_PASSING)
929 LDFLAGS="$LDFLAGS"
930 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
931 MANTYPE=cat
932 ;;
933*-*-unicosmp*)
934 AC_DEFINE(SETEUID_BREAKS_SETUID)
935 AC_DEFINE(BROKEN_SETREUID)
936 AC_DEFINE(BROKEN_SETREGID)
937 AC_DEFINE(WITH_ABBREV_NO_TTY)
938 AC_DEFINE(USE_PIPES)
939 AC_DEFINE(DISABLE_FD_PASSING)
940 LDFLAGS="$LDFLAGS"
941 LIBS="$LIBS -lgen -lacid -ldb"
942 MANTYPE=cat
943 ;;
944*-*-unicos*)
945 AC_DEFINE(SETEUID_BREAKS_SETUID)
946 AC_DEFINE(BROKEN_SETREUID)
947 AC_DEFINE(BROKEN_SETREGID)
948 AC_DEFINE(USE_PIPES)
949 AC_DEFINE(DISABLE_FD_PASSING)
950 AC_DEFINE(NO_SSH_LASTLOG)
951 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
952 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
953 MANTYPE=cat
954 ;;
955*-dec-osf*)
956 AC_MSG_CHECKING(for Digital Unix SIA)
957 no_osfsia=""
958 AC_ARG_WITH(osfsia,
959 [ --with-osfsia Enable Digital Unix SIA],
960 [
961 if test "x$withval" = "xno" ; then
962 AC_MSG_RESULT(disabled)
963 no_osfsia=1
964 fi
965 ],
966 )
967 if test -z "$no_osfsia" ; then
968 if test -f /etc/sia/matrix.conf; then
969 AC_MSG_RESULT(yes)
970 AC_DEFINE(HAVE_OSF_SIA, 1,
971 [Define if you have Digital Unix Security
972 Integration Architecture])
973 AC_DEFINE(DISABLE_LOGIN, 1,
974 [Define if you don't want to use your
975 system's login() call])
976 AC_DEFINE(DISABLE_FD_PASSING)
977 LIBS="$LIBS -lsecurity -ldb -lm -laud"
978 SIA_MSG="yes"
979 else
980 AC_MSG_RESULT(no)
981 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
982 [String used in /etc/passwd to denote locked account])
983 fi
984 fi
985 AC_DEFINE(BROKEN_GETADDRINFO)
986 AC_DEFINE(SETEUID_BREAKS_SETUID)
987 AC_DEFINE(BROKEN_SETREUID)
988 AC_DEFINE(BROKEN_SETREGID)
989 AC_DEFINE(BROKEN_READV_COMPARISON, 1, [Can't do comparisons on readv])
990 ;;
991
992*-*-nto-qnx*)
993 AC_DEFINE(USE_PIPES)
994 AC_DEFINE(NO_X11_UNIX_SOCKETS)
995 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
996 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
997 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
998 AC_DEFINE(DISABLE_LASTLOG)
999 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1000 AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
1001 enable_etc_default_login=no # has incompatible /etc/default/login
1002 case "$host" in
1003 *-*-nto-qnx6*)
1004 AC_DEFINE(DISABLE_FD_PASSING)
1005 ;;
1006 esac
1007 ;;
1008
1009*-*-ultrix*)
1010 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
1011 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
1012 AC_DEFINE(NEED_SETPGRP)
1013 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
1014 ;;
1015
1016*-*-lynxos)
1017 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
1018 AC_DEFINE(MISSING_HOWMANY)
1019 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
1020 ;;
1021esac
1022
1023AC_MSG_CHECKING(compiler and flags for sanity)
1024AC_RUN_IFELSE(
1025 [AC_LANG_SOURCE([
1026#include <stdio.h>
1027int main(){exit(0);}
1028 ])],
1029 [ AC_MSG_RESULT(yes) ],
1030 [
1031 AC_MSG_RESULT(no)
1032 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
1033 ],
1034 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
1035)
1036
1037dnl Checks for header files.
1038# Checks for libraries.
1039AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
1040AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
1041
1042dnl IRIX and Solaris 2.5.1 have dirname() in libgen
1043AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
1044 AC_CHECK_LIB(gen, dirname,[
1045 AC_CACHE_CHECK([for broken dirname],
1046 ac_cv_have_broken_dirname, [
1047 save_LIBS="$LIBS"
1048 LIBS="$LIBS -lgen"
1049 AC_RUN_IFELSE(
1050 [AC_LANG_SOURCE([[
1051#include <libgen.h>
1052#include <string.h>
1053
1054int main(int argc, char **argv) {
1055 char *s, buf[32];
1056
1057 strncpy(buf,"/etc", 32);
1058 s = dirname(buf);
1059 if (!s || strncmp(s, "/", 32) != 0) {
1060 exit(1);
1061 } else {
1062 exit(0);
1063 }
1064}
1065 ]])],
1066 [ ac_cv_have_broken_dirname="no" ],
1067 [ ac_cv_have_broken_dirname="yes" ],
1068 [ ac_cv_have_broken_dirname="no" ],
1069 )
1070 LIBS="$save_LIBS"
1071 ])
1072 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
1073 LIBS="$LIBS -lgen"
1074 AC_DEFINE(HAVE_DIRNAME)
1075 AC_CHECK_HEADERS(libgen.h)
1076 fi
1077 ])
1078])
1079
1080AC_CHECK_FUNC(getspnam, ,
1081 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
1082AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
1083 [Define if you have the basename function.]))
1084
1085dnl zlib is required
1086AC_ARG_WITH(zlib,
1087 [ --with-zlib=PATH Use zlib in PATH],
1088 [ if test "x$withval" = "xno" ; then
1089 AC_MSG_ERROR([*** zlib is required ***])
1090 elif test "x$withval" != "xyes"; then
1091 if test -d "$withval/lib"; then
1092 if test -n "${need_dash_r}"; then
1093 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1094 else
1095 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1096 fi
1097 else
1098 if test -n "${need_dash_r}"; then
1099 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1100 else
1101 LDFLAGS="-L${withval} ${LDFLAGS}"
1102 fi
1103 fi
1104 if test -d "$withval/include"; then
1105 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1106 else
1107 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1108 fi
1109 fi ]
1110)
1111
1112AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
1113AC_CHECK_LIB(z, deflate, ,
1114 [
1115 saved_CPPFLAGS="$CPPFLAGS"
1116 saved_LDFLAGS="$LDFLAGS"
1117 save_LIBS="$LIBS"
1118 dnl Check default zlib install dir
1119 if test -n "${need_dash_r}"; then
1120 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
1121 else
1122 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
1123 fi
1124 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
1125 LIBS="$LIBS -lz"
1126 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
1127 [
1128 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
1129 ]
1130 )
1131 ]
1132)
1133
1134AC_ARG_WITH(zlib-version-check,
1135 [ --without-zlib-version-check Disable zlib version check],
1136 [ if test "x$withval" = "xno" ; then
1137 zlib_check_nonfatal=1
1138 fi
1139 ]
1140)
1141
1142AC_MSG_CHECKING(for possibly buggy zlib)
1143AC_RUN_IFELSE([AC_LANG_SOURCE([[
1144#include <stdio.h>
1145#include <zlib.h>
1146int main()
1147{
1148 int a=0, b=0, c=0, d=0, n, v;
1149 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
1150 if (n != 3 && n != 4)
1151 exit(1);
1152 v = a*1000000 + b*10000 + c*100 + d;
1153 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
1154
1155 /* 1.1.4 is OK */
1156 if (a == 1 && b == 1 && c >= 4)
1157 exit(0);
1158
1159 /* 1.2.3 and up are OK */
1160 if (v >= 1020300)
1161 exit(0);
1162
1163 exit(2);
1164}
1165 ]])],
1166 AC_MSG_RESULT(no),
1167 [ AC_MSG_RESULT(yes)
1168 if test -z "$zlib_check_nonfatal" ; then
1169 AC_MSG_ERROR([*** zlib too old - check config.log ***
1170Your reported zlib version has known security problems. It's possible your
1171vendor has fixed these problems without changing the version number. If you
1172are sure this is the case, you can disable the check by running
1173"./configure --without-zlib-version-check".
1174If you are in doubt, upgrade zlib to version 1.2.3 or greater.
1175See http://www.gzip.org/zlib/ for details.])
1176 else
1177 AC_MSG_WARN([zlib version may have security problems])
1178 fi
1179 ],
1180 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
1181)
1182
1183dnl UnixWare 2.x
1184AC_CHECK_FUNC(strcasecmp,
1185 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
1186)
1187AC_CHECK_FUNCS(utimes,
1188 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
1189 LIBS="$LIBS -lc89"]) ]
1190)
1191
1192dnl Checks for libutil functions
1193AC_CHECK_HEADERS(libutil.h)
1194AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
1195 [Define if your libraries define login()])])
1196AC_CHECK_FUNCS(fmt_scaled logout updwtmp logwtmp)
1197
1198AC_FUNC_STRFTIME
1199
1200# Check for ALTDIRFUNC glob() extension
1201AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1202AC_EGREP_CPP(FOUNDIT,
1203 [
1204 #include <glob.h>
1205 #ifdef GLOB_ALTDIRFUNC
1206 FOUNDIT
1207 #endif
1208 ],
1209 [
1210 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1211 [Define if your system glob() function has
1212 the GLOB_ALTDIRFUNC extension])
1213 AC_MSG_RESULT(yes)
1214 ],
1215 [
1216 AC_MSG_RESULT(no)
1217 ]
1218)
1219
1220# Check for g.gl_matchc glob() extension
1221AC_MSG_CHECKING(for gl_matchc field in glob_t)
1222AC_TRY_COMPILE(
1223 [ #include <glob.h> ],
1224 [glob_t g; g.gl_matchc = 1;],
1225 [
1226 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1227 [Define if your system glob() function has
1228 gl_matchc options in glob_t])
1229 AC_MSG_RESULT(yes)
1230 ],
1231 [
1232 AC_MSG_RESULT(no)
1233 ]
1234)
1235
1236AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1237
1238AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
1239AC_RUN_IFELSE(
1240 [AC_LANG_SOURCE([[
1241#include <sys/types.h>
1242#include <dirent.h>
1243int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
1244 ]])],
1245 [AC_MSG_RESULT(yes)],
1246 [
1247 AC_MSG_RESULT(no)
1248 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
1249 [Define if your struct dirent expects you to
1250 allocate extra space for d_name])
1251 ],
1252 [
1253 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1254 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
1255 ]
1256)
1257
1258AC_MSG_CHECKING([for /proc/pid/fd directory])
1259if test -d "/proc/$$/fd" ; then
1260 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
1261 AC_MSG_RESULT(yes)
1262else
1263 AC_MSG_RESULT(no)
1264fi
1265
1266# Check whether user wants S/Key support
1267SKEY_MSG="no"
1268AC_ARG_WITH(skey,
1269 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
1270 [
1271 if test "x$withval" != "xno" ; then
1272
1273 if test "x$withval" != "xyes" ; then
1274 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1275 LDFLAGS="$LDFLAGS -L${withval}/lib"
1276 fi
1277
1278 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
1279 LIBS="-lskey $LIBS"
1280 SKEY_MSG="yes"
1281
1282 AC_MSG_CHECKING([for s/key support])
1283 AC_LINK_IFELSE(
1284 [AC_LANG_SOURCE([[
1285#include <stdio.h>
1286#include <skey.h>
1287int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
1288 ]])],
1289 [AC_MSG_RESULT(yes)],
1290 [
1291 AC_MSG_RESULT(no)
1292 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1293 ])
1294 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1295 AC_TRY_COMPILE(
1296 [#include <stdio.h>
1297 #include <skey.h>],
1298 [(void)skeychallenge(NULL,"name","",0);],
1299 [AC_MSG_RESULT(yes)
1300 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1301 [Define if your skeychallenge()
1302 function takes 4 arguments (NetBSD)])],
1303 [AC_MSG_RESULT(no)]
1304 )
1305 fi
1306 ]
1307)
1308
1309# Check whether user wants TCP wrappers support
1310TCPW_MSG="no"
1311AC_ARG_WITH(tcp-wrappers,
1312 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1313 [
1314 if test "x$withval" != "xno" ; then
1315 saved_LIBS="$LIBS"
1316 saved_LDFLAGS="$LDFLAGS"
1317 saved_CPPFLAGS="$CPPFLAGS"
1318 if test -n "${withval}" && \
1319 test "x${withval}" != "xyes"; then
1320 if test -d "${withval}/lib"; then
1321 if test -n "${need_dash_r}"; then
1322 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1323 else
1324 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1325 fi
1326 else
1327 if test -n "${need_dash_r}"; then
1328 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1329 else
1330 LDFLAGS="-L${withval} ${LDFLAGS}"
1331 fi
1332 fi
1333 if test -d "${withval}/include"; then
1334 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1335 else
1336 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1337 fi
1338 fi
1339 LIBS="-lwrap $LIBS"
1340 AC_MSG_CHECKING(for libwrap)
1341 AC_TRY_LINK(
1342 [
1343#include <sys/types.h>
1344#include <sys/socket.h>
1345#include <netinet/in.h>
1346#include <tcpd.h>
1347 int deny_severity = 0, allow_severity = 0;
1348 ],
1349 [hosts_access(0);],
1350 [
1351 AC_MSG_RESULT(yes)
1352 AC_DEFINE(LIBWRAP, 1,
1353 [Define if you want
1354 TCP Wrappers support])
1355 SSHDLIBS="$SSHDLIBS -lwrap"
1356 TCPW_MSG="yes"
1357 ],
1358 [
1359 AC_MSG_ERROR([*** libwrap missing])
1360 ]
1361 )
1362 LIBS="$saved_LIBS"
1363 fi
1364 ]
1365)
1366
1367# Check whether user wants libedit support
1368LIBEDIT_MSG="no"
1369AC_ARG_WITH(libedit,
1370 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1371 [ if test "x$withval" != "xno" ; then
1372 if test "x$withval" != "xyes"; then
1373 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1374 if test -n "${need_dash_r}"; then
1375 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1376 else
1377 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1378 fi
1379 fi
1380 AC_CHECK_LIB(edit, el_init,
1381 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1382 LIBEDIT="-ledit -lcurses"
1383 LIBEDIT_MSG="yes"
1384 AC_SUBST(LIBEDIT)
1385 ],
1386 [ AC_MSG_ERROR(libedit not found) ],
1387 [ -lcurses ]
1388 )
1389 AC_MSG_CHECKING(if libedit version is compatible)
1390 AC_COMPILE_IFELSE(
1391 [AC_LANG_SOURCE([[
1392#include <histedit.h>
1393int main(void)
1394{
1395 int i = H_SETSIZE;
1396 el_init("", NULL, NULL, NULL);
1397 exit(0);
1398}
1399 ]])],
1400 [ AC_MSG_RESULT(yes) ],
1401 [ AC_MSG_RESULT(no)
1402 AC_MSG_ERROR(libedit version is not compatible) ]
1403 )
1404 fi ]
1405)
1406
1407AUDIT_MODULE=none
1408AC_ARG_WITH(audit,
1409 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1410 [
1411 AC_MSG_CHECKING(for supported audit module)
1412 case "$withval" in
1413 bsm)
1414 AC_MSG_RESULT(bsm)
1415 AUDIT_MODULE=bsm
1416 dnl Checks for headers, libs and functions
1417 AC_CHECK_HEADERS(bsm/audit.h, [],
1418 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1419 [
1420#ifdef HAVE_TIME_H
1421# include <time.h>
1422#endif
1423 ]
1424)
1425 AC_CHECK_LIB(bsm, getaudit, [],
1426 [AC_MSG_ERROR(BSM enabled and required library not found)])
1427 AC_CHECK_FUNCS(getaudit, [],
1428 [AC_MSG_ERROR(BSM enabled and required function not found)])
1429 # These are optional
1430 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
1431 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1432 ;;
1433 debug)
1434 AUDIT_MODULE=debug
1435 AC_MSG_RESULT(debug)
1436 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1437 ;;
1438 no)
1439 AC_MSG_RESULT(no)
1440 ;;
1441 *)
1442 AC_MSG_ERROR([Unknown audit module $withval])
1443 ;;
1444 esac ]
1445)
1446
1447dnl Checks for library functions. Please keep in alphabetical order
1448AC_CHECK_FUNCS( \
1449 arc4random \
1450 arc4random_buf \
1451 arc4random_uniform \
1452 asprintf \
1453 b64_ntop \
1454 __b64_ntop \
1455 b64_pton \
1456 __b64_pton \
1457 bcopy \
1458 bindresvport_sa \
1459 clock \
1460 closefrom \
1461 dirfd \
1462 fchmod \
1463 fchown \
1464 freeaddrinfo \
1465 fstatvfs \
1466 futimes \
1467 getaddrinfo \
1468 getcwd \
1469 getgrouplist \
1470 getnameinfo \
1471 getopt \
1472 getpeereid \
1473 getpeerucred \
1474 _getpty \
1475 getrlimit \
1476 getttyent \
1477 glob \
1478 inet_aton \
1479 inet_ntoa \
1480 inet_ntop \
1481 innetgr \
1482 login_getcapbool \
1483 md5_crypt \
1484 memmove \
1485 mkdtemp \
1486 mmap \
1487 ngetaddrinfo \
1488 nsleep \
1489 ogetaddrinfo \
1490 openlog_r \
1491 openpty \
1492 poll \
1493 prctl \
1494 pstat \
1495 readpassphrase \
1496 realpath \
1497 recvmsg \
1498 rresvport_af \
1499 sendmsg \
1500 setdtablesize \
1501 setegid \
1502 setenv \
1503 seteuid \
1504 setgroups \
1505 setlogin \
1506 setpcred \
1507 setproctitle \
1508 setregid \
1509 setreuid \
1510 setrlimit \
1511 setsid \
1512 setvbuf \
1513 sigaction \
1514 sigvec \
1515 snprintf \
1516 socketpair \
1517 statfs \
1518 statvfs \
1519 strdup \
1520 strerror \
1521 strlcat \
1522 strlcpy \
1523 strmode \
1524 strnvis \
1525 strtonum \
1526 strtoll \
1527 strtoul \
1528 swap32 \
1529 sysconf \
1530 tcgetpgrp \
1531 truncate \
1532 unsetenv \
1533 updwtmpx \
1534 vasprintf \
1535 vhangup \
1536 vsnprintf \
1537 waitpid \
1538)
1539
1540# IRIX has a const char return value for gai_strerror()
1541AC_CHECK_FUNCS(gai_strerror,[
1542 AC_DEFINE(HAVE_GAI_STRERROR)
1543 AC_TRY_COMPILE([
1544#include <sys/types.h>
1545#include <sys/socket.h>
1546#include <netdb.h>
1547
1548const char *gai_strerror(int);],[
1549char *str;
1550
1551str = gai_strerror(0);],[
1552 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1553 [Define if gai_strerror() returns const char *])])])
1554
1555AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1556 [Some systems put nanosleep outside of libc]))
1557
1558dnl Make sure prototypes are defined for these before using them.
1559AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1560AC_CHECK_DECL(strsep,
1561 [AC_CHECK_FUNCS(strsep)],
1562 [],
1563 [
1564#ifdef HAVE_STRING_H
1565# include <string.h>
1566#endif
1567 ])
1568
1569dnl tcsendbreak might be a macro
1570AC_CHECK_DECL(tcsendbreak,
1571 [AC_DEFINE(HAVE_TCSENDBREAK)],
1572 [AC_CHECK_FUNCS(tcsendbreak)],
1573 [#include <termios.h>]
1574)
1575
1576AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1577
1578AC_CHECK_DECLS(SHUT_RD, , ,
1579 [
1580#include <sys/types.h>
1581#include <sys/socket.h>
1582 ])
1583
1584AC_CHECK_DECLS(O_NONBLOCK, , ,
1585 [
1586#include <sys/types.h>
1587#ifdef HAVE_SYS_STAT_H
1588# include <sys/stat.h>
1589#endif
1590#ifdef HAVE_FCNTL_H
1591# include <fcntl.h>
1592#endif
1593 ])
1594
1595AC_CHECK_DECLS(writev, , , [
1596#include <sys/types.h>
1597#include <sys/uio.h>
1598#include <unistd.h>
1599 ])
1600
1601AC_CHECK_DECLS(MAXSYMLINKS, , , [
1602#include <sys/param.h>
1603 ])
1604
1605AC_CHECK_DECLS(offsetof, , , [
1606#include <stddef.h>
1607 ])
1608
1609AC_CHECK_FUNCS(setresuid, [
1610 dnl Some platorms have setresuid that isn't implemented, test for this
1611 AC_MSG_CHECKING(if setresuid seems to work)
1612 AC_RUN_IFELSE(
1613 [AC_LANG_SOURCE([[
1614#include <stdlib.h>
1615#include <errno.h>
1616int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1617 ]])],
1618 [AC_MSG_RESULT(yes)],
1619 [AC_DEFINE(BROKEN_SETRESUID, 1,
1620 [Define if your setresuid() is broken])
1621 AC_MSG_RESULT(not implemented)],
1622 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1623 )
1624])
1625
1626AC_CHECK_FUNCS(setresgid, [
1627 dnl Some platorms have setresgid that isn't implemented, test for this
1628 AC_MSG_CHECKING(if setresgid seems to work)
1629 AC_RUN_IFELSE(
1630 [AC_LANG_SOURCE([[
1631#include <stdlib.h>
1632#include <errno.h>
1633int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1634 ]])],
1635 [AC_MSG_RESULT(yes)],
1636 [AC_DEFINE(BROKEN_SETRESGID, 1,
1637 [Define if your setresgid() is broken])
1638 AC_MSG_RESULT(not implemented)],
1639 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1640 )
1641])
1642
1643dnl Checks for time functions
1644AC_CHECK_FUNCS(gettimeofday time)
1645dnl Checks for utmp functions
1646AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1647AC_CHECK_FUNCS(utmpname)
1648dnl Checks for utmpx functions
1649AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1650AC_CHECK_FUNCS(setutxent utmpxname)
1651dnl Checks for lastlog functions
1652AC_CHECK_FUNCS(getlastlogxbyname)
1653
1654AC_CHECK_FUNC(daemon,
1655 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1656 [AC_CHECK_LIB(bsd, daemon,
1657 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1658)
1659
1660AC_CHECK_FUNC(getpagesize,
1661 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1662 [Define if your libraries define getpagesize()])],
1663 [AC_CHECK_LIB(ucb, getpagesize,
1664 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1665)
1666
1667# Check for broken snprintf
1668if test "x$ac_cv_func_snprintf" = "xyes" ; then
1669 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1670 AC_RUN_IFELSE(
1671 [AC_LANG_SOURCE([[
1672#include <stdio.h>
1673int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1674 ]])],
1675 [AC_MSG_RESULT(yes)],
1676 [
1677 AC_MSG_RESULT(no)
1678 AC_DEFINE(BROKEN_SNPRINTF, 1,
1679 [Define if your snprintf is busted])
1680 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1681 ],
1682 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1683 )
1684fi
1685
1686# If we don't have a working asprintf, then we strongly depend on vsnprintf
1687# returning the right thing on overflow: the number of characters it tried to
1688# create (as per SUSv3)
1689if test "x$ac_cv_func_asprintf" != "xyes" && \
1690 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1691 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1692 AC_RUN_IFELSE(
1693 [AC_LANG_SOURCE([[
1694#include <sys/types.h>
1695#include <stdio.h>
1696#include <stdarg.h>
1697
1698int x_snprintf(char *str,size_t count,const char *fmt,...)
1699{
1700 size_t ret; va_list ap;
1701 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1702 return ret;
1703}
1704int main(void)
1705{
1706 char x[1];
1707 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1708} ]])],
1709 [AC_MSG_RESULT(yes)],
1710 [
1711 AC_MSG_RESULT(no)
1712 AC_DEFINE(BROKEN_SNPRINTF, 1,
1713 [Define if your snprintf is busted])
1714 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1715 ],
1716 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1717 )
1718fi
1719
1720# On systems where [v]snprintf is broken, but is declared in stdio,
1721# check that the fmt argument is const char * or just char *.
1722# This is only useful for when BROKEN_SNPRINTF
1723AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1724AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1725 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1726 int main(void) { snprintf(0, 0, 0); }
1727 ]])],
1728 [AC_MSG_RESULT(yes)
1729 AC_DEFINE(SNPRINTF_CONST, [const],
1730 [Define as const if snprintf() can declare const char *fmt])],
1731 [AC_MSG_RESULT(no)
1732 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1733
1734# Check for missing getpeereid (or equiv) support
1735NO_PEERCHECK=""
1736if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
1737 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1738 AC_TRY_COMPILE(
1739 [#include <sys/types.h>
1740 #include <sys/socket.h>],
1741 [int i = SO_PEERCRED;],
1742 [ AC_MSG_RESULT(yes)
1743 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1744 ],
1745 [AC_MSG_RESULT(no)
1746 NO_PEERCHECK=1]
1747 )
1748fi
1749
1750dnl see whether mkstemp() requires XXXXXX
1751if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1752AC_MSG_CHECKING([for (overly) strict mkstemp])
1753AC_RUN_IFELSE(
1754 [AC_LANG_SOURCE([[
1755#include <stdlib.h>
1756main() { char template[]="conftest.mkstemp-test";
1757if (mkstemp(template) == -1)
1758 exit(1);
1759unlink(template); exit(0);
1760}
1761 ]])],
1762 [
1763 AC_MSG_RESULT(no)
1764 ],
1765 [
1766 AC_MSG_RESULT(yes)
1767 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1768 ],
1769 [
1770 AC_MSG_RESULT(yes)
1771 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1772 ]
1773)
1774fi
1775
1776dnl make sure that openpty does not reacquire controlling terminal
1777if test ! -z "$check_for_openpty_ctty_bug"; then
1778 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1779 AC_RUN_IFELSE(
1780 [AC_LANG_SOURCE([[
1781#include <stdio.h>
1782#include <sys/fcntl.h>
1783#include <sys/types.h>
1784#include <sys/wait.h>
1785
1786int
1787main()
1788{
1789 pid_t pid;
1790 int fd, ptyfd, ttyfd, status;
1791
1792 pid = fork();
1793 if (pid < 0) { /* failed */
1794 exit(1);
1795 } else if (pid > 0) { /* parent */
1796 waitpid(pid, &status, 0);
1797 if (WIFEXITED(status))
1798 exit(WEXITSTATUS(status));
1799 else
1800 exit(2);
1801 } else { /* child */
1802 close(0); close(1); close(2);
1803 setsid();
1804 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1805 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1806 if (fd >= 0)
1807 exit(3); /* Acquired ctty: broken */
1808 else
1809 exit(0); /* Did not acquire ctty: OK */
1810 }
1811}
1812 ]])],
1813 [
1814 AC_MSG_RESULT(yes)
1815 ],
1816 [
1817 AC_MSG_RESULT(no)
1818 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1819 ],
1820 [
1821 AC_MSG_RESULT(cross-compiling, assuming yes)
1822 ]
1823 )
1824fi
1825
1826if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1827 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1828 AC_MSG_CHECKING(if getaddrinfo seems to work)
1829 AC_RUN_IFELSE(
1830 [AC_LANG_SOURCE([[
1831#include <stdio.h>
1832#include <sys/socket.h>
1833#include <netdb.h>
1834#include <errno.h>
1835#include <netinet/in.h>
1836
1837#define TEST_PORT "2222"
1838
1839int
1840main(void)
1841{
1842 int err, sock;
1843 struct addrinfo *gai_ai, *ai, hints;
1844 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1845
1846 memset(&hints, 0, sizeof(hints));
1847 hints.ai_family = PF_UNSPEC;
1848 hints.ai_socktype = SOCK_STREAM;
1849 hints.ai_flags = AI_PASSIVE;
1850
1851 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1852 if (err != 0) {
1853 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1854 exit(1);
1855 }
1856
1857 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1858 if (ai->ai_family != AF_INET6)
1859 continue;
1860
1861 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1862 sizeof(ntop), strport, sizeof(strport),
1863 NI_NUMERICHOST|NI_NUMERICSERV);
1864
1865 if (err != 0) {
1866 if (err == EAI_SYSTEM)
1867 perror("getnameinfo EAI_SYSTEM");
1868 else
1869 fprintf(stderr, "getnameinfo failed: %s\n",
1870 gai_strerror(err));
1871 exit(2);
1872 }
1873
1874 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1875 if (sock < 0)
1876 perror("socket");
1877 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1878 if (errno == EBADF)
1879 exit(3);
1880 }
1881 }
1882 exit(0);
1883}
1884 ]])],
1885 [
1886 AC_MSG_RESULT(yes)
1887 ],
1888 [
1889 AC_MSG_RESULT(no)
1890 AC_DEFINE(BROKEN_GETADDRINFO)
1891 ],
1892 [
1893 AC_MSG_RESULT(cross-compiling, assuming yes)
1894 ]
1895 )
1896fi
1897
1898if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1899 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1900 AC_MSG_CHECKING(if getaddrinfo seems to work)
1901 AC_RUN_IFELSE(
1902 [AC_LANG_SOURCE([[
1903#include <stdio.h>
1904#include <sys/socket.h>
1905#include <netdb.h>
1906#include <errno.h>
1907#include <netinet/in.h>
1908
1909#define TEST_PORT "2222"
1910
1911int
1912main(void)
1913{
1914 int err, sock;
1915 struct addrinfo *gai_ai, *ai, hints;
1916 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1917
1918 memset(&hints, 0, sizeof(hints));
1919 hints.ai_family = PF_UNSPEC;
1920 hints.ai_socktype = SOCK_STREAM;
1921 hints.ai_flags = AI_PASSIVE;
1922
1923 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1924 if (err != 0) {
1925 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1926 exit(1);
1927 }
1928
1929 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1930 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1931 continue;
1932
1933 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1934 sizeof(ntop), strport, sizeof(strport),
1935 NI_NUMERICHOST|NI_NUMERICSERV);
1936
1937 if (ai->ai_family == AF_INET && err != 0) {
1938 perror("getnameinfo");
1939 exit(2);
1940 }
1941 }
1942 exit(0);
1943}
1944 ]])],
1945 [
1946 AC_MSG_RESULT(yes)
1947 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1948 [Define if you have a getaddrinfo that fails
1949 for the all-zeros IPv6 address])
1950 ],
1951 [
1952 AC_MSG_RESULT(no)
1953 AC_DEFINE(BROKEN_GETADDRINFO)
1954 ],
1955 [
1956 AC_MSG_RESULT(cross-compiling, assuming no)
1957 ]
1958 )
1959fi
1960
1961if test "x$check_for_conflicting_getspnam" = "x1"; then
1962 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1963 AC_COMPILE_IFELSE(
1964 [
1965#include <shadow.h>
1966int main(void) {exit(0);}
1967 ],
1968 [
1969 AC_MSG_RESULT(no)
1970 ],
1971 [
1972 AC_MSG_RESULT(yes)
1973 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1974 [Conflicting defs for getspnam])
1975 ]
1976 )
1977fi
1978
1979AC_FUNC_GETPGRP
1980
1981# Search for OpenSSL
1982saved_CPPFLAGS="$CPPFLAGS"
1983saved_LDFLAGS="$LDFLAGS"
1984AC_ARG_WITH(ssl-dir,
1985 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1986 [
1987 if test "x$withval" != "xno" ; then
1988 case "$withval" in
1989 # Relative paths
1990 ./*|../*) withval="`pwd`/$withval"
1991 esac
1992 if test -d "$withval/lib"; then
1993 if test -n "${need_dash_r}"; then
1994 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1995 else
1996 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1997 fi
1998 else
1999 if test -n "${need_dash_r}"; then
2000 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2001 else
2002 LDFLAGS="-L${withval} ${LDFLAGS}"
2003 fi
2004 fi
2005 if test -d "$withval/include"; then
2006 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2007 else
2008 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2009 fi
2010 fi
2011 ]
2012)
2013if test -z "$GLOBUS_LDFLAGS" ; then
2014LIBS="-lcrypto $LIBS"
2015fi
2016AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
2017 [Define if your ssl headers are included
2018 with #include <openssl/header.h>]),
2019 [
2020 dnl Check default openssl install dir
2021 if test -n "${need_dash_r}"; then
2022 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
2023 else
2024 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
2025 fi
2026 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
2027 AC_CHECK_HEADER([openssl/opensslv.h], ,
2028 AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***]))
2029 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
2030 [
2031 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2032 ]
2033 )
2034 ]
2035)
2036
2037# Determine OpenSSL header version
2038AC_MSG_CHECKING([OpenSSL header version])
2039AC_RUN_IFELSE(
2040 [AC_LANG_SOURCE([[
2041#include <stdio.h>
2042#include <string.h>
2043#include <openssl/opensslv.h>
2044#define DATA "conftest.sslincver"
2045int main(void) {
2046 FILE *fd;
2047 int rc;
2048
2049 fd = fopen(DATA,"w");
2050 if(fd == NULL)
2051 exit(1);
2052
2053 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2054 exit(1);
2055
2056 exit(0);
2057}
2058 ]])],
2059 [
2060 ssl_header_ver=`cat conftest.sslincver`
2061 AC_MSG_RESULT($ssl_header_ver)
2062 ],
2063 [
2064 AC_MSG_RESULT(not found)
2065 AC_MSG_ERROR(OpenSSL version header not found.)
2066 ],
2067 [
2068 AC_MSG_WARN([cross compiling: not checking])
2069 ]
2070)
2071
2072# Determine OpenSSL library version
2073AC_MSG_CHECKING([OpenSSL library version])
2074AC_RUN_IFELSE(
2075 [AC_LANG_SOURCE([[
2076#include <stdio.h>
2077#include <string.h>
2078#include <openssl/opensslv.h>
2079#include <openssl/crypto.h>
2080#define DATA "conftest.ssllibver"
2081int main(void) {
2082 FILE *fd;
2083 int rc;
2084
2085 fd = fopen(DATA,"w");
2086 if(fd == NULL)
2087 exit(1);
2088
2089 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2090 exit(1);
2091
2092 exit(0);
2093}
2094 ]])],
2095 [
2096 ssl_library_ver=`cat conftest.ssllibver`
2097 AC_MSG_RESULT($ssl_library_ver)
2098 ],
2099 [
2100 AC_MSG_RESULT(not found)
2101 AC_MSG_ERROR(OpenSSL library not found.)
2102 ],
2103 [
2104 AC_MSG_WARN([cross compiling: not checking])
2105 ]
2106)
2107
2108AC_ARG_WITH(openssl-header-check,
2109 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2110 [ if test "x$withval" = "xno" ; then
2111 openssl_check_nonfatal=1
2112 fi
2113 ]
2114)
2115
2116# Sanity check OpenSSL headers
2117AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2118AC_RUN_IFELSE(
2119 [AC_LANG_SOURCE([[
2120#include <string.h>
2121#include <openssl/opensslv.h>
2122int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
2123 ]])],
2124 [
2125 AC_MSG_RESULT(yes)
2126 ],
2127 [
2128 AC_MSG_RESULT(no)
2129 if test "x$openssl_check_nonfatal" = "x"; then
2130 AC_MSG_ERROR([Your OpenSSL headers do not match your
2131library. Check config.log for details.
2132If you are sure your installation is consistent, you can disable the check
2133by running "./configure --without-openssl-header-check".
2134Also see contrib/findssl.sh for help identifying header/library mismatches.
2135])
2136 else
2137 AC_MSG_WARN([Your OpenSSL headers do not match your
2138library. Check config.log for details.
2139Also see contrib/findssl.sh for help identifying header/library mismatches.])
2140 fi
2141 ],
2142 [
2143 AC_MSG_WARN([cross compiling: not checking])
2144 ]
2145)
2146
2147AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2148AC_LINK_IFELSE(
2149 [AC_LANG_SOURCE([[
2150#include <openssl/evp.h>
2151int main(void) { SSLeay_add_all_algorithms(); }
2152 ]])],
2153 [
2154 AC_MSG_RESULT(yes)
2155 ],
2156 [
2157 AC_MSG_RESULT(no)
2158 saved_LIBS="$LIBS"
2159 LIBS="$LIBS -ldl"
2160 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2161 AC_LINK_IFELSE(
2162 [AC_LANG_SOURCE([[
2163#include <openssl/evp.h>
2164int main(void) { SSLeay_add_all_algorithms(); }
2165 ]])],
2166 [
2167 AC_MSG_RESULT(yes)
2168 ],
2169 [
2170 AC_MSG_RESULT(no)
2171 LIBS="$saved_LIBS"
2172 ]
2173 )
2174 ]
2175)
2176
2177AC_ARG_WITH(ssl-engine,
2178 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2179 [ if test "x$withval" != "xno" ; then
2180 AC_MSG_CHECKING(for OpenSSL ENGINE support)
2181 AC_TRY_COMPILE(
2182 [ #include <openssl/engine.h>],
2183 [
2184ENGINE_load_builtin_engines();ENGINE_register_all_complete();
2185 ],
2186 [ AC_MSG_RESULT(yes)
2187 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
2188 [Enable OpenSSL engine support])
2189 ],
2190 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
2191 )
2192 fi ]
2193)
2194
2195# Check for OpenSSL without EVP_aes_{192,256}_cbc
2196AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2197AC_LINK_IFELSE(
2198 [AC_LANG_SOURCE([[
2199#include <string.h>
2200#include <openssl/evp.h>
2201int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
2202 ]])],
2203 [
2204 AC_MSG_RESULT(no)
2205 ],
2206 [
2207 AC_MSG_RESULT(yes)
2208 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2209 [libcrypto is missing AES 192 and 256 bit functions])
2210 ]
2211)
2212
2213AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2214AC_LINK_IFELSE(
2215 [AC_LANG_SOURCE([[
2216#include <string.h>
2217#include <openssl/evp.h>
2218int main(void) { if(EVP_DigestUpdate(NULL, NULL,0)) exit(0); }
2219 ]])],
2220 [
2221 AC_MSG_RESULT(yes)
2222 ],
2223 [
2224 AC_MSG_RESULT(no)
2225 AC_DEFINE(OPENSSL_EVP_DIGESTUPDATE_VOID, 1,
2226 [Define if EVP_DigestUpdate returns void])
2227 ]
2228)
2229
2230# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2231# because the system crypt() is more featureful.
2232if test "x$check_for_libcrypt_before" = "x1"; then
2233 AC_CHECK_LIB(crypt, crypt)
2234fi
2235
2236# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2237# version in OpenSSL.
2238if test "x$check_for_libcrypt_later" = "x1"; then
2239 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
2240fi
2241
2242# Search for SHA256 support in libc and/or OpenSSL
2243AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2244
2245saved_LIBS="$LIBS"
2246AC_CHECK_LIB(iaf, ia_openinfo, [
2247 LIBS="$LIBS -liaf"
2248 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2249 AC_DEFINE(HAVE_LIBIAF, 1,
2250 [Define if system has libiaf that supports set_id])
2251 ])
2252])
2253LIBS="$saved_LIBS"
2254
2255### Configure cryptographic random number support
2256
2257# Check wheter OpenSSL seeds itself
2258AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2259AC_RUN_IFELSE(
2260 [AC_LANG_SOURCE([[
2261#include <string.h>
2262#include <openssl/rand.h>
2263int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
2264 ]])],
2265 [
2266 OPENSSL_SEEDS_ITSELF=yes
2267 AC_MSG_RESULT(yes)
2268 ],
2269 [
2270 AC_MSG_RESULT(no)
2271 # Default to use of the rand helper if OpenSSL doesn't
2272 # seed itself
2273 USE_RAND_HELPER=yes
2274 ],
2275 [
2276 AC_MSG_WARN([cross compiling: assuming yes])
2277 # This is safe, since all recent OpenSSL versions will
2278 # complain at runtime if not seeded correctly.
2279 OPENSSL_SEEDS_ITSELF=yes
2280 ]
2281)
2282
2283# Check for PAM libs
2284PAM_MSG="no"
2285AC_ARG_WITH(pam,
2286 [ --with-pam Enable PAM support ],
2287 [
2288 if test "x$withval" != "xno" ; then
2289 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2290 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2291 AC_MSG_ERROR([PAM headers not found])
2292 fi
2293
2294 saved_LIBS="$LIBS"
2295 AC_CHECK_LIB(dl, dlopen, , )
2296 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2297 AC_CHECK_FUNCS(pam_getenvlist)
2298 AC_CHECK_FUNCS(pam_putenv)
2299 LIBS="$saved_LIBS"
2300
2301 PAM_MSG="yes"
2302
2303 SSHDLIBS="$SSHDLIBS -lpam"
2304 AC_DEFINE(USE_PAM, 1,
2305 [Define if you want to enable PAM support])
2306
2307 if test $ac_cv_lib_dl_dlopen = yes; then
2308 case "$LIBS" in
2309 *-ldl*)
2310 # libdl already in LIBS
2311 ;;
2312 *)
2313 SSHDLIBS="$SSHDLIBS -ldl"
2314 ;;
2315 esac
2316 fi
2317 fi
2318 ]
2319)
2320
2321# Check for older PAM
2322if test "x$PAM_MSG" = "xyes" ; then
2323 # Check PAM strerror arguments (old PAM)
2324 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2325 AC_TRY_COMPILE(
2326 [
2327#include <stdlib.h>
2328#if defined(HAVE_SECURITY_PAM_APPL_H)
2329#include <security/pam_appl.h>
2330#elif defined (HAVE_PAM_PAM_APPL_H)
2331#include <pam/pam_appl.h>
2332#endif
2333 ],
2334 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2335 [AC_MSG_RESULT(no)],
2336 [
2337 AC_DEFINE(HAVE_OLD_PAM, 1,
2338 [Define if you have an old version of PAM
2339 which takes only one argument to pam_strerror])
2340 AC_MSG_RESULT(yes)
2341 PAM_MSG="yes (old library)"
2342 ]
2343 )
2344fi
2345
2346# Do we want to force the use of the rand helper?
2347AC_ARG_WITH(rand-helper,
2348 [ --with-rand-helper Use subprocess to gather strong randomness ],
2349 [
2350 if test "x$withval" = "xno" ; then
2351 # Force use of OpenSSL's internal RNG, even if
2352 # the previous test showed it to be unseeded.
2353 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2354 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2355 OPENSSL_SEEDS_ITSELF=yes
2356 USE_RAND_HELPER=""
2357 fi
2358 else
2359 USE_RAND_HELPER=yes
2360 fi
2361 ],
2362)
2363
2364# Which randomness source do we use?
2365if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
2366 # OpenSSL only
2367 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2368 [Define if you want OpenSSL's internally seeded PRNG only])
2369 RAND_MSG="OpenSSL internal ONLY"
2370 INSTALL_SSH_RAND_HELPER=""
2371elif test ! -z "$USE_RAND_HELPER" ; then
2372 # install rand helper
2373 RAND_MSG="ssh-rand-helper"
2374 INSTALL_SSH_RAND_HELPER="yes"
2375fi
2376AC_SUBST(INSTALL_SSH_RAND_HELPER)
2377
2378### Configuration of ssh-rand-helper
2379
2380# PRNGD TCP socket
2381AC_ARG_WITH(prngd-port,
2382 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2383 [
2384 case "$withval" in
2385 no)
2386 withval=""
2387 ;;
2388 [[0-9]]*)
2389 ;;
2390 *)
2391 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2392 ;;
2393 esac
2394 if test ! -z "$withval" ; then
2395 PRNGD_PORT="$withval"
2396 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2397 [Port number of PRNGD/EGD random number socket])
2398 fi
2399 ]
2400)
2401
2402# PRNGD Unix domain socket
2403AC_ARG_WITH(prngd-socket,
2404 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2405 [
2406 case "$withval" in
2407 yes)
2408 withval="/var/run/egd-pool"
2409 ;;
2410 no)
2411 withval=""
2412 ;;
2413 /*)
2414 ;;
2415 *)
2416 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2417 ;;
2418 esac
2419
2420 if test ! -z "$withval" ; then
2421 if test ! -z "$PRNGD_PORT" ; then
2422 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2423 fi
2424 if test ! -r "$withval" ; then
2425 AC_MSG_WARN(Entropy socket is not readable)
2426 fi
2427 PRNGD_SOCKET="$withval"
2428 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2429 [Location of PRNGD/EGD random number socket])
2430 fi
2431 ],
2432 [
2433 # Check for existing socket only if we don't have a random device already
2434 if test "$USE_RAND_HELPER" = yes ; then
2435 AC_MSG_CHECKING(for PRNGD/EGD socket)
2436 # Insert other locations here
2437 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2438 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2439 PRNGD_SOCKET="$sock"
2440 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2441 break;
2442 fi
2443 done
2444 if test ! -z "$PRNGD_SOCKET" ; then
2445 AC_MSG_RESULT($PRNGD_SOCKET)
2446 else
2447 AC_MSG_RESULT(not found)
2448 fi
2449 fi
2450 ]
2451)
2452
2453# Change default command timeout for hashing entropy source
2454entropy_timeout=200
2455AC_ARG_WITH(entropy-timeout,
2456 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2457 [
2458 if test -n "$withval" && test "x$withval" != "xno" && \
2459 test "x${withval}" != "xyes"; then
2460 entropy_timeout=$withval
2461 fi
2462 ]
2463)
2464AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2465 [Builtin PRNG command timeout])
2466
2467SSH_PRIVSEP_USER=sshd
2468AC_ARG_WITH(privsep-user,
2469 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
2470 [
2471 if test -n "$withval" && test "x$withval" != "xno" && \
2472 test "x${withval}" != "xyes"; then
2473 SSH_PRIVSEP_USER=$withval
2474 fi
2475 ]
2476)
2477AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2478 [non-privileged user for privilege separation])
2479AC_SUBST(SSH_PRIVSEP_USER)
2480
2481# We do this little dance with the search path to insure
2482# that programs that we select for use by installed programs
2483# (which may be run by the super-user) come from trusted
2484# locations before they come from the user's private area.
2485# This should help avoid accidentally configuring some
2486# random version of a program in someone's personal bin.
2487
2488OPATH=$PATH
2489PATH=/bin:/usr/bin
2490test -h /bin 2> /dev/null && PATH=/usr/bin
2491test -d /sbin && PATH=$PATH:/sbin
2492test -d /usr/sbin && PATH=$PATH:/usr/sbin
2493PATH=$PATH:/etc:$OPATH
2494
2495# These programs are used by the command hashing source to gather entropy
2496OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2497OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2498OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2499OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2500OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2501OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2502OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2503OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2504OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2505OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2506OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2507OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2508OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2509OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2510OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2511OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2512# restore PATH
2513PATH=$OPATH
2514
2515# Where does ssh-rand-helper get its randomness from?
2516INSTALL_SSH_PRNG_CMDS=""
2517if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2518 if test ! -z "$PRNGD_PORT" ; then
2519 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2520 elif test ! -z "$PRNGD_SOCKET" ; then
2521 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2522 else
2523 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2524 RAND_HELPER_CMDHASH=yes
2525 INSTALL_SSH_PRNG_CMDS="yes"
2526 fi
2527fi
2528AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2529
2530
2531# Cheap hack to ensure NEWS-OS libraries are arranged right.
2532if test ! -z "$SONY" ; then
2533 LIBS="$LIBS -liberty";
2534fi
2535
2536# Check for long long datatypes
2537AC_CHECK_TYPES([long long, unsigned long long, long double])
2538
2539# Check datatype sizes
2540AC_CHECK_SIZEOF(char, 1)
2541AC_CHECK_SIZEOF(short int, 2)
2542AC_CHECK_SIZEOF(int, 4)
2543AC_CHECK_SIZEOF(long int, 4)
2544AC_CHECK_SIZEOF(long long int, 8)
2545
2546# Sanity check long long for some platforms (AIX)
2547if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2548 ac_cv_sizeof_long_long_int=0
2549fi
2550
2551# compute LLONG_MIN and LLONG_MAX if we don't know them.
2552if test -z "$have_llong_max"; then
2553 AC_MSG_CHECKING([for max value of long long])
2554 AC_RUN_IFELSE(
2555 [AC_LANG_SOURCE([[
2556#include <stdio.h>
2557/* Why is this so damn hard? */
2558#ifdef __GNUC__
2559# undef __GNUC__
2560#endif
2561#define __USE_ISOC99
2562#include <limits.h>
2563#define DATA "conftest.llminmax"
2564#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2565
2566/*
2567 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2568 * we do this the hard way.
2569 */
2570static int
2571fprint_ll(FILE *f, long long n)
2572{
2573 unsigned int i;
2574 int l[sizeof(long long) * 8];
2575
2576 if (n < 0)
2577 if (fprintf(f, "-") < 0)
2578 return -1;
2579 for (i = 0; n != 0; i++) {
2580 l[i] = my_abs(n % 10);
2581 n /= 10;
2582 }
2583 do {
2584 if (fprintf(f, "%d", l[--i]) < 0)
2585 return -1;
2586 } while (i != 0);
2587 if (fprintf(f, " ") < 0)
2588 return -1;
2589 return 0;
2590}
2591
2592int main(void) {
2593 FILE *f;
2594 long long i, llmin, llmax = 0;
2595
2596 if((f = fopen(DATA,"w")) == NULL)
2597 exit(1);
2598
2599#if defined(LLONG_MIN) && defined(LLONG_MAX)
2600 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2601 llmin = LLONG_MIN;
2602 llmax = LLONG_MAX;
2603#else
2604 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2605 /* This will work on one's complement and two's complement */
2606 for (i = 1; i > llmax; i <<= 1, i++)
2607 llmax = i;
2608 llmin = llmax + 1LL; /* wrap */
2609#endif
2610
2611 /* Sanity check */
2612 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2613 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2614 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
2615 fprintf(f, "unknown unknown\n");
2616 exit(2);
2617 }
2618
2619 if (fprint_ll(f, llmin) < 0)
2620 exit(3);
2621 if (fprint_ll(f, llmax) < 0)
2622 exit(4);
2623 if (fclose(f) < 0)
2624 exit(5);
2625 exit(0);
2626}
2627 ]])],
2628 [
2629 llong_min=`$AWK '{print $1}' conftest.llminmax`
2630 llong_max=`$AWK '{print $2}' conftest.llminmax`
2631
2632 AC_MSG_RESULT($llong_max)
2633 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2634 [max value of long long calculated by configure])
2635 AC_MSG_CHECKING([for min value of long long])
2636 AC_MSG_RESULT($llong_min)
2637 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2638 [min value of long long calculated by configure])
2639 ],
2640 [
2641 AC_MSG_RESULT(not found)
2642 ],
2643 [
2644 AC_MSG_WARN([cross compiling: not checking])
2645 ]
2646 )
2647fi
2648
2649
2650# More checks for data types
2651AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2652 AC_TRY_COMPILE(
2653 [ #include <sys/types.h> ],
2654 [ u_int a; a = 1;],
2655 [ ac_cv_have_u_int="yes" ],
2656 [ ac_cv_have_u_int="no" ]
2657 )
2658])
2659if test "x$ac_cv_have_u_int" = "xyes" ; then
2660 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2661 have_u_int=1
2662fi
2663
2664AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2665 AC_TRY_COMPILE(
2666 [ #include <sys/types.h> ],
2667 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2668 [ ac_cv_have_intxx_t="yes" ],
2669 [ ac_cv_have_intxx_t="no" ]
2670 )
2671])
2672if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2673 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2674 have_intxx_t=1
2675fi
2676
2677if (test -z "$have_intxx_t" && \
2678 test "x$ac_cv_header_stdint_h" = "xyes")
2679then
2680 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2681 AC_TRY_COMPILE(
2682 [ #include <stdint.h> ],
2683 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2684 [
2685 AC_DEFINE(HAVE_INTXX_T)
2686 AC_MSG_RESULT(yes)
2687 ],
2688 [ AC_MSG_RESULT(no) ]
2689 )
2690fi
2691
2692AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2693 AC_TRY_COMPILE(
2694 [
2695#include <sys/types.h>
2696#ifdef HAVE_STDINT_H
2697# include <stdint.h>
2698#endif
2699#include <sys/socket.h>
2700#ifdef HAVE_SYS_BITYPES_H
2701# include <sys/bitypes.h>
2702#endif
2703 ],
2704 [ int64_t a; a = 1;],
2705 [ ac_cv_have_int64_t="yes" ],
2706 [ ac_cv_have_int64_t="no" ]
2707 )
2708])
2709if test "x$ac_cv_have_int64_t" = "xyes" ; then
2710 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2711fi
2712
2713AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2714 AC_TRY_COMPILE(
2715 [ #include <sys/types.h> ],
2716 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2717 [ ac_cv_have_u_intxx_t="yes" ],
2718 [ ac_cv_have_u_intxx_t="no" ]
2719 )
2720])
2721if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2722 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2723 have_u_intxx_t=1
2724fi
2725
2726if test -z "$have_u_intxx_t" ; then
2727 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2728 AC_TRY_COMPILE(
2729 [ #include <sys/socket.h> ],
2730 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2731 [
2732 AC_DEFINE(HAVE_U_INTXX_T)
2733 AC_MSG_RESULT(yes)
2734 ],
2735 [ AC_MSG_RESULT(no) ]
2736 )
2737fi
2738
2739AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2740 AC_TRY_COMPILE(
2741 [ #include <sys/types.h> ],
2742 [ u_int64_t a; a = 1;],
2743 [ ac_cv_have_u_int64_t="yes" ],
2744 [ ac_cv_have_u_int64_t="no" ]
2745 )
2746])
2747if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2748 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2749 have_u_int64_t=1
2750fi
2751
2752if test -z "$have_u_int64_t" ; then
2753 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2754 AC_TRY_COMPILE(
2755 [ #include <sys/bitypes.h> ],
2756 [ u_int64_t a; a = 1],
2757 [
2758 AC_DEFINE(HAVE_U_INT64_T)
2759 AC_MSG_RESULT(yes)
2760 ],
2761 [ AC_MSG_RESULT(no) ]
2762 )
2763fi
2764
2765if test -z "$have_u_intxx_t" ; then
2766 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2767 AC_TRY_COMPILE(
2768 [
2769#include <sys/types.h>
2770 ],
2771 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2772 [ ac_cv_have_uintxx_t="yes" ],
2773 [ ac_cv_have_uintxx_t="no" ]
2774 )
2775 ])
2776 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2777 AC_DEFINE(HAVE_UINTXX_T, 1,
2778 [define if you have uintxx_t data type])
2779 fi
2780fi
2781
2782if test -z "$have_uintxx_t" ; then
2783 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2784 AC_TRY_COMPILE(
2785 [ #include <stdint.h> ],
2786 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2787 [
2788 AC_DEFINE(HAVE_UINTXX_T)
2789 AC_MSG_RESULT(yes)
2790 ],
2791 [ AC_MSG_RESULT(no) ]
2792 )
2793fi
2794
2795if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2796 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2797then
2798 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2799 AC_TRY_COMPILE(
2800 [
2801#include <sys/bitypes.h>
2802 ],
2803 [
2804 int8_t a; int16_t b; int32_t c;
2805 u_int8_t e; u_int16_t f; u_int32_t g;
2806 a = b = c = e = f = g = 1;
2807 ],
2808 [
2809 AC_DEFINE(HAVE_U_INTXX_T)
2810 AC_DEFINE(HAVE_INTXX_T)
2811 AC_MSG_RESULT(yes)
2812 ],
2813 [AC_MSG_RESULT(no)]
2814 )
2815fi
2816
2817
2818AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2819 AC_TRY_COMPILE(
2820 [
2821#include <sys/types.h>
2822 ],
2823 [ u_char foo; foo = 125; ],
2824 [ ac_cv_have_u_char="yes" ],
2825 [ ac_cv_have_u_char="no" ]
2826 )
2827])
2828if test "x$ac_cv_have_u_char" = "xyes" ; then
2829 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2830fi
2831
2832TYPE_SOCKLEN_T
2833
2834AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2835AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t],,,[
2836#include <sys/types.h>
2837#ifdef HAVE_SYS_BITYPES_H
2838#include <sys/bitypes.h>
2839#endif
2840#ifdef HAVE_SYS_STATFS_H
2841#include <sys/statfs.h>
2842#endif
2843#ifdef HAVE_SYS_STATVFS_H
2844#include <sys/statvfs.h>
2845#endif
2846])
2847
2848AC_CHECK_TYPES([in_addr_t, in_port_t],,,
2849[#include <sys/types.h>
2850#include <netinet/in.h>])
2851
2852AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2853 AC_TRY_COMPILE(
2854 [
2855#include <sys/types.h>
2856 ],
2857 [ size_t foo; foo = 1235; ],
2858 [ ac_cv_have_size_t="yes" ],
2859 [ ac_cv_have_size_t="no" ]
2860 )
2861])
2862if test "x$ac_cv_have_size_t" = "xyes" ; then
2863 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2864fi
2865
2866AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2867 AC_TRY_COMPILE(
2868 [
2869#include <sys/types.h>
2870 ],
2871 [ ssize_t foo; foo = 1235; ],
2872 [ ac_cv_have_ssize_t="yes" ],
2873 [ ac_cv_have_ssize_t="no" ]
2874 )
2875])
2876if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2877 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2878fi
2879
2880AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2881 AC_TRY_COMPILE(
2882 [
2883#include <time.h>
2884 ],
2885 [ clock_t foo; foo = 1235; ],
2886 [ ac_cv_have_clock_t="yes" ],
2887 [ ac_cv_have_clock_t="no" ]
2888 )
2889])
2890if test "x$ac_cv_have_clock_t" = "xyes" ; then
2891 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2892fi
2893
2894AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2895 AC_TRY_COMPILE(
2896 [
2897#include <sys/types.h>
2898#include <sys/socket.h>
2899 ],
2900 [ sa_family_t foo; foo = 1235; ],
2901 [ ac_cv_have_sa_family_t="yes" ],
2902 [ AC_TRY_COMPILE(
2903 [
2904#include <sys/types.h>
2905#include <sys/socket.h>
2906#include <netinet/in.h>
2907 ],
2908 [ sa_family_t foo; foo = 1235; ],
2909 [ ac_cv_have_sa_family_t="yes" ],
2910
2911 [ ac_cv_have_sa_family_t="no" ]
2912 )]
2913 )
2914])
2915if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2916 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2917 [define if you have sa_family_t data type])
2918fi
2919
2920AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2921 AC_TRY_COMPILE(
2922 [
2923#include <sys/types.h>
2924 ],
2925 [ pid_t foo; foo = 1235; ],
2926 [ ac_cv_have_pid_t="yes" ],
2927 [ ac_cv_have_pid_t="no" ]
2928 )
2929])
2930if test "x$ac_cv_have_pid_t" = "xyes" ; then
2931 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2932fi
2933
2934AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2935 AC_TRY_COMPILE(
2936 [
2937#include <sys/types.h>
2938 ],
2939 [ mode_t foo; foo = 1235; ],
2940 [ ac_cv_have_mode_t="yes" ],
2941 [ ac_cv_have_mode_t="no" ]
2942 )
2943])
2944if test "x$ac_cv_have_mode_t" = "xyes" ; then
2945 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2946fi
2947
2948
2949AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2950 AC_TRY_COMPILE(
2951 [
2952#include <sys/types.h>
2953#include <sys/socket.h>
2954 ],
2955 [ struct sockaddr_storage s; ],
2956 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2957 [ ac_cv_have_struct_sockaddr_storage="no" ]
2958 )
2959])
2960if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2961 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2962 [define if you have struct sockaddr_storage data type])
2963fi
2964
2965AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2966 AC_TRY_COMPILE(
2967 [
2968#include <sys/types.h>
2969#include <netinet/in.h>
2970 ],
2971 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2972 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2973 [ ac_cv_have_struct_sockaddr_in6="no" ]
2974 )
2975])
2976if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2977 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2978 [define if you have struct sockaddr_in6 data type])
2979fi
2980
2981AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2982 AC_TRY_COMPILE(
2983 [
2984#include <sys/types.h>
2985#include <netinet/in.h>
2986 ],
2987 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2988 [ ac_cv_have_struct_in6_addr="yes" ],
2989 [ ac_cv_have_struct_in6_addr="no" ]
2990 )
2991])
2992if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2993 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2994 [define if you have struct in6_addr data type])
2995
2996dnl Now check for sin6_scope_id
2997 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
2998 [
2999#ifdef HAVE_SYS_TYPES_H
3000#include <sys/types.h>
3001#endif
3002#include <netinet/in.h>
3003 ])
3004fi
3005
3006AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
3007 AC_TRY_COMPILE(
3008 [
3009#include <sys/types.h>
3010#include <sys/socket.h>
3011#include <netdb.h>
3012 ],
3013 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
3014 [ ac_cv_have_struct_addrinfo="yes" ],
3015 [ ac_cv_have_struct_addrinfo="no" ]
3016 )
3017])
3018if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
3019 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
3020 [define if you have struct addrinfo data type])
3021fi
3022
3023AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
3024 AC_TRY_COMPILE(
3025 [ #include <sys/time.h> ],
3026 [ struct timeval tv; tv.tv_sec = 1;],
3027 [ ac_cv_have_struct_timeval="yes" ],
3028 [ ac_cv_have_struct_timeval="no" ]
3029 )
3030])
3031if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
3032 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
3033 have_struct_timeval=1
3034fi
3035
3036AC_CHECK_TYPES(struct timespec)
3037
3038# We need int64_t or else certian parts of the compile will fail.
3039if test "x$ac_cv_have_int64_t" = "xno" && \
3040 test "x$ac_cv_sizeof_long_int" != "x8" && \
3041 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
3042 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3043 echo "an alternative compiler (I.E., GCC) before continuing."
3044 echo ""
3045 exit 1;
3046else
3047dnl test snprintf (broken on SCO w/gcc)
3048 AC_RUN_IFELSE(
3049 [AC_LANG_SOURCE([[
3050#include <stdio.h>
3051#include <string.h>
3052#ifdef HAVE_SNPRINTF
3053main()
3054{
3055 char buf[50];
3056 char expected_out[50];
3057 int mazsize = 50 ;
3058#if (SIZEOF_LONG_INT == 8)
3059 long int num = 0x7fffffffffffffff;
3060#else
3061 long long num = 0x7fffffffffffffffll;
3062#endif
3063 strcpy(expected_out, "9223372036854775807");
3064 snprintf(buf, mazsize, "%lld", num);
3065 if(strcmp(buf, expected_out) != 0)
3066 exit(1);
3067 exit(0);
3068}
3069#else
3070main() { exit(0); }
3071#endif
3072 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
3073 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
3074 )
3075fi
3076
3077dnl Checks for structure members
3078OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
3079OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
3080OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
3081OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
3082OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
3083OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
3084OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
3085OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
3086OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
3087OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
3088OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
3089OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
3090OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
3091OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
3092OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
3093OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
3094OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
3095
3096AC_CHECK_MEMBERS([struct stat.st_blksize])
3097AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
3098 [Define if we don't have struct __res_state in resolv.h])],
3099[
3100#include <stdio.h>
3101#if HAVE_SYS_TYPES_H
3102# include <sys/types.h>
3103#endif
3104#include <netinet/in.h>
3105#include <arpa/nameser.h>
3106#include <resolv.h>
3107])
3108
3109AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3110 ac_cv_have_ss_family_in_struct_ss, [
3111 AC_TRY_COMPILE(
3112 [
3113#include <sys/types.h>
3114#include <sys/socket.h>
3115 ],
3116 [ struct sockaddr_storage s; s.ss_family = 1; ],
3117 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3118 [ ac_cv_have_ss_family_in_struct_ss="no" ],
3119 )
3120])
3121if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
3122 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
3123fi
3124
3125AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3126 ac_cv_have___ss_family_in_struct_ss, [
3127 AC_TRY_COMPILE(
3128 [
3129#include <sys/types.h>
3130#include <sys/socket.h>
3131 ],
3132 [ struct sockaddr_storage s; s.__ss_family = 1; ],
3133 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3134 [ ac_cv_have___ss_family_in_struct_ss="no" ]
3135 )
3136])
3137if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
3138 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
3139 [Fields in struct sockaddr_storage])
3140fi
3141
3142AC_CACHE_CHECK([for pw_class field in struct passwd],
3143 ac_cv_have_pw_class_in_struct_passwd, [
3144 AC_TRY_COMPILE(
3145 [
3146#include <pwd.h>
3147 ],
3148 [ struct passwd p; p.pw_class = 0; ],
3149 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3150 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
3151 )
3152])
3153if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
3154 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
3155 [Define if your password has a pw_class field])
3156fi
3157
3158AC_CACHE_CHECK([for pw_expire field in struct passwd],
3159 ac_cv_have_pw_expire_in_struct_passwd, [
3160 AC_TRY_COMPILE(
3161 [
3162#include <pwd.h>
3163 ],
3164 [ struct passwd p; p.pw_expire = 0; ],
3165 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3166 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
3167 )
3168])
3169if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
3170 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
3171 [Define if your password has a pw_expire field])
3172fi
3173
3174AC_CACHE_CHECK([for pw_change field in struct passwd],
3175 ac_cv_have_pw_change_in_struct_passwd, [
3176 AC_TRY_COMPILE(
3177 [
3178#include <pwd.h>
3179 ],
3180 [ struct passwd p; p.pw_change = 0; ],
3181 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3182 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
3183 )
3184])
3185if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
3186 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
3187 [Define if your password has a pw_change field])
3188fi
3189
3190dnl make sure we're using the real structure members and not defines
3191AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3192 ac_cv_have_accrights_in_msghdr, [
3193 AC_COMPILE_IFELSE(
3194 [
3195#include <sys/types.h>
3196#include <sys/socket.h>
3197#include <sys/uio.h>
3198int main() {
3199#ifdef msg_accrights
3200#error "msg_accrights is a macro"
3201exit(1);
3202#endif
3203struct msghdr m;
3204m.msg_accrights = 0;
3205exit(0);
3206}
3207 ],
3208 [ ac_cv_have_accrights_in_msghdr="yes" ],
3209 [ ac_cv_have_accrights_in_msghdr="no" ]
3210 )
3211])
3212if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
3213 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
3214 [Define if your system uses access rights style
3215 file descriptor passing])
3216fi
3217
3218AC_MSG_CHECKING(if struct statvfs.f_fsid is integral type)
3219AC_TRY_COMPILE([
3220#include <sys/types.h>
3221#include <sys/stat.h>
3222#ifdef HAVE_SYS_TIME_H
3223# include <sys/time.h>
3224#endif
3225#ifdef HAVE_SYS_MOUNT_H
3226#include <sys/mount.h>
3227#endif
3228#ifdef HAVE_SYS_STATVFS_H
3229#include <sys/statvfs.h>
3230#endif
3231], [struct statvfs s; s.f_fsid = 0;],
3232[ AC_MSG_RESULT(yes) ],
3233[ AC_MSG_RESULT(no)
3234
3235 AC_MSG_CHECKING(if fsid_t has member val)
3236 AC_TRY_COMPILE([
3237#include <sys/types.h>
3238#include <sys/statvfs.h>],
3239 [fsid_t t; t.val[0] = 0;],
3240 [ AC_MSG_RESULT(yes)
3241 AC_DEFINE(FSID_HAS_VAL, 1, fsid_t has member val) ],
3242 [ AC_MSG_RESULT(no) ])
3243
3244 AC_MSG_CHECKING(if f_fsid has member __val)
3245 AC_TRY_COMPILE([
3246#include <sys/types.h>
3247#include <sys/statvfs.h>],
3248 [fsid_t t; t.__val[0] = 0;],
3249 [ AC_MSG_RESULT(yes)
3250 AC_DEFINE(FSID_HAS___VAL, 1, fsid_t has member __val) ],
3251 [ AC_MSG_RESULT(no) ])
3252])
3253
3254AC_CACHE_CHECK([for msg_control field in struct msghdr],
3255 ac_cv_have_control_in_msghdr, [
3256 AC_COMPILE_IFELSE(
3257 [
3258#include <sys/types.h>
3259#include <sys/socket.h>
3260#include <sys/uio.h>
3261int main() {
3262#ifdef msg_control
3263#error "msg_control is a macro"
3264exit(1);
3265#endif
3266struct msghdr m;
3267m.msg_control = 0;
3268exit(0);
3269}
3270 ],
3271 [ ac_cv_have_control_in_msghdr="yes" ],
3272 [ ac_cv_have_control_in_msghdr="no" ]
3273 )
3274])
3275if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
3276 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3277 [Define if your system uses ancillary data style
3278 file descriptor passing])
3279fi
3280
3281AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
3282 AC_TRY_LINK([],
3283 [ extern char *__progname; printf("%s", __progname); ],
3284 [ ac_cv_libc_defines___progname="yes" ],
3285 [ ac_cv_libc_defines___progname="no" ]
3286 )
3287])
3288if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
3289 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
3290fi
3291
3292AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3293 AC_TRY_LINK([
3294#include <stdio.h>
3295],
3296 [ printf("%s", __FUNCTION__); ],
3297 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3298 [ ac_cv_cc_implements___FUNCTION__="no" ]
3299 )
3300])
3301if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
3302 AC_DEFINE(HAVE___FUNCTION__, 1,
3303 [Define if compiler implements __FUNCTION__])
3304fi
3305
3306AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3307 AC_TRY_LINK([
3308#include <stdio.h>
3309],
3310 [ printf("%s", __func__); ],
3311 [ ac_cv_cc_implements___func__="yes" ],
3312 [ ac_cv_cc_implements___func__="no" ]
3313 )
3314])
3315if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
3316 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
3317fi
3318
3319AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3320 AC_TRY_LINK(
3321 [#include <stdarg.h>
3322 va_list x,y;],
3323 [va_copy(x,y);],
3324 [ ac_cv_have_va_copy="yes" ],
3325 [ ac_cv_have_va_copy="no" ]
3326 )
3327])
3328if test "x$ac_cv_have_va_copy" = "xyes" ; then
3329 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3330fi
3331
3332AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3333 AC_TRY_LINK(
3334 [#include <stdarg.h>
3335 va_list x,y;],
3336 [__va_copy(x,y);],
3337 [ ac_cv_have___va_copy="yes" ],
3338 [ ac_cv_have___va_copy="no" ]
3339 )
3340])
3341if test "x$ac_cv_have___va_copy" = "xyes" ; then
3342 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3343fi
3344
3345AC_CACHE_CHECK([whether getopt has optreset support],
3346 ac_cv_have_getopt_optreset, [
3347 AC_TRY_LINK(
3348 [
3349#include <getopt.h>
3350 ],
3351 [ extern int optreset; optreset = 0; ],
3352 [ ac_cv_have_getopt_optreset="yes" ],
3353 [ ac_cv_have_getopt_optreset="no" ]
3354 )
3355])
3356if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
3357 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3358 [Define if your getopt(3) defines and uses optreset])
3359fi
3360
3361AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
3362 AC_TRY_LINK([],
3363 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
3364 [ ac_cv_libc_defines_sys_errlist="yes" ],
3365 [ ac_cv_libc_defines_sys_errlist="no" ]
3366 )
3367])
3368if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
3369 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3370 [Define if your system defines sys_errlist[]])
3371fi
3372
3373
3374AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
3375 AC_TRY_LINK([],
3376 [ extern int sys_nerr; printf("%i", sys_nerr);],
3377 [ ac_cv_libc_defines_sys_nerr="yes" ],
3378 [ ac_cv_libc_defines_sys_nerr="no" ]
3379 )
3380])
3381if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
3382 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
3383fi
3384
3385SCARD_MSG="no"
3386# Check whether user wants sectok support
3387AC_ARG_WITH(sectok,
3388 [ --with-sectok Enable smartcard support using libsectok],
3389 [
3390 if test "x$withval" != "xno" ; then
3391 if test "x$withval" != "xyes" ; then
3392 CPPFLAGS="$CPPFLAGS -I${withval}"
3393 LDFLAGS="$LDFLAGS -L${withval}"
3394 if test ! -z "$need_dash_r" ; then
3395 LDFLAGS="$LDFLAGS -R${withval}"
3396 fi
3397 if test ! -z "$blibpath" ; then
3398 blibpath="$blibpath:${withval}"
3399 fi
3400 fi
3401 AC_CHECK_HEADERS(sectok.h)
3402 if test "$ac_cv_header_sectok_h" != yes; then
3403 AC_MSG_ERROR(Can't find sectok.h)
3404 fi
3405 AC_CHECK_LIB(sectok, sectok_open)
3406 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3407 AC_MSG_ERROR(Can't find libsectok)
3408 fi
3409 AC_DEFINE(SMARTCARD, 1,
3410 [Define if you want smartcard support])
3411 AC_DEFINE(USE_SECTOK, 1,
3412 [Define if you want smartcard support
3413 using sectok])
3414 SCARD_MSG="yes, using sectok"
3415 fi
3416 ]
3417)
3418
3419# Check whether user wants OpenSC support
3420OPENSC_CONFIG="no"
3421AC_ARG_WITH(opensc,
3422 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
3423 [
3424 if test "x$withval" != "xno" ; then
3425 if test "x$withval" != "xyes" ; then
3426 OPENSC_CONFIG=$withval/bin/opensc-config
3427 else
3428 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3429 fi
3430 if test "$OPENSC_CONFIG" != "no"; then
3431 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3432 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3433 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
3434 LIBS="$LIBS $LIBOPENSC_LIBS"
3435 AC_DEFINE(SMARTCARD)
3436 AC_DEFINE(USE_OPENSC, 1,
3437 [Define if you want smartcard support
3438 using OpenSC])
3439 SCARD_MSG="yes, using OpenSC"
3440 fi
3441 fi
3442 ]
3443)
3444
3445# Check libraries needed by DNS fingerprint support
3446AC_SEARCH_LIBS(getrrsetbyname, resolv,
3447 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3448 [Define if getrrsetbyname() exists])],
3449 [
3450 # Needed by our getrrsetbyname()
3451 AC_SEARCH_LIBS(res_query, resolv)
3452 AC_SEARCH_LIBS(dn_expand, resolv)
3453 AC_MSG_CHECKING(if res_query will link)
3454 AC_LINK_IFELSE([
3455#include "confdefs.h"
3456#include <sys/types.h>
3457#include <netinet/in.h>
3458#include <arpa/nameser.h>
3459#include <netdb.h>
3460#include <resolv.h>
3461int main()
3462{
3463 res_query (0, 0, 0, 0, 0);
3464 return 0;
3465}
3466 ],
3467 AC_MSG_RESULT(yes),
3468 [AC_MSG_RESULT(no)
3469 saved_LIBS="$LIBS"
3470 LIBS="$LIBS -lresolv"
3471 AC_MSG_CHECKING(for res_query in -lresolv)
3472 AC_LINK_IFELSE([
3473#include "confdefs.h"
3474#include <sys/types.h>
3475#include <netinet/in.h>
3476#include <arpa/nameser.h>
3477#include <netdb.h>
3478#include <resolv.h>
3479int main()
3480{
3481 res_query (0, 0, 0, 0, 0);
3482 return 0;
3483}
3484 ],
3485 [AC_MSG_RESULT(yes)],
3486 [LIBS="$saved_LIBS"
3487 AC_MSG_RESULT(no)])
3488 ])
3489 AC_CHECK_FUNCS(_getshort _getlong)
3490 AC_CHECK_DECLS([_getshort, _getlong], , ,
3491 [#include <sys/types.h>
3492 #include <arpa/nameser.h>])
3493 AC_CHECK_MEMBER(HEADER.ad,
3494 [AC_DEFINE(HAVE_HEADER_AD, 1,
3495 [Define if HEADER.ad exists in arpa/nameser.h])],,
3496 [#include <arpa/nameser.h>])
3497 ])
3498
3499AC_MSG_CHECKING(if struct __res_state _res is an extern)
3500AC_LINK_IFELSE([
3501#include <stdio.h>
3502#if HAVE_SYS_TYPES_H
3503# include <sys/types.h>
3504#endif
3505#include <netinet/in.h>
3506#include <arpa/nameser.h>
3507#include <resolv.h>
3508extern struct __res_state _res;
3509int main() { return 0; }
3510 ],
3511 [AC_MSG_RESULT(yes)
3512 AC_DEFINE(HAVE__RES_EXTERN, 1,
3513 [Define if you have struct __res_state _res as an extern])
3514 ],
3515 [ AC_MSG_RESULT(no) ]
3516)
3517
3518# Check whether user wants SELinux support
3519SELINUX_MSG="no"
3520LIBSELINUX=""
3521AC_ARG_WITH(selinux,
3522 [ --with-selinux Enable SELinux support],
3523 [ if test "x$withval" != "xno" ; then
3524 save_LIBS="$LIBS"
3525 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3526 SELINUX_MSG="yes"
3527 AC_CHECK_HEADER([selinux/selinux.h], ,
3528 AC_MSG_ERROR(SELinux support requires selinux.h header))
3529 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3530 AC_MSG_ERROR(SELinux support requires libselinux library))
3531 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
3532 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
3533 LIBS="$save_LIBS"
3534 fi ]
3535)
3536
3537# Finish configuring Globus GSSAPI
3538if test "x$gsi_path" != "xno" ; then
3539 if test ! -z "$need_dash_r" ; then
3540 LDFLAGS="$LDFLAGS -R${gsi_path}/lib"
3541 fi
3542 if test ! -z "$blibpath" ; then
3543 blibpath="$blibpath:${gsi_path}/lib"
3544 fi
3545 # test that we got the libraries OK
3546 AC_TRY_LINK(
3547 [],
3548 [],
3549 [],
3550 [
3551 AC_MSG_ERROR(link with Globus libraries failed)
3552 ]
3553 )
3554 AC_CHECK_FUNCS(globus_gss_assist_map_and_authorize)
3555fi
3556AC_SUBST(INSTALL_GSISSH)
3557
3558# Check whether the user wants GSSAPI mechglue support
3559AC_ARG_WITH(mechglue,
3560 [ --with-mechglue=PATH Build with GSSAPI mechglue library],
3561 [
3562 AC_MSG_CHECKING(for mechglue library)
3563
3564 if test -e ${withval}/libgssapi.a ; then
3565 mechglue_lib=${withval}/libgssapi.a
3566 elif test -e ${withval}/lib/libgssapi.a ; then
3567 mechglue_lib=${withval}/lib/libgssapi.a
3568 else
3569 AC_MSG_ERROR("Can't find libgssapi in ${withval}");
3570 fi
3571 LIBS="${mechglue_lib} $LIBS"
3572 AC_MSG_RESULT(${mechglue_lib})
3573
3574 AC_CHECK_LIB(dl, dlopen, , )
3575 if test $ac_cv_lib_dl_dlopen = yes; then
3576 LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic"
3577 fi
3578
3579 AC_DEFINE(GSSAPI)
3580 AC_DEFINE(MECHGLUE, 1, [Define this if you're building with GSSAPI MechGlue.])
3581 GSSAPI="mechglue"
3582 ]
3583)
3584
3585
3586# Check whether user wants Kerberos 5 support
3587KRB5_MSG="no"
3588AC_ARG_WITH(kerberos5,
3589 [ --with-kerberos5=PATH Enable Kerberos 5 support],
3590 [ if test "x$withval" != "xno" ; then
3591 if test "x$withval" = "xyes" ; then
3592 KRB5ROOT="/usr/local"
3593 else
3594 KRB5ROOT=${withval}
3595 fi
3596
3597 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
3598 KRB5_MSG="yes"
3599
3600 AC_PATH_PROG([KRB5CONF],[krb5-config],
3601 [$KRB5ROOT/bin/krb5-config],
3602 [$KRB5ROOT/bin:$PATH])
3603 if test -x $KRB5CONF ; then
3604
3605 AC_MSG_CHECKING(for gssapi support)
3606 if $KRB5CONF | grep gssapi >/dev/null ; then
3607 AC_MSG_RESULT(yes)
3608 AC_DEFINE(GSSAPI, 1,
3609 [Define this if you want GSSAPI
3610 support in the version 2 protocol])
3611 k5confopts=gssapi
3612 else
3613 AC_MSG_RESULT(no)
3614 k5confopts=""
3615 fi
3616 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3617 K5LIBS="`$KRB5CONF --libs $k5confopts`"
3618 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
3619 AC_MSG_CHECKING(whether we are using Heimdal)
3620 AC_TRY_COMPILE([ #include <krb5.h> ],
3621 [ char *tmp = heimdal_version; ],
3622 [ AC_MSG_RESULT(yes)
3623 AC_DEFINE(HEIMDAL, 1,
3624 [Define this if you are using the
3625 Heimdal version of Kerberos V5]) ],
3626 AC_MSG_RESULT(no)
3627 )
3628 else
3629 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
3630 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
3631 AC_MSG_CHECKING(whether we are using Heimdal)
3632 AC_TRY_COMPILE([ #include <krb5.h> ],
3633 [ char *tmp = heimdal_version; ],
3634 [ AC_MSG_RESULT(yes)
3635 AC_DEFINE(HEIMDAL)
3636 K5LIBS="-lkrb5 -ldes"
3637 K5LIBS="$K5LIBS -lcom_err -lasn1"
3638 AC_CHECK_LIB(roken, net_write,
3639 [K5LIBS="$K5LIBS -lroken"])
3640 ],
3641 [ AC_MSG_RESULT(no)
3642 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3643 ]
3644 )
3645 AC_SEARCH_LIBS(dn_expand, resolv)
3646
3647 AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,
3648 [ AC_DEFINE(GSSAPI)
3649 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3650 [ AC_CHECK_LIB(gssapi, gss_init_sec_context,
3651 [ AC_DEFINE(GSSAPI)
3652 K5LIBS="-lgssapi $K5LIBS" ],
3653 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3654 $K5LIBS)
3655 ],
3656 $K5LIBS)
3657
3658 AC_CHECK_HEADER(gssapi.h, ,
3659 [ unset ac_cv_header_gssapi_h
3660 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3661 AC_CHECK_HEADERS(gssapi.h, ,
3662 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
3663 )
3664 ]
3665 )
3666
3667 oldCPP="$CPPFLAGS"
3668 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3669 AC_CHECK_HEADER(gssapi_krb5.h, ,
3670 [ CPPFLAGS="$oldCPP" ])
3671
3672 # If we're using some other GSSAPI
3673 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
3674 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
3675 fi
3676
3677 if test -z "$GSSAPI"; then
3678 GSSAPI="KRB5";
3679 fi
3680
3681 oldCPP="$CPPFLAGS"
3682 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3683 AC_CHECK_HEADER(gssapi_krb5.h, ,
3684 [ CPPFLAGS="$oldCPP" ])
3685
3686 fi
3687 if test ! -z "$need_dash_r" ; then
3688 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3689 fi
3690 if test ! -z "$blibpath" ; then
3691 blibpath="$blibpath:${KRB5ROOT}/lib"
3692 fi
3693
3694 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3695 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3696 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3697
3698 LIBS="$LIBS $K5LIBS"
3699 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3700 [Define this if you want to use libkafs' AFS support]))
3701 fi
3702 ]
3703)
3704
3705# Check whether user wants AFS_KRB5 support
3706AFS_KRB5_MSG="no"
3707AC_ARG_WITH(afs-krb5,
3708 [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).],
3709 [
3710 if test "x$withval" != "xno" ; then
3711
3712 if test "x$withval" != "xyes" ; then
3713 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval",
3714 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3715 else
3716 AC_DEFINE_UNQUOTED(AKLOG_PATH,
3717 "/usr/bin/aklog",
3718 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3719 fi
3720
3721 if test -z "$KRB5ROOT" ; then
3722 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
3723 fi
3724
3725 LIBS="-lkrbafs -lkrb4 $LIBS"
3726 if test ! -z "$AFS_LIBS" ; then
3727 LIBS="$LIBS $AFS_LIBS"
3728 fi
3729 AC_DEFINE(AFS_KRB5, 1,
3730 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3731 AFS_KRB5_MSG="yes"
3732 fi
3733 ]
3734)
3735
3736AC_ARG_WITH(session-hooks,
3737 [ --with-session-hooks Enable hooks for executing external commands before/after a session],
3738 [ AC_DEFINE(SESSION_HOOKS, 1, [Define this if you want support for startup/shutdown hooks]) ]
3739)
3740
3741# Looking for programs, paths and files
3742
3743PRIVSEP_PATH=/var/empty
3744AC_ARG_WITH(privsep-path,
3745 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
3746 [
3747 if test -n "$withval" && test "x$withval" != "xno" && \
3748 test "x${withval}" != "xyes"; then
3749 PRIVSEP_PATH=$withval
3750 fi
3751 ]
3752)
3753AC_SUBST(PRIVSEP_PATH)
3754
3755AC_ARG_WITH(xauth,
3756 [ --with-xauth=PATH Specify path to xauth program ],
3757 [
3758 if test -n "$withval" && test "x$withval" != "xno" && \
3759 test "x${withval}" != "xyes"; then
3760 xauth_path=$withval
3761 fi
3762 ],
3763 [
3764 TestPath="$PATH"
3765 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3766 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3767 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3768 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3769 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3770 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3771 xauth_path="/usr/openwin/bin/xauth"
3772 fi
3773 ]
3774)
3775
3776# strip causes problems with GSI libraries...
3777if test -z "$GLOBUS_LDFLAGS" ; then
3778STRIP_OPT=-s
3779fi
3780AC_ARG_ENABLE(strip,
3781 [ --disable-strip Disable calling strip(1) on install],
3782 [
3783 if test "x$enableval" = "xno" ; then
3784 STRIP_OPT=
3785 fi
3786 ]
3787)
3788AC_SUBST(STRIP_OPT)
3789
3790if test -z "$xauth_path" ; then
3791 XAUTH_PATH="undefined"
3792 AC_SUBST(XAUTH_PATH)
3793else
3794 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3795 [Define if xauth is found in your path])
3796 XAUTH_PATH=$xauth_path
3797 AC_SUBST(XAUTH_PATH)
3798fi
3799
3800# Check for mail directory (last resort if we cannot get it from headers)
3801if test ! -z "$MAIL" ; then
3802 maildir=`dirname $MAIL`
3803 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3804 [Set this to your mail directory if you don't have maillock.h])
3805fi
3806
3807if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3808 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3809 disable_ptmx_check=yes
3810fi
3811if test -z "$no_dev_ptmx" ; then
3812 if test "x$disable_ptmx_check" != "xyes" ; then
3813 AC_CHECK_FILE("/dev/ptmx",
3814 [
3815 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3816 [Define if you have /dev/ptmx])
3817 have_dev_ptmx=1
3818 ]
3819 )
3820 fi
3821fi
3822
3823if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3824 AC_CHECK_FILE("/dev/ptc",
3825 [
3826 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3827 [Define if you have /dev/ptc])
3828 have_dev_ptc=1
3829 ]
3830 )
3831else
3832 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3833fi
3834
3835# Options from here on. Some of these are preset by platform above
3836AC_ARG_WITH(mantype,
3837 [ --with-mantype=man|cat|doc Set man page type],
3838 [
3839 case "$withval" in
3840 man|cat|doc)
3841 MANTYPE=$withval
3842 ;;
3843 *)
3844 AC_MSG_ERROR(invalid man type: $withval)
3845 ;;
3846 esac
3847 ]
3848)
3849if test -z "$MANTYPE"; then
3850 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3851 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3852 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3853 MANTYPE=doc
3854 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3855 MANTYPE=man
3856 else
3857 MANTYPE=cat
3858 fi
3859fi
3860AC_SUBST(MANTYPE)
3861if test "$MANTYPE" = "doc"; then
3862 mansubdir=man;
3863else
3864 mansubdir=$MANTYPE;
3865fi
3866AC_SUBST(mansubdir)
3867
3868# Check whether to enable MD5 passwords
3869MD5_MSG="no"
3870AC_ARG_WITH(md5-passwords,
3871 [ --with-md5-passwords Enable use of MD5 passwords],
3872 [
3873 if test "x$withval" != "xno" ; then
3874 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3875 [Define if you want to allow MD5 passwords])
3876 MD5_MSG="yes"
3877 fi
3878 ]
3879)
3880
3881# Whether to disable shadow password support
3882AC_ARG_WITH(shadow,
3883 [ --without-shadow Disable shadow password support],
3884 [
3885 if test "x$withval" = "xno" ; then
3886 AC_DEFINE(DISABLE_SHADOW)
3887 disable_shadow=yes
3888 fi
3889 ]
3890)
3891
3892if test -z "$disable_shadow" ; then
3893 AC_MSG_CHECKING([if the systems has expire shadow information])
3894 AC_TRY_COMPILE(
3895 [
3896#include <sys/types.h>
3897#include <shadow.h>
3898 struct spwd sp;
3899 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3900 [ sp_expire_available=yes ], []
3901 )
3902
3903 if test "x$sp_expire_available" = "xyes" ; then
3904 AC_MSG_RESULT(yes)
3905 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3906 [Define if you want to use shadow password expire field])
3907 else
3908 AC_MSG_RESULT(no)
3909 fi
3910fi
3911
3912# Use ip address instead of hostname in $DISPLAY
3913if test ! -z "$IPADDR_IN_DISPLAY" ; then
3914 DISPLAY_HACK_MSG="yes"
3915 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3916 [Define if you need to use IP address
3917 instead of hostname in $DISPLAY])
3918else
3919 DISPLAY_HACK_MSG="no"
3920 AC_ARG_WITH(ipaddr-display,
3921 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3922 [
3923 if test "x$withval" != "xno" ; then
3924 AC_DEFINE(IPADDR_IN_DISPLAY)
3925 DISPLAY_HACK_MSG="yes"
3926 fi
3927 ]
3928 )
3929fi
3930
3931# check for /etc/default/login and use it if present.
3932AC_ARG_ENABLE(etc-default-login,
3933 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3934 [ if test "x$enableval" = "xno"; then
3935 AC_MSG_NOTICE([/etc/default/login handling disabled])
3936 etc_default_login=no
3937 else
3938 etc_default_login=yes
3939 fi ],
3940 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3941 then
3942 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3943 etc_default_login=no
3944 else
3945 etc_default_login=yes
3946 fi ]
3947)
3948
3949if test "x$etc_default_login" != "xno"; then
3950 AC_CHECK_FILE("/etc/default/login",
3951 [ external_path_file=/etc/default/login ])
3952 if test "x$external_path_file" = "x/etc/default/login"; then
3953 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3954 [Define if your system has /etc/default/login])
3955 fi
3956fi
3957
3958dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3959if test $ac_cv_func_login_getcapbool = "yes" && \
3960 test $ac_cv_header_login_cap_h = "yes" ; then
3961 external_path_file=/etc/login.conf
3962fi
3963
3964# Whether to mess with the default path
3965SERVER_PATH_MSG="(default)"
3966AC_ARG_WITH(default-path,
3967 [ --with-default-path= Specify default \$PATH environment for server],
3968 [
3969 if test "x$external_path_file" = "x/etc/login.conf" ; then
3970 AC_MSG_WARN([
3971--with-default-path=PATH has no effect on this system.
3972Edit /etc/login.conf instead.])
3973 elif test "x$withval" != "xno" ; then
3974 if test ! -z "$external_path_file" ; then
3975 AC_MSG_WARN([
3976--with-default-path=PATH will only be used if PATH is not defined in
3977$external_path_file .])
3978 fi
3979 user_path="$withval"
3980 SERVER_PATH_MSG="$withval"
3981 fi
3982 ],
3983 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3984 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3985 else
3986 if test ! -z "$external_path_file" ; then
3987 AC_MSG_WARN([
3988If PATH is defined in $external_path_file, ensure the path to scp is included,
3989otherwise scp will not work.])
3990 fi
3991 AC_RUN_IFELSE(
3992 [AC_LANG_SOURCE([[
3993/* find out what STDPATH is */
3994#include <stdio.h>
3995#ifdef HAVE_PATHS_H
3996# include <paths.h>
3997#endif
3998#ifndef _PATH_STDPATH
3999# ifdef _PATH_USERPATH /* Irix */
4000# define _PATH_STDPATH _PATH_USERPATH
4001# else
4002# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4003# endif
4004#endif
4005#include <sys/types.h>
4006#include <sys/stat.h>
4007#include <fcntl.h>
4008#define DATA "conftest.stdpath"
4009
4010main()
4011{
4012 FILE *fd;
4013 int rc;
4014
4015 fd = fopen(DATA,"w");
4016 if(fd == NULL)
4017 exit(1);
4018
4019 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4020 exit(1);
4021
4022 exit(0);
4023}
4024 ]])],
4025 [ user_path=`cat conftest.stdpath` ],
4026 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4027 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4028 )
4029# make sure $bindir is in USER_PATH so scp will work
4030 t_bindir=`eval echo ${bindir}`
4031 case $t_bindir in
4032 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4033 esac
4034 case $t_bindir in
4035 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4036 esac
4037 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4038 if test $? -ne 0 ; then
4039 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4040 if test $? -ne 0 ; then
4041 user_path=$user_path:$t_bindir
4042 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
4043 fi
4044 fi
4045 fi ]
4046)
4047if test "x$external_path_file" != "x/etc/login.conf" ; then
4048 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
4049 AC_SUBST(user_path)
4050fi
4051
4052# Set superuser path separately to user path
4053AC_ARG_WITH(superuser-path,
4054 [ --with-superuser-path= Specify different path for super-user],
4055 [
4056 if test -n "$withval" && test "x$withval" != "xno" && \
4057 test "x${withval}" != "xyes"; then
4058 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
4059 [Define if you want a different $PATH
4060 for the superuser])
4061 superuser_path=$withval
4062 fi
4063 ]
4064)
4065
4066
4067AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
4068IPV4_IN6_HACK_MSG="no"
4069AC_ARG_WITH(4in6,
4070 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4071 [
4072 if test "x$withval" != "xno" ; then
4073 AC_MSG_RESULT(yes)
4074 AC_DEFINE(IPV4_IN_IPV6, 1,
4075 [Detect IPv4 in IPv6 mapped addresses
4076 and treat as IPv4])
4077 IPV4_IN6_HACK_MSG="yes"
4078 else
4079 AC_MSG_RESULT(no)
4080 fi
4081 ],[
4082 if test "x$inet6_default_4in6" = "xyes"; then
4083 AC_MSG_RESULT([yes (default)])
4084 AC_DEFINE(IPV4_IN_IPV6)
4085 IPV4_IN6_HACK_MSG="yes"
4086 else
4087 AC_MSG_RESULT([no (default)])
4088 fi
4089 ]
4090)
4091
4092# Whether to enable BSD auth support
4093BSD_AUTH_MSG=no
4094AC_ARG_WITH(bsd-auth,
4095 [ --with-bsd-auth Enable BSD auth support],
4096 [
4097 if test "x$withval" != "xno" ; then
4098 AC_DEFINE(BSD_AUTH, 1,
4099 [Define if you have BSD auth support])
4100 BSD_AUTH_MSG=yes
4101 fi
4102 ]
4103)
4104
4105# Where to place sshd.pid
4106piddir=/var/run
4107# make sure the directory exists
4108if test ! -d $piddir ; then
4109 piddir=`eval echo ${sysconfdir}`
4110 case $piddir in
4111 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
4112 esac
4113fi
4114
4115AC_ARG_WITH(pid-dir,
4116 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4117 [
4118 if test -n "$withval" && test "x$withval" != "xno" && \
4119 test "x${withval}" != "xyes"; then
4120 piddir=$withval
4121 if test ! -d $piddir ; then
4122 AC_MSG_WARN([** no $piddir directory on this system **])
4123 fi
4124 fi
4125 ]
4126)
4127
4128AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
4129AC_SUBST(piddir)
4130
4131dnl allow user to disable some login recording features
4132AC_ARG_ENABLE(lastlog,
4133 [ --disable-lastlog disable use of lastlog even if detected [no]],
4134 [
4135 if test "x$enableval" = "xno" ; then
4136 AC_DEFINE(DISABLE_LASTLOG)
4137 fi
4138 ]
4139)
4140AC_ARG_ENABLE(utmp,
4141 [ --disable-utmp disable use of utmp even if detected [no]],
4142 [
4143 if test "x$enableval" = "xno" ; then
4144 AC_DEFINE(DISABLE_UTMP)
4145 fi
4146 ]
4147)
4148AC_ARG_ENABLE(utmpx,
4149 [ --disable-utmpx disable use of utmpx even if detected [no]],
4150 [
4151 if test "x$enableval" = "xno" ; then
4152 AC_DEFINE(DISABLE_UTMPX, 1,
4153 [Define if you don't want to use utmpx])
4154 fi
4155 ]
4156)
4157AC_ARG_ENABLE(wtmp,
4158 [ --disable-wtmp disable use of wtmp even if detected [no]],
4159 [
4160 if test "x$enableval" = "xno" ; then
4161 AC_DEFINE(DISABLE_WTMP)
4162 fi
4163 ]
4164)
4165AC_ARG_ENABLE(wtmpx,
4166 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
4167 [
4168 if test "x$enableval" = "xno" ; then
4169 AC_DEFINE(DISABLE_WTMPX, 1,
4170 [Define if you don't want to use wtmpx])
4171 fi
4172 ]
4173)
4174AC_ARG_ENABLE(libutil,
4175 [ --disable-libutil disable use of libutil (login() etc.) [no]],
4176 [
4177 if test "x$enableval" = "xno" ; then
4178 AC_DEFINE(DISABLE_LOGIN)
4179 fi
4180 ]
4181)
4182AC_ARG_ENABLE(pututline,
4183 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
4184 [
4185 if test "x$enableval" = "xno" ; then
4186 AC_DEFINE(DISABLE_PUTUTLINE, 1,
4187 [Define if you don't want to use pututline()
4188 etc. to write [uw]tmp])
4189 fi
4190 ]
4191)
4192AC_ARG_ENABLE(pututxline,
4193 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
4194 [
4195 if test "x$enableval" = "xno" ; then
4196 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
4197 [Define if you don't want to use pututxline()
4198 etc. to write [uw]tmpx])
4199 fi
4200 ]
4201)
4202AC_ARG_WITH(lastlog,
4203 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
4204 [
4205 if test "x$withval" = "xno" ; then
4206 AC_DEFINE(DISABLE_LASTLOG)
4207 elif test -n "$withval" && test "x${withval}" != "xyes"; then
4208 conf_lastlog_location=$withval
4209 fi
4210 ]
4211)
4212
4213dnl lastlog, [uw]tmpx? detection
4214dnl NOTE: set the paths in the platform section to avoid the
4215dnl need for command-line parameters
4216dnl lastlog and [uw]tmp are subject to a file search if all else fails
4217
4218dnl lastlog detection
4219dnl NOTE: the code itself will detect if lastlog is a directory
4220AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
4221AC_TRY_COMPILE([
4222#include <sys/types.h>
4223#include <utmp.h>
4224#ifdef HAVE_LASTLOG_H
4225# include <lastlog.h>
4226#endif
4227#ifdef HAVE_PATHS_H
4228# include <paths.h>
4229#endif
4230#ifdef HAVE_LOGIN_H
4231# include <login.h>
4232#endif
4233 ],
4234 [ char *lastlog = LASTLOG_FILE; ],
4235 [ AC_MSG_RESULT(yes) ],
4236 [
4237 AC_MSG_RESULT(no)
4238 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
4239 AC_TRY_COMPILE([
4240#include <sys/types.h>
4241#include <utmp.h>
4242#ifdef HAVE_LASTLOG_H
4243# include <lastlog.h>
4244#endif
4245#ifdef HAVE_PATHS_H
4246# include <paths.h>
4247#endif
4248 ],
4249 [ char *lastlog = _PATH_LASTLOG; ],
4250 [ AC_MSG_RESULT(yes) ],
4251 [
4252 AC_MSG_RESULT(no)
4253 system_lastlog_path=no
4254 ])
4255 ]
4256)
4257
4258if test -z "$conf_lastlog_location"; then
4259 if test x"$system_lastlog_path" = x"no" ; then
4260 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
4261 if (test -d "$f" || test -f "$f") ; then
4262 conf_lastlog_location=$f
4263 fi
4264 done
4265 if test -z "$conf_lastlog_location"; then
4266 AC_MSG_WARN([** Cannot find lastlog **])
4267 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
4268 fi
4269 fi
4270fi
4271
4272if test -n "$conf_lastlog_location"; then
4273 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
4274 [Define if you want to specify the path to your lastlog file])
4275fi
4276
4277dnl utmp detection
4278AC_MSG_CHECKING([if your system defines UTMP_FILE])
4279AC_TRY_COMPILE([
4280#include <sys/types.h>
4281#include <utmp.h>
4282#ifdef HAVE_PATHS_H
4283# include <paths.h>
4284#endif
4285 ],
4286 [ char *utmp = UTMP_FILE; ],
4287 [ AC_MSG_RESULT(yes) ],
4288 [ AC_MSG_RESULT(no)
4289 system_utmp_path=no ]
4290)
4291if test -z "$conf_utmp_location"; then
4292 if test x"$system_utmp_path" = x"no" ; then
4293 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4294 if test -f $f ; then
4295 conf_utmp_location=$f
4296 fi
4297 done
4298 if test -z "$conf_utmp_location"; then
4299 AC_DEFINE(DISABLE_UTMP)
4300 fi
4301 fi
4302fi
4303if test -n "$conf_utmp_location"; then
4304 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
4305 [Define if you want to specify the path to your utmp file])
4306fi
4307
4308dnl wtmp detection
4309AC_MSG_CHECKING([if your system defines WTMP_FILE])
4310AC_TRY_COMPILE([
4311#include <sys/types.h>
4312#include <utmp.h>
4313#ifdef HAVE_PATHS_H
4314# include <paths.h>
4315#endif
4316 ],
4317 [ char *wtmp = WTMP_FILE; ],
4318 [ AC_MSG_RESULT(yes) ],
4319 [ AC_MSG_RESULT(no)
4320 system_wtmp_path=no ]
4321)
4322if test -z "$conf_wtmp_location"; then
4323 if test x"$system_wtmp_path" = x"no" ; then
4324 for f in /usr/adm/wtmp /var/log/wtmp; do
4325 if test -f $f ; then
4326 conf_wtmp_location=$f
4327 fi
4328 done
4329 if test -z "$conf_wtmp_location"; then
4330 AC_DEFINE(DISABLE_WTMP)
4331 fi
4332 fi
4333fi
4334if test -n "$conf_wtmp_location"; then
4335 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
4336 [Define if you want to specify the path to your wtmp file])
4337fi
4338
4339
4340dnl utmpx detection - I don't know any system so perverse as to require
4341dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
4342dnl there, though.
4343AC_MSG_CHECKING([if your system defines UTMPX_FILE])
4344AC_TRY_COMPILE([
4345#include <sys/types.h>
4346#include <utmp.h>
4347#ifdef HAVE_UTMPX_H
4348#include <utmpx.h>
4349#endif
4350#ifdef HAVE_PATHS_H
4351# include <paths.h>
4352#endif
4353 ],
4354 [ char *utmpx = UTMPX_FILE; ],
4355 [ AC_MSG_RESULT(yes) ],
4356 [ AC_MSG_RESULT(no)
4357 system_utmpx_path=no ]
4358)
4359if test -z "$conf_utmpx_location"; then
4360 if test x"$system_utmpx_path" = x"no" ; then
4361 AC_DEFINE(DISABLE_UTMPX)
4362 fi
4363else
4364 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
4365 [Define if you want to specify the path to your utmpx file])
4366fi
4367
4368dnl wtmpx detection
4369AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4370AC_TRY_COMPILE([
4371#include <sys/types.h>
4372#include <utmp.h>
4373#ifdef HAVE_UTMPX_H
4374#include <utmpx.h>
4375#endif
4376#ifdef HAVE_PATHS_H
4377# include <paths.h>
4378#endif
4379 ],
4380 [ char *wtmpx = WTMPX_FILE; ],
4381 [ AC_MSG_RESULT(yes) ],
4382 [ AC_MSG_RESULT(no)
4383 system_wtmpx_path=no ]
4384)
4385if test -z "$conf_wtmpx_location"; then
4386 if test x"$system_wtmpx_path" = x"no" ; then
4387 AC_DEFINE(DISABLE_WTMPX)
4388 fi
4389else
4390 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
4391 [Define if you want to specify the path to your wtmpx file])
4392fi
4393
4394
4395if test ! -z "$blibpath" ; then
4396 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4397 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
4398fi
4399
4400dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4401dnl Add now.
4402CFLAGS="$CFLAGS $werror_flags"
4403
4404if grep "#define BROKEN_GETADDRINFO 1" confdefs.h >/dev/null || \
4405 test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4406 AC_SUBST(TEST_SSH_IPV6, no)
4407else
4408 AC_SUBST(TEST_SSH_IPV6, yes)
4409fi
4410
4411AC_EXEEXT
4412AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4413 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
4414 scard/Makefile ssh_prng_cmds survey.sh])
4415AC_OUTPUT
4416
4417# Print summary of options
4418
4419# Someone please show me a better way :)
4420A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4421B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4422C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4423D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
4424E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
4425F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
4426G=`eval echo ${piddir}` ; G=`eval echo ${G}`
4427H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4428I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4429J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
4430
4431echo ""
4432echo "OpenSSH has been configured with the following options:"
4433echo " User binaries: $B"
4434echo " System binaries: $C"
4435echo " Configuration files: $D"
4436echo " Askpass program: $E"
4437echo " Manual pages: $F"
4438echo " PID file: $G"
4439echo " Privilege separation chroot path: $H"
4440if test "x$external_path_file" = "x/etc/login.conf" ; then
4441echo " At runtime, sshd will use the path defined in $external_path_file"
4442echo " Make sure the path to scp is present, otherwise scp will not work"
4443else
4444echo " sshd default user PATH: $I"
4445 if test ! -z "$external_path_file"; then
4446echo " (If PATH is set in $external_path_file it will be used instead. If"
4447echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4448 fi
4449fi
4450if test ! -z "$superuser_path" ; then
4451echo " sshd superuser user PATH: $J"
4452fi
4453echo " Manpage format: $MANTYPE"
4454echo " PAM support: $PAM_MSG"
4455echo " OSF SIA support: $SIA_MSG"
4456echo " KerberosV support: $KRB5_MSG"
4457echo " SELinux support: $SELINUX_MSG"
4458echo " Smartcard support: $SCARD_MSG"
4459echo " S/KEY support: $SKEY_MSG"
4460echo " TCP Wrappers support: $TCPW_MSG"
4461echo " MD5 password support: $MD5_MSG"
4462echo " libedit support: $LIBEDIT_MSG"
4463echo " Solaris process contract support: $SPC_MSG"
4464echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
4465echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4466echo " BSD Auth support: $BSD_AUTH_MSG"
4467echo " Random number source: $RAND_MSG"
4468if test ! -z "$USE_RAND_HELPER" ; then
4469echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
4470fi
4471
4472echo ""
4473
4474echo " Host: ${host}"
4475echo " Compiler: ${CC}"
4476echo " Compiler flags: ${CFLAGS}"
4477echo "Preprocessor flags: ${CPPFLAGS}"
4478echo " Linker flags: ${LDFLAGS}"
4479echo " Libraries: ${LIBS}"
4480if test ! -z "${SSHDLIBS}"; then
4481echo " +for sshd: ${SSHDLIBS}"
4482fi
4483
4484echo ""
4485
4486if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
4487 echo "SVR4 style packages are supported with \"make package\""
4488 echo ""
4489fi
4490
4491if test "x$PAM_MSG" = "xyes" ; then
4492 echo "PAM is enabled. You may need to install a PAM control file "
4493 echo "for sshd, otherwise password authentication may fail. "
4494 echo "Example PAM control files can be found in the contrib/ "
4495 echo "subdirectory"
4496 echo ""
4497fi
4498
4499if test ! -z "$RAND_HELPER_CMDHASH" ; then
4500 echo "WARNING: you are using the builtin random number collection "
4501 echo "service. Please read WARNING.RNG and request that your OS "
4502 echo "vendor includes kernel-based random number collection in "
4503 echo "future versions of your OS."
4504 echo ""
4505fi
4506
4507if test ! -z "$NO_PEERCHECK" ; then
4508 echo "WARNING: the operating system that you are using does not"
4509 echo "appear to support getpeereid(), getpeerucred() or the"
4510 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4511 echo "enforce security checks to prevent unauthorised connections to"
4512 echo "ssh-agent. Their absence increases the risk that a malicious"
4513 echo "user can connect to your agent."
4514 echo ""
4515fi
4516
4517if test "$AUDIT_MODULE" = "bsm" ; then
4518 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4519 echo "See the Solaris section in README.platform for details."
4520fi
This page took 0.167491 seconds and 5 git commands to generate.