]> andersk Git - gssapi-openssh.git/blame_incremental - openssh/configure.ac
Added support for reporting usage metrics.
[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
1198dnl
1199dnl Check for globus_usage_stats_send
1200dnl
1201AC_SEARCH_LIBS(globus_usage_stats_send,
1202 globus_usage globus_usage_${globus_flavor_type},
1203 AC_DEFINE([HAVE_GLOBUS_USAGE], 1, [Have Globus Usage]))
1204dnl
1205dnl Check for globus_usage_stats_send_array
1206dnl
1207AC_SEARCH_LIBS(globus_usage_stats_send_array,
1208 globus_usage globus_usage_${globus_flavor_type},
1209 AC_DEFINE([HAVE_GLOBUS_USAGE_SEND_ARRAY], 1, [Have Globus Usage send_array]))
1210
1211AC_FUNC_STRFTIME
1212
1213# Check for ALTDIRFUNC glob() extension
1214AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1215AC_EGREP_CPP(FOUNDIT,
1216 [
1217 #include <glob.h>
1218 #ifdef GLOB_ALTDIRFUNC
1219 FOUNDIT
1220 #endif
1221 ],
1222 [
1223 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1224 [Define if your system glob() function has
1225 the GLOB_ALTDIRFUNC extension])
1226 AC_MSG_RESULT(yes)
1227 ],
1228 [
1229 AC_MSG_RESULT(no)
1230 ]
1231)
1232
1233# Check for g.gl_matchc glob() extension
1234AC_MSG_CHECKING(for gl_matchc field in glob_t)
1235AC_TRY_COMPILE(
1236 [ #include <glob.h> ],
1237 [glob_t g; g.gl_matchc = 1;],
1238 [
1239 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1240 [Define if your system glob() function has
1241 gl_matchc options in glob_t])
1242 AC_MSG_RESULT(yes)
1243 ],
1244 [
1245 AC_MSG_RESULT(no)
1246 ]
1247)
1248
1249AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1250
1251AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
1252AC_RUN_IFELSE(
1253 [AC_LANG_SOURCE([[
1254#include <sys/types.h>
1255#include <dirent.h>
1256int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
1257 ]])],
1258 [AC_MSG_RESULT(yes)],
1259 [
1260 AC_MSG_RESULT(no)
1261 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
1262 [Define if your struct dirent expects you to
1263 allocate extra space for d_name])
1264 ],
1265 [
1266 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1267 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
1268 ]
1269)
1270
1271AC_MSG_CHECKING([for /proc/pid/fd directory])
1272if test -d "/proc/$$/fd" ; then
1273 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
1274 AC_MSG_RESULT(yes)
1275else
1276 AC_MSG_RESULT(no)
1277fi
1278
1279# Check whether user wants S/Key support
1280SKEY_MSG="no"
1281AC_ARG_WITH(skey,
1282 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
1283 [
1284 if test "x$withval" != "xno" ; then
1285
1286 if test "x$withval" != "xyes" ; then
1287 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1288 LDFLAGS="$LDFLAGS -L${withval}/lib"
1289 fi
1290
1291 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
1292 LIBS="-lskey $LIBS"
1293 SKEY_MSG="yes"
1294
1295 AC_MSG_CHECKING([for s/key support])
1296 AC_LINK_IFELSE(
1297 [AC_LANG_SOURCE([[
1298#include <stdio.h>
1299#include <skey.h>
1300int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
1301 ]])],
1302 [AC_MSG_RESULT(yes)],
1303 [
1304 AC_MSG_RESULT(no)
1305 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1306 ])
1307 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1308 AC_TRY_COMPILE(
1309 [#include <stdio.h>
1310 #include <skey.h>],
1311 [(void)skeychallenge(NULL,"name","",0);],
1312 [AC_MSG_RESULT(yes)
1313 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1314 [Define if your skeychallenge()
1315 function takes 4 arguments (NetBSD)])],
1316 [AC_MSG_RESULT(no)]
1317 )
1318 fi
1319 ]
1320)
1321
1322# Check whether user wants TCP wrappers support
1323TCPW_MSG="no"
1324AC_ARG_WITH(tcp-wrappers,
1325 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1326 [
1327 if test "x$withval" != "xno" ; then
1328 saved_LIBS="$LIBS"
1329 saved_LDFLAGS="$LDFLAGS"
1330 saved_CPPFLAGS="$CPPFLAGS"
1331 if test -n "${withval}" && \
1332 test "x${withval}" != "xyes"; then
1333 if test -d "${withval}/lib"; then
1334 if test -n "${need_dash_r}"; then
1335 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1336 else
1337 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1338 fi
1339 else
1340 if test -n "${need_dash_r}"; then
1341 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1342 else
1343 LDFLAGS="-L${withval} ${LDFLAGS}"
1344 fi
1345 fi
1346 if test -d "${withval}/include"; then
1347 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1348 else
1349 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1350 fi
1351 fi
1352 LIBS="-lwrap $LIBS"
1353 AC_MSG_CHECKING(for libwrap)
1354 AC_TRY_LINK(
1355 [
1356#include <sys/types.h>
1357#include <sys/socket.h>
1358#include <netinet/in.h>
1359#include <tcpd.h>
1360 int deny_severity = 0, allow_severity = 0;
1361 ],
1362 [hosts_access(0);],
1363 [
1364 AC_MSG_RESULT(yes)
1365 AC_DEFINE(LIBWRAP, 1,
1366 [Define if you want
1367 TCP Wrappers support])
1368 SSHDLIBS="$SSHDLIBS -lwrap"
1369 TCPW_MSG="yes"
1370 ],
1371 [
1372 AC_MSG_ERROR([*** libwrap missing])
1373 ]
1374 )
1375 LIBS="$saved_LIBS"
1376 fi
1377 ]
1378)
1379
1380# Check whether user wants libedit support
1381LIBEDIT_MSG="no"
1382AC_ARG_WITH(libedit,
1383 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1384 [ if test "x$withval" != "xno" ; then
1385 if test "x$withval" != "xyes"; then
1386 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1387 if test -n "${need_dash_r}"; then
1388 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1389 else
1390 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1391 fi
1392 fi
1393 AC_CHECK_LIB(edit, el_init,
1394 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1395 LIBEDIT="-ledit -lcurses"
1396 LIBEDIT_MSG="yes"
1397 AC_SUBST(LIBEDIT)
1398 ],
1399 [ AC_MSG_ERROR(libedit not found) ],
1400 [ -lcurses ]
1401 )
1402 AC_MSG_CHECKING(if libedit version is compatible)
1403 AC_COMPILE_IFELSE(
1404 [AC_LANG_SOURCE([[
1405#include <histedit.h>
1406int main(void)
1407{
1408 int i = H_SETSIZE;
1409 el_init("", NULL, NULL, NULL);
1410 exit(0);
1411}
1412 ]])],
1413 [ AC_MSG_RESULT(yes) ],
1414 [ AC_MSG_RESULT(no)
1415 AC_MSG_ERROR(libedit version is not compatible) ]
1416 )
1417 fi ]
1418)
1419
1420AUDIT_MODULE=none
1421AC_ARG_WITH(audit,
1422 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1423 [
1424 AC_MSG_CHECKING(for supported audit module)
1425 case "$withval" in
1426 bsm)
1427 AC_MSG_RESULT(bsm)
1428 AUDIT_MODULE=bsm
1429 dnl Checks for headers, libs and functions
1430 AC_CHECK_HEADERS(bsm/audit.h, [],
1431 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1432 [
1433#ifdef HAVE_TIME_H
1434# include <time.h>
1435#endif
1436 ]
1437)
1438 AC_CHECK_LIB(bsm, getaudit, [],
1439 [AC_MSG_ERROR(BSM enabled and required library not found)])
1440 AC_CHECK_FUNCS(getaudit, [],
1441 [AC_MSG_ERROR(BSM enabled and required function not found)])
1442 # These are optional
1443 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
1444 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1445 ;;
1446 debug)
1447 AUDIT_MODULE=debug
1448 AC_MSG_RESULT(debug)
1449 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1450 ;;
1451 no)
1452 AC_MSG_RESULT(no)
1453 ;;
1454 *)
1455 AC_MSG_ERROR([Unknown audit module $withval])
1456 ;;
1457 esac ]
1458)
1459
1460dnl Checks for library functions. Please keep in alphabetical order
1461AC_CHECK_FUNCS( \
1462 arc4random \
1463 arc4random_buf \
1464 arc4random_uniform \
1465 asprintf \
1466 b64_ntop \
1467 __b64_ntop \
1468 b64_pton \
1469 __b64_pton \
1470 bcopy \
1471 bindresvport_sa \
1472 clock \
1473 closefrom \
1474 dirfd \
1475 fchmod \
1476 fchown \
1477 freeaddrinfo \
1478 fstatvfs \
1479 futimes \
1480 getaddrinfo \
1481 getcwd \
1482 getgrouplist \
1483 getnameinfo \
1484 getopt \
1485 getpeereid \
1486 getpeerucred \
1487 _getpty \
1488 getrlimit \
1489 getttyent \
1490 glob \
1491 inet_aton \
1492 inet_ntoa \
1493 inet_ntop \
1494 innetgr \
1495 login_getcapbool \
1496 md5_crypt \
1497 memmove \
1498 mkdtemp \
1499 mmap \
1500 ngetaddrinfo \
1501 nsleep \
1502 ogetaddrinfo \
1503 openlog_r \
1504 openpty \
1505 poll \
1506 prctl \
1507 pstat \
1508 readpassphrase \
1509 realpath \
1510 recvmsg \
1511 rresvport_af \
1512 sendmsg \
1513 setdtablesize \
1514 setegid \
1515 setenv \
1516 seteuid \
1517 setgroups \
1518 setlogin \
1519 setpcred \
1520 setproctitle \
1521 setregid \
1522 setreuid \
1523 setrlimit \
1524 setsid \
1525 setvbuf \
1526 sigaction \
1527 sigvec \
1528 snprintf \
1529 socketpair \
1530 statfs \
1531 statvfs \
1532 strdup \
1533 strerror \
1534 strlcat \
1535 strlcpy \
1536 strmode \
1537 strnvis \
1538 strtonum \
1539 strtoll \
1540 strtoul \
1541 swap32 \
1542 sysconf \
1543 tcgetpgrp \
1544 truncate \
1545 unsetenv \
1546 updwtmpx \
1547 vasprintf \
1548 vhangup \
1549 vsnprintf \
1550 waitpid \
1551)
1552
1553# IRIX has a const char return value for gai_strerror()
1554AC_CHECK_FUNCS(gai_strerror,[
1555 AC_DEFINE(HAVE_GAI_STRERROR)
1556 AC_TRY_COMPILE([
1557#include <sys/types.h>
1558#include <sys/socket.h>
1559#include <netdb.h>
1560
1561const char *gai_strerror(int);],[
1562char *str;
1563
1564str = gai_strerror(0);],[
1565 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1566 [Define if gai_strerror() returns const char *])])])
1567
1568AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1569 [Some systems put nanosleep outside of libc]))
1570
1571dnl Make sure prototypes are defined for these before using them.
1572AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1573AC_CHECK_DECL(strsep,
1574 [AC_CHECK_FUNCS(strsep)],
1575 [],
1576 [
1577#ifdef HAVE_STRING_H
1578# include <string.h>
1579#endif
1580 ])
1581
1582dnl tcsendbreak might be a macro
1583AC_CHECK_DECL(tcsendbreak,
1584 [AC_DEFINE(HAVE_TCSENDBREAK)],
1585 [AC_CHECK_FUNCS(tcsendbreak)],
1586 [#include <termios.h>]
1587)
1588
1589AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1590
1591AC_CHECK_DECLS(SHUT_RD, , ,
1592 [
1593#include <sys/types.h>
1594#include <sys/socket.h>
1595 ])
1596
1597AC_CHECK_DECLS(O_NONBLOCK, , ,
1598 [
1599#include <sys/types.h>
1600#ifdef HAVE_SYS_STAT_H
1601# include <sys/stat.h>
1602#endif
1603#ifdef HAVE_FCNTL_H
1604# include <fcntl.h>
1605#endif
1606 ])
1607
1608AC_CHECK_DECLS(writev, , , [
1609#include <sys/types.h>
1610#include <sys/uio.h>
1611#include <unistd.h>
1612 ])
1613
1614AC_CHECK_DECLS(MAXSYMLINKS, , , [
1615#include <sys/param.h>
1616 ])
1617
1618AC_CHECK_DECLS(offsetof, , , [
1619#include <stddef.h>
1620 ])
1621
1622AC_CHECK_FUNCS(setresuid, [
1623 dnl Some platorms have setresuid that isn't implemented, test for this
1624 AC_MSG_CHECKING(if setresuid seems to work)
1625 AC_RUN_IFELSE(
1626 [AC_LANG_SOURCE([[
1627#include <stdlib.h>
1628#include <errno.h>
1629int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1630 ]])],
1631 [AC_MSG_RESULT(yes)],
1632 [AC_DEFINE(BROKEN_SETRESUID, 1,
1633 [Define if your setresuid() is broken])
1634 AC_MSG_RESULT(not implemented)],
1635 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1636 )
1637])
1638
1639AC_CHECK_FUNCS(setresgid, [
1640 dnl Some platorms have setresgid that isn't implemented, test for this
1641 AC_MSG_CHECKING(if setresgid seems to work)
1642 AC_RUN_IFELSE(
1643 [AC_LANG_SOURCE([[
1644#include <stdlib.h>
1645#include <errno.h>
1646int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1647 ]])],
1648 [AC_MSG_RESULT(yes)],
1649 [AC_DEFINE(BROKEN_SETRESGID, 1,
1650 [Define if your setresgid() is broken])
1651 AC_MSG_RESULT(not implemented)],
1652 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1653 )
1654])
1655
1656dnl Checks for time functions
1657AC_CHECK_FUNCS(gettimeofday time)
1658dnl Checks for utmp functions
1659AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1660AC_CHECK_FUNCS(utmpname)
1661dnl Checks for utmpx functions
1662AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1663AC_CHECK_FUNCS(setutxent utmpxname)
1664dnl Checks for lastlog functions
1665AC_CHECK_FUNCS(getlastlogxbyname)
1666
1667AC_CHECK_FUNC(daemon,
1668 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1669 [AC_CHECK_LIB(bsd, daemon,
1670 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1671)
1672
1673AC_CHECK_FUNC(getpagesize,
1674 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1675 [Define if your libraries define getpagesize()])],
1676 [AC_CHECK_LIB(ucb, getpagesize,
1677 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1678)
1679
1680# Check for broken snprintf
1681if test "x$ac_cv_func_snprintf" = "xyes" ; then
1682 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1683 AC_RUN_IFELSE(
1684 [AC_LANG_SOURCE([[
1685#include <stdio.h>
1686int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1687 ]])],
1688 [AC_MSG_RESULT(yes)],
1689 [
1690 AC_MSG_RESULT(no)
1691 AC_DEFINE(BROKEN_SNPRINTF, 1,
1692 [Define if your snprintf is busted])
1693 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1694 ],
1695 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1696 )
1697fi
1698
1699# If we don't have a working asprintf, then we strongly depend on vsnprintf
1700# returning the right thing on overflow: the number of characters it tried to
1701# create (as per SUSv3)
1702if test "x$ac_cv_func_asprintf" != "xyes" && \
1703 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1704 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1705 AC_RUN_IFELSE(
1706 [AC_LANG_SOURCE([[
1707#include <sys/types.h>
1708#include <stdio.h>
1709#include <stdarg.h>
1710
1711int x_snprintf(char *str,size_t count,const char *fmt,...)
1712{
1713 size_t ret; va_list ap;
1714 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1715 return ret;
1716}
1717int main(void)
1718{
1719 char x[1];
1720 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1721} ]])],
1722 [AC_MSG_RESULT(yes)],
1723 [
1724 AC_MSG_RESULT(no)
1725 AC_DEFINE(BROKEN_SNPRINTF, 1,
1726 [Define if your snprintf is busted])
1727 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1728 ],
1729 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1730 )
1731fi
1732
1733# On systems where [v]snprintf is broken, but is declared in stdio,
1734# check that the fmt argument is const char * or just char *.
1735# This is only useful for when BROKEN_SNPRINTF
1736AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1737AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1738 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1739 int main(void) { snprintf(0, 0, 0); }
1740 ]])],
1741 [AC_MSG_RESULT(yes)
1742 AC_DEFINE(SNPRINTF_CONST, [const],
1743 [Define as const if snprintf() can declare const char *fmt])],
1744 [AC_MSG_RESULT(no)
1745 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1746
1747# Check for missing getpeereid (or equiv) support
1748NO_PEERCHECK=""
1749if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
1750 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1751 AC_TRY_COMPILE(
1752 [#include <sys/types.h>
1753 #include <sys/socket.h>],
1754 [int i = SO_PEERCRED;],
1755 [ AC_MSG_RESULT(yes)
1756 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1757 ],
1758 [AC_MSG_RESULT(no)
1759 NO_PEERCHECK=1]
1760 )
1761fi
1762
1763dnl see whether mkstemp() requires XXXXXX
1764if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1765AC_MSG_CHECKING([for (overly) strict mkstemp])
1766AC_RUN_IFELSE(
1767 [AC_LANG_SOURCE([[
1768#include <stdlib.h>
1769main() { char template[]="conftest.mkstemp-test";
1770if (mkstemp(template) == -1)
1771 exit(1);
1772unlink(template); exit(0);
1773}
1774 ]])],
1775 [
1776 AC_MSG_RESULT(no)
1777 ],
1778 [
1779 AC_MSG_RESULT(yes)
1780 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1781 ],
1782 [
1783 AC_MSG_RESULT(yes)
1784 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1785 ]
1786)
1787fi
1788
1789dnl make sure that openpty does not reacquire controlling terminal
1790if test ! -z "$check_for_openpty_ctty_bug"; then
1791 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1792 AC_RUN_IFELSE(
1793 [AC_LANG_SOURCE([[
1794#include <stdio.h>
1795#include <sys/fcntl.h>
1796#include <sys/types.h>
1797#include <sys/wait.h>
1798
1799int
1800main()
1801{
1802 pid_t pid;
1803 int fd, ptyfd, ttyfd, status;
1804
1805 pid = fork();
1806 if (pid < 0) { /* failed */
1807 exit(1);
1808 } else if (pid > 0) { /* parent */
1809 waitpid(pid, &status, 0);
1810 if (WIFEXITED(status))
1811 exit(WEXITSTATUS(status));
1812 else
1813 exit(2);
1814 } else { /* child */
1815 close(0); close(1); close(2);
1816 setsid();
1817 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1818 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1819 if (fd >= 0)
1820 exit(3); /* Acquired ctty: broken */
1821 else
1822 exit(0); /* Did not acquire ctty: OK */
1823 }
1824}
1825 ]])],
1826 [
1827 AC_MSG_RESULT(yes)
1828 ],
1829 [
1830 AC_MSG_RESULT(no)
1831 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1832 ],
1833 [
1834 AC_MSG_RESULT(cross-compiling, assuming yes)
1835 ]
1836 )
1837fi
1838
1839if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1840 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1841 AC_MSG_CHECKING(if getaddrinfo seems to work)
1842 AC_RUN_IFELSE(
1843 [AC_LANG_SOURCE([[
1844#include <stdio.h>
1845#include <sys/socket.h>
1846#include <netdb.h>
1847#include <errno.h>
1848#include <netinet/in.h>
1849
1850#define TEST_PORT "2222"
1851
1852int
1853main(void)
1854{
1855 int err, sock;
1856 struct addrinfo *gai_ai, *ai, hints;
1857 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1858
1859 memset(&hints, 0, sizeof(hints));
1860 hints.ai_family = PF_UNSPEC;
1861 hints.ai_socktype = SOCK_STREAM;
1862 hints.ai_flags = AI_PASSIVE;
1863
1864 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1865 if (err != 0) {
1866 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1867 exit(1);
1868 }
1869
1870 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1871 if (ai->ai_family != AF_INET6)
1872 continue;
1873
1874 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1875 sizeof(ntop), strport, sizeof(strport),
1876 NI_NUMERICHOST|NI_NUMERICSERV);
1877
1878 if (err != 0) {
1879 if (err == EAI_SYSTEM)
1880 perror("getnameinfo EAI_SYSTEM");
1881 else
1882 fprintf(stderr, "getnameinfo failed: %s\n",
1883 gai_strerror(err));
1884 exit(2);
1885 }
1886
1887 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1888 if (sock < 0)
1889 perror("socket");
1890 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1891 if (errno == EBADF)
1892 exit(3);
1893 }
1894 }
1895 exit(0);
1896}
1897 ]])],
1898 [
1899 AC_MSG_RESULT(yes)
1900 ],
1901 [
1902 AC_MSG_RESULT(no)
1903 AC_DEFINE(BROKEN_GETADDRINFO)
1904 ],
1905 [
1906 AC_MSG_RESULT(cross-compiling, assuming yes)
1907 ]
1908 )
1909fi
1910
1911if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1912 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1913 AC_MSG_CHECKING(if getaddrinfo seems to work)
1914 AC_RUN_IFELSE(
1915 [AC_LANG_SOURCE([[
1916#include <stdio.h>
1917#include <sys/socket.h>
1918#include <netdb.h>
1919#include <errno.h>
1920#include <netinet/in.h>
1921
1922#define TEST_PORT "2222"
1923
1924int
1925main(void)
1926{
1927 int err, sock;
1928 struct addrinfo *gai_ai, *ai, hints;
1929 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1930
1931 memset(&hints, 0, sizeof(hints));
1932 hints.ai_family = PF_UNSPEC;
1933 hints.ai_socktype = SOCK_STREAM;
1934 hints.ai_flags = AI_PASSIVE;
1935
1936 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1937 if (err != 0) {
1938 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1939 exit(1);
1940 }
1941
1942 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1943 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1944 continue;
1945
1946 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1947 sizeof(ntop), strport, sizeof(strport),
1948 NI_NUMERICHOST|NI_NUMERICSERV);
1949
1950 if (ai->ai_family == AF_INET && err != 0) {
1951 perror("getnameinfo");
1952 exit(2);
1953 }
1954 }
1955 exit(0);
1956}
1957 ]])],
1958 [
1959 AC_MSG_RESULT(yes)
1960 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1961 [Define if you have a getaddrinfo that fails
1962 for the all-zeros IPv6 address])
1963 ],
1964 [
1965 AC_MSG_RESULT(no)
1966 AC_DEFINE(BROKEN_GETADDRINFO)
1967 ],
1968 [
1969 AC_MSG_RESULT(cross-compiling, assuming no)
1970 ]
1971 )
1972fi
1973
1974if test "x$check_for_conflicting_getspnam" = "x1"; then
1975 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1976 AC_COMPILE_IFELSE(
1977 [
1978#include <shadow.h>
1979int main(void) {exit(0);}
1980 ],
1981 [
1982 AC_MSG_RESULT(no)
1983 ],
1984 [
1985 AC_MSG_RESULT(yes)
1986 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1987 [Conflicting defs for getspnam])
1988 ]
1989 )
1990fi
1991
1992AC_FUNC_GETPGRP
1993
1994# Search for OpenSSL
1995saved_CPPFLAGS="$CPPFLAGS"
1996saved_LDFLAGS="$LDFLAGS"
1997AC_ARG_WITH(ssl-dir,
1998 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1999 [
2000 if test "x$withval" != "xno" ; then
2001 case "$withval" in
2002 # Relative paths
2003 ./*|../*) withval="`pwd`/$withval"
2004 esac
2005 if test -d "$withval/lib"; then
2006 if test -n "${need_dash_r}"; then
2007 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
2008 else
2009 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
2010 fi
2011 else
2012 if test -n "${need_dash_r}"; then
2013 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
2014 else
2015 LDFLAGS="-L${withval} ${LDFLAGS}"
2016 fi
2017 fi
2018 if test -d "$withval/include"; then
2019 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
2020 else
2021 CPPFLAGS="-I${withval} ${CPPFLAGS}"
2022 fi
2023 fi
2024 ]
2025)
2026if test -z "$GLOBUS_LDFLAGS" ; then
2027LIBS="-lcrypto $LIBS"
2028fi
2029AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
2030 [Define if your ssl headers are included
2031 with #include <openssl/header.h>]),
2032 [
2033 dnl Check default openssl install dir
2034 if test -n "${need_dash_r}"; then
2035 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
2036 else
2037 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
2038 fi
2039 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
2040 AC_CHECK_HEADER([openssl/opensslv.h], ,
2041 AC_MSG_ERROR([*** OpenSSL headers missing - please install first or check config.log ***]))
2042 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
2043 [
2044 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
2045 ]
2046 )
2047 ]
2048)
2049
2050# Determine OpenSSL header version
2051AC_MSG_CHECKING([OpenSSL header version])
2052AC_RUN_IFELSE(
2053 [AC_LANG_SOURCE([[
2054#include <stdio.h>
2055#include <string.h>
2056#include <openssl/opensslv.h>
2057#define DATA "conftest.sslincver"
2058int main(void) {
2059 FILE *fd;
2060 int rc;
2061
2062 fd = fopen(DATA,"w");
2063 if(fd == NULL)
2064 exit(1);
2065
2066 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
2067 exit(1);
2068
2069 exit(0);
2070}
2071 ]])],
2072 [
2073 ssl_header_ver=`cat conftest.sslincver`
2074 AC_MSG_RESULT($ssl_header_ver)
2075 ],
2076 [
2077 AC_MSG_RESULT(not found)
2078 AC_MSG_ERROR(OpenSSL version header not found.)
2079 ],
2080 [
2081 AC_MSG_WARN([cross compiling: not checking])
2082 ]
2083)
2084
2085# Determine OpenSSL library version
2086AC_MSG_CHECKING([OpenSSL library version])
2087AC_RUN_IFELSE(
2088 [AC_LANG_SOURCE([[
2089#include <stdio.h>
2090#include <string.h>
2091#include <openssl/opensslv.h>
2092#include <openssl/crypto.h>
2093#define DATA "conftest.ssllibver"
2094int main(void) {
2095 FILE *fd;
2096 int rc;
2097
2098 fd = fopen(DATA,"w");
2099 if(fd == NULL)
2100 exit(1);
2101
2102 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2103 exit(1);
2104
2105 exit(0);
2106}
2107 ]])],
2108 [
2109 ssl_library_ver=`cat conftest.ssllibver`
2110 AC_MSG_RESULT($ssl_library_ver)
2111 ],
2112 [
2113 AC_MSG_RESULT(not found)
2114 AC_MSG_ERROR(OpenSSL library not found.)
2115 ],
2116 [
2117 AC_MSG_WARN([cross compiling: not checking])
2118 ]
2119)
2120
2121AC_ARG_WITH(openssl-header-check,
2122 [ --without-openssl-header-check Disable OpenSSL version consistency check],
2123 [ if test "x$withval" = "xno" ; then
2124 openssl_check_nonfatal=1
2125 fi
2126 ]
2127)
2128
2129# Sanity check OpenSSL headers
2130AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2131AC_RUN_IFELSE(
2132 [AC_LANG_SOURCE([[
2133#include <string.h>
2134#include <openssl/opensslv.h>
2135int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
2136 ]])],
2137 [
2138 AC_MSG_RESULT(yes)
2139 ],
2140 [
2141 AC_MSG_RESULT(no)
2142 if test "x$openssl_check_nonfatal" = "x"; then
2143 AC_MSG_ERROR([Your OpenSSL headers do not match your
2144library. Check config.log for details.
2145If you are sure your installation is consistent, you can disable the check
2146by running "./configure --without-openssl-header-check".
2147Also see contrib/findssl.sh for help identifying header/library mismatches.
2148])
2149 else
2150 AC_MSG_WARN([Your OpenSSL headers do not match your
2151library. Check config.log for details.
2152Also see contrib/findssl.sh for help identifying header/library mismatches.])
2153 fi
2154 ],
2155 [
2156 AC_MSG_WARN([cross compiling: not checking])
2157 ]
2158)
2159
2160AC_MSG_CHECKING([if programs using OpenSSL functions will link])
2161AC_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 saved_LIBS="$LIBS"
2172 LIBS="$LIBS -ldl"
2173 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
2174 AC_LINK_IFELSE(
2175 [AC_LANG_SOURCE([[
2176#include <openssl/evp.h>
2177int main(void) { SSLeay_add_all_algorithms(); }
2178 ]])],
2179 [
2180 AC_MSG_RESULT(yes)
2181 ],
2182 [
2183 AC_MSG_RESULT(no)
2184 LIBS="$saved_LIBS"
2185 ]
2186 )
2187 ]
2188)
2189
2190AC_ARG_WITH(ssl-engine,
2191 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2192 [ if test "x$withval" != "xno" ; then
2193 AC_MSG_CHECKING(for OpenSSL ENGINE support)
2194 AC_TRY_COMPILE(
2195 [ #include <openssl/engine.h>],
2196 [
2197ENGINE_load_builtin_engines();ENGINE_register_all_complete();
2198 ],
2199 [ AC_MSG_RESULT(yes)
2200 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
2201 [Enable OpenSSL engine support])
2202 ],
2203 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
2204 )
2205 fi ]
2206)
2207
2208# Check for OpenSSL without EVP_aes_{192,256}_cbc
2209AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2210AC_LINK_IFELSE(
2211 [AC_LANG_SOURCE([[
2212#include <string.h>
2213#include <openssl/evp.h>
2214int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
2215 ]])],
2216 [
2217 AC_MSG_RESULT(no)
2218 ],
2219 [
2220 AC_MSG_RESULT(yes)
2221 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2222 [libcrypto is missing AES 192 and 256 bit functions])
2223 ]
2224)
2225
2226AC_MSG_CHECKING([if EVP_DigestUpdate returns an int])
2227AC_LINK_IFELSE(
2228 [AC_LANG_SOURCE([[
2229#include <string.h>
2230#include <openssl/evp.h>
2231int main(void) { if(EVP_DigestUpdate(NULL, NULL,0)) exit(0); }
2232 ]])],
2233 [
2234 AC_MSG_RESULT(yes)
2235 ],
2236 [
2237 AC_MSG_RESULT(no)
2238 AC_DEFINE(OPENSSL_EVP_DIGESTUPDATE_VOID, 1,
2239 [Define if EVP_DigestUpdate returns void])
2240 ]
2241)
2242
2243# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2244# because the system crypt() is more featureful.
2245if test "x$check_for_libcrypt_before" = "x1"; then
2246 AC_CHECK_LIB(crypt, crypt)
2247fi
2248
2249# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2250# version in OpenSSL.
2251if test "x$check_for_libcrypt_later" = "x1"; then
2252 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
2253fi
2254
2255# Search for SHA256 support in libc and/or OpenSSL
2256AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2257
2258saved_LIBS="$LIBS"
2259AC_CHECK_LIB(iaf, ia_openinfo, [
2260 LIBS="$LIBS -liaf"
2261 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2262 AC_DEFINE(HAVE_LIBIAF, 1,
2263 [Define if system has libiaf that supports set_id])
2264 ])
2265])
2266LIBS="$saved_LIBS"
2267
2268### Configure cryptographic random number support
2269
2270# Check wheter OpenSSL seeds itself
2271AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2272AC_RUN_IFELSE(
2273 [AC_LANG_SOURCE([[
2274#include <string.h>
2275#include <openssl/rand.h>
2276int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
2277 ]])],
2278 [
2279 OPENSSL_SEEDS_ITSELF=yes
2280 AC_MSG_RESULT(yes)
2281 ],
2282 [
2283 AC_MSG_RESULT(no)
2284 # Default to use of the rand helper if OpenSSL doesn't
2285 # seed itself
2286 USE_RAND_HELPER=yes
2287 ],
2288 [
2289 AC_MSG_WARN([cross compiling: assuming yes])
2290 # This is safe, since all recent OpenSSL versions will
2291 # complain at runtime if not seeded correctly.
2292 OPENSSL_SEEDS_ITSELF=yes
2293 ]
2294)
2295
2296# Check for PAM libs
2297PAM_MSG="no"
2298AC_ARG_WITH(pam,
2299 [ --with-pam Enable PAM support ],
2300 [
2301 if test "x$withval" != "xno" ; then
2302 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2303 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2304 AC_MSG_ERROR([PAM headers not found])
2305 fi
2306
2307 saved_LIBS="$LIBS"
2308 AC_CHECK_LIB(dl, dlopen, , )
2309 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2310 AC_CHECK_FUNCS(pam_getenvlist)
2311 AC_CHECK_FUNCS(pam_putenv)
2312 LIBS="$saved_LIBS"
2313
2314 PAM_MSG="yes"
2315
2316 SSHDLIBS="$SSHDLIBS -lpam"
2317 AC_DEFINE(USE_PAM, 1,
2318 [Define if you want to enable PAM support])
2319
2320 if test $ac_cv_lib_dl_dlopen = yes; then
2321 case "$LIBS" in
2322 *-ldl*)
2323 # libdl already in LIBS
2324 ;;
2325 *)
2326 SSHDLIBS="$SSHDLIBS -ldl"
2327 ;;
2328 esac
2329 fi
2330 fi
2331 ]
2332)
2333
2334# Check for older PAM
2335if test "x$PAM_MSG" = "xyes" ; then
2336 # Check PAM strerror arguments (old PAM)
2337 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2338 AC_TRY_COMPILE(
2339 [
2340#include <stdlib.h>
2341#if defined(HAVE_SECURITY_PAM_APPL_H)
2342#include <security/pam_appl.h>
2343#elif defined (HAVE_PAM_PAM_APPL_H)
2344#include <pam/pam_appl.h>
2345#endif
2346 ],
2347 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2348 [AC_MSG_RESULT(no)],
2349 [
2350 AC_DEFINE(HAVE_OLD_PAM, 1,
2351 [Define if you have an old version of PAM
2352 which takes only one argument to pam_strerror])
2353 AC_MSG_RESULT(yes)
2354 PAM_MSG="yes (old library)"
2355 ]
2356 )
2357fi
2358
2359# Do we want to force the use of the rand helper?
2360AC_ARG_WITH(rand-helper,
2361 [ --with-rand-helper Use subprocess to gather strong randomness ],
2362 [
2363 if test "x$withval" = "xno" ; then
2364 # Force use of OpenSSL's internal RNG, even if
2365 # the previous test showed it to be unseeded.
2366 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2367 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2368 OPENSSL_SEEDS_ITSELF=yes
2369 USE_RAND_HELPER=""
2370 fi
2371 else
2372 USE_RAND_HELPER=yes
2373 fi
2374 ],
2375)
2376
2377# Which randomness source do we use?
2378if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
2379 # OpenSSL only
2380 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2381 [Define if you want OpenSSL's internally seeded PRNG only])
2382 RAND_MSG="OpenSSL internal ONLY"
2383 INSTALL_SSH_RAND_HELPER=""
2384elif test ! -z "$USE_RAND_HELPER" ; then
2385 # install rand helper
2386 RAND_MSG="ssh-rand-helper"
2387 INSTALL_SSH_RAND_HELPER="yes"
2388fi
2389AC_SUBST(INSTALL_SSH_RAND_HELPER)
2390
2391### Configuration of ssh-rand-helper
2392
2393# PRNGD TCP socket
2394AC_ARG_WITH(prngd-port,
2395 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2396 [
2397 case "$withval" in
2398 no)
2399 withval=""
2400 ;;
2401 [[0-9]]*)
2402 ;;
2403 *)
2404 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2405 ;;
2406 esac
2407 if test ! -z "$withval" ; then
2408 PRNGD_PORT="$withval"
2409 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2410 [Port number of PRNGD/EGD random number socket])
2411 fi
2412 ]
2413)
2414
2415# PRNGD Unix domain socket
2416AC_ARG_WITH(prngd-socket,
2417 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2418 [
2419 case "$withval" in
2420 yes)
2421 withval="/var/run/egd-pool"
2422 ;;
2423 no)
2424 withval=""
2425 ;;
2426 /*)
2427 ;;
2428 *)
2429 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2430 ;;
2431 esac
2432
2433 if test ! -z "$withval" ; then
2434 if test ! -z "$PRNGD_PORT" ; then
2435 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2436 fi
2437 if test ! -r "$withval" ; then
2438 AC_MSG_WARN(Entropy socket is not readable)
2439 fi
2440 PRNGD_SOCKET="$withval"
2441 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2442 [Location of PRNGD/EGD random number socket])
2443 fi
2444 ],
2445 [
2446 # Check for existing socket only if we don't have a random device already
2447 if test "$USE_RAND_HELPER" = yes ; then
2448 AC_MSG_CHECKING(for PRNGD/EGD socket)
2449 # Insert other locations here
2450 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2451 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2452 PRNGD_SOCKET="$sock"
2453 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2454 break;
2455 fi
2456 done
2457 if test ! -z "$PRNGD_SOCKET" ; then
2458 AC_MSG_RESULT($PRNGD_SOCKET)
2459 else
2460 AC_MSG_RESULT(not found)
2461 fi
2462 fi
2463 ]
2464)
2465
2466# Change default command timeout for hashing entropy source
2467entropy_timeout=200
2468AC_ARG_WITH(entropy-timeout,
2469 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2470 [
2471 if test -n "$withval" && test "x$withval" != "xno" && \
2472 test "x${withval}" != "xyes"; then
2473 entropy_timeout=$withval
2474 fi
2475 ]
2476)
2477AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2478 [Builtin PRNG command timeout])
2479
2480SSH_PRIVSEP_USER=sshd
2481AC_ARG_WITH(privsep-user,
2482 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
2483 [
2484 if test -n "$withval" && test "x$withval" != "xno" && \
2485 test "x${withval}" != "xyes"; then
2486 SSH_PRIVSEP_USER=$withval
2487 fi
2488 ]
2489)
2490AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2491 [non-privileged user for privilege separation])
2492AC_SUBST(SSH_PRIVSEP_USER)
2493
2494# We do this little dance with the search path to insure
2495# that programs that we select for use by installed programs
2496# (which may be run by the super-user) come from trusted
2497# locations before they come from the user's private area.
2498# This should help avoid accidentally configuring some
2499# random version of a program in someone's personal bin.
2500
2501OPATH=$PATH
2502PATH=/bin:/usr/bin
2503test -h /bin 2> /dev/null && PATH=/usr/bin
2504test -d /sbin && PATH=$PATH:/sbin
2505test -d /usr/sbin && PATH=$PATH:/usr/sbin
2506PATH=$PATH:/etc:$OPATH
2507
2508# These programs are used by the command hashing source to gather entropy
2509OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2510OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2511OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2512OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2513OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2514OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2515OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2516OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2517OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2518OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2519OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2520OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2521OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2522OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2523OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2524OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2525# restore PATH
2526PATH=$OPATH
2527
2528# Where does ssh-rand-helper get its randomness from?
2529INSTALL_SSH_PRNG_CMDS=""
2530if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2531 if test ! -z "$PRNGD_PORT" ; then
2532 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2533 elif test ! -z "$PRNGD_SOCKET" ; then
2534 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2535 else
2536 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2537 RAND_HELPER_CMDHASH=yes
2538 INSTALL_SSH_PRNG_CMDS="yes"
2539 fi
2540fi
2541AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2542
2543
2544# Cheap hack to ensure NEWS-OS libraries are arranged right.
2545if test ! -z "$SONY" ; then
2546 LIBS="$LIBS -liberty";
2547fi
2548
2549# Check for long long datatypes
2550AC_CHECK_TYPES([long long, unsigned long long, long double])
2551
2552# Check datatype sizes
2553AC_CHECK_SIZEOF(char, 1)
2554AC_CHECK_SIZEOF(short int, 2)
2555AC_CHECK_SIZEOF(int, 4)
2556AC_CHECK_SIZEOF(long int, 4)
2557AC_CHECK_SIZEOF(long long int, 8)
2558
2559# Sanity check long long for some platforms (AIX)
2560if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2561 ac_cv_sizeof_long_long_int=0
2562fi
2563
2564# compute LLONG_MIN and LLONG_MAX if we don't know them.
2565if test -z "$have_llong_max"; then
2566 AC_MSG_CHECKING([for max value of long long])
2567 AC_RUN_IFELSE(
2568 [AC_LANG_SOURCE([[
2569#include <stdio.h>
2570/* Why is this so damn hard? */
2571#ifdef __GNUC__
2572# undef __GNUC__
2573#endif
2574#define __USE_ISOC99
2575#include <limits.h>
2576#define DATA "conftest.llminmax"
2577#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2578
2579/*
2580 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2581 * we do this the hard way.
2582 */
2583static int
2584fprint_ll(FILE *f, long long n)
2585{
2586 unsigned int i;
2587 int l[sizeof(long long) * 8];
2588
2589 if (n < 0)
2590 if (fprintf(f, "-") < 0)
2591 return -1;
2592 for (i = 0; n != 0; i++) {
2593 l[i] = my_abs(n % 10);
2594 n /= 10;
2595 }
2596 do {
2597 if (fprintf(f, "%d", l[--i]) < 0)
2598 return -1;
2599 } while (i != 0);
2600 if (fprintf(f, " ") < 0)
2601 return -1;
2602 return 0;
2603}
2604
2605int main(void) {
2606 FILE *f;
2607 long long i, llmin, llmax = 0;
2608
2609 if((f = fopen(DATA,"w")) == NULL)
2610 exit(1);
2611
2612#if defined(LLONG_MIN) && defined(LLONG_MAX)
2613 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2614 llmin = LLONG_MIN;
2615 llmax = LLONG_MAX;
2616#else
2617 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2618 /* This will work on one's complement and two's complement */
2619 for (i = 1; i > llmax; i <<= 1, i++)
2620 llmax = i;
2621 llmin = llmax + 1LL; /* wrap */
2622#endif
2623
2624 /* Sanity check */
2625 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2626 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2627 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
2628 fprintf(f, "unknown unknown\n");
2629 exit(2);
2630 }
2631
2632 if (fprint_ll(f, llmin) < 0)
2633 exit(3);
2634 if (fprint_ll(f, llmax) < 0)
2635 exit(4);
2636 if (fclose(f) < 0)
2637 exit(5);
2638 exit(0);
2639}
2640 ]])],
2641 [
2642 llong_min=`$AWK '{print $1}' conftest.llminmax`
2643 llong_max=`$AWK '{print $2}' conftest.llminmax`
2644
2645 AC_MSG_RESULT($llong_max)
2646 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2647 [max value of long long calculated by configure])
2648 AC_MSG_CHECKING([for min value of long long])
2649 AC_MSG_RESULT($llong_min)
2650 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2651 [min value of long long calculated by configure])
2652 ],
2653 [
2654 AC_MSG_RESULT(not found)
2655 ],
2656 [
2657 AC_MSG_WARN([cross compiling: not checking])
2658 ]
2659 )
2660fi
2661
2662
2663# More checks for data types
2664AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2665 AC_TRY_COMPILE(
2666 [ #include <sys/types.h> ],
2667 [ u_int a; a = 1;],
2668 [ ac_cv_have_u_int="yes" ],
2669 [ ac_cv_have_u_int="no" ]
2670 )
2671])
2672if test "x$ac_cv_have_u_int" = "xyes" ; then
2673 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2674 have_u_int=1
2675fi
2676
2677AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2678 AC_TRY_COMPILE(
2679 [ #include <sys/types.h> ],
2680 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2681 [ ac_cv_have_intxx_t="yes" ],
2682 [ ac_cv_have_intxx_t="no" ]
2683 )
2684])
2685if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2686 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2687 have_intxx_t=1
2688fi
2689
2690if (test -z "$have_intxx_t" && \
2691 test "x$ac_cv_header_stdint_h" = "xyes")
2692then
2693 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2694 AC_TRY_COMPILE(
2695 [ #include <stdint.h> ],
2696 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2697 [
2698 AC_DEFINE(HAVE_INTXX_T)
2699 AC_MSG_RESULT(yes)
2700 ],
2701 [ AC_MSG_RESULT(no) ]
2702 )
2703fi
2704
2705AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2706 AC_TRY_COMPILE(
2707 [
2708#include <sys/types.h>
2709#ifdef HAVE_STDINT_H
2710# include <stdint.h>
2711#endif
2712#include <sys/socket.h>
2713#ifdef HAVE_SYS_BITYPES_H
2714# include <sys/bitypes.h>
2715#endif
2716 ],
2717 [ int64_t a; a = 1;],
2718 [ ac_cv_have_int64_t="yes" ],
2719 [ ac_cv_have_int64_t="no" ]
2720 )
2721])
2722if test "x$ac_cv_have_int64_t" = "xyes" ; then
2723 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2724fi
2725
2726AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2727 AC_TRY_COMPILE(
2728 [ #include <sys/types.h> ],
2729 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2730 [ ac_cv_have_u_intxx_t="yes" ],
2731 [ ac_cv_have_u_intxx_t="no" ]
2732 )
2733])
2734if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2735 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2736 have_u_intxx_t=1
2737fi
2738
2739if test -z "$have_u_intxx_t" ; then
2740 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2741 AC_TRY_COMPILE(
2742 [ #include <sys/socket.h> ],
2743 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2744 [
2745 AC_DEFINE(HAVE_U_INTXX_T)
2746 AC_MSG_RESULT(yes)
2747 ],
2748 [ AC_MSG_RESULT(no) ]
2749 )
2750fi
2751
2752AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2753 AC_TRY_COMPILE(
2754 [ #include <sys/types.h> ],
2755 [ u_int64_t a; a = 1;],
2756 [ ac_cv_have_u_int64_t="yes" ],
2757 [ ac_cv_have_u_int64_t="no" ]
2758 )
2759])
2760if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2761 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2762 have_u_int64_t=1
2763fi
2764
2765if test -z "$have_u_int64_t" ; then
2766 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2767 AC_TRY_COMPILE(
2768 [ #include <sys/bitypes.h> ],
2769 [ u_int64_t a; a = 1],
2770 [
2771 AC_DEFINE(HAVE_U_INT64_T)
2772 AC_MSG_RESULT(yes)
2773 ],
2774 [ AC_MSG_RESULT(no) ]
2775 )
2776fi
2777
2778if test -z "$have_u_intxx_t" ; then
2779 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2780 AC_TRY_COMPILE(
2781 [
2782#include <sys/types.h>
2783 ],
2784 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2785 [ ac_cv_have_uintxx_t="yes" ],
2786 [ ac_cv_have_uintxx_t="no" ]
2787 )
2788 ])
2789 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2790 AC_DEFINE(HAVE_UINTXX_T, 1,
2791 [define if you have uintxx_t data type])
2792 fi
2793fi
2794
2795if test -z "$have_uintxx_t" ; then
2796 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2797 AC_TRY_COMPILE(
2798 [ #include <stdint.h> ],
2799 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2800 [
2801 AC_DEFINE(HAVE_UINTXX_T)
2802 AC_MSG_RESULT(yes)
2803 ],
2804 [ AC_MSG_RESULT(no) ]
2805 )
2806fi
2807
2808if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2809 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2810then
2811 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2812 AC_TRY_COMPILE(
2813 [
2814#include <sys/bitypes.h>
2815 ],
2816 [
2817 int8_t a; int16_t b; int32_t c;
2818 u_int8_t e; u_int16_t f; u_int32_t g;
2819 a = b = c = e = f = g = 1;
2820 ],
2821 [
2822 AC_DEFINE(HAVE_U_INTXX_T)
2823 AC_DEFINE(HAVE_INTXX_T)
2824 AC_MSG_RESULT(yes)
2825 ],
2826 [AC_MSG_RESULT(no)]
2827 )
2828fi
2829
2830
2831AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2832 AC_TRY_COMPILE(
2833 [
2834#include <sys/types.h>
2835 ],
2836 [ u_char foo; foo = 125; ],
2837 [ ac_cv_have_u_char="yes" ],
2838 [ ac_cv_have_u_char="no" ]
2839 )
2840])
2841if test "x$ac_cv_have_u_char" = "xyes" ; then
2842 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2843fi
2844
2845TYPE_SOCKLEN_T
2846
2847AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2848AC_CHECK_TYPES([fsblkcnt_t, fsfilcnt_t],,,[
2849#include <sys/types.h>
2850#ifdef HAVE_SYS_BITYPES_H
2851#include <sys/bitypes.h>
2852#endif
2853#ifdef HAVE_SYS_STATFS_H
2854#include <sys/statfs.h>
2855#endif
2856#ifdef HAVE_SYS_STATVFS_H
2857#include <sys/statvfs.h>
2858#endif
2859])
2860
2861AC_CHECK_TYPES([in_addr_t, in_port_t],,,
2862[#include <sys/types.h>
2863#include <netinet/in.h>])
2864
2865AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2866 AC_TRY_COMPILE(
2867 [
2868#include <sys/types.h>
2869 ],
2870 [ size_t foo; foo = 1235; ],
2871 [ ac_cv_have_size_t="yes" ],
2872 [ ac_cv_have_size_t="no" ]
2873 )
2874])
2875if test "x$ac_cv_have_size_t" = "xyes" ; then
2876 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2877fi
2878
2879AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2880 AC_TRY_COMPILE(
2881 [
2882#include <sys/types.h>
2883 ],
2884 [ ssize_t foo; foo = 1235; ],
2885 [ ac_cv_have_ssize_t="yes" ],
2886 [ ac_cv_have_ssize_t="no" ]
2887 )
2888])
2889if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2890 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2891fi
2892
2893AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2894 AC_TRY_COMPILE(
2895 [
2896#include <time.h>
2897 ],
2898 [ clock_t foo; foo = 1235; ],
2899 [ ac_cv_have_clock_t="yes" ],
2900 [ ac_cv_have_clock_t="no" ]
2901 )
2902])
2903if test "x$ac_cv_have_clock_t" = "xyes" ; then
2904 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2905fi
2906
2907AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2908 AC_TRY_COMPILE(
2909 [
2910#include <sys/types.h>
2911#include <sys/socket.h>
2912 ],
2913 [ sa_family_t foo; foo = 1235; ],
2914 [ ac_cv_have_sa_family_t="yes" ],
2915 [ AC_TRY_COMPILE(
2916 [
2917#include <sys/types.h>
2918#include <sys/socket.h>
2919#include <netinet/in.h>
2920 ],
2921 [ sa_family_t foo; foo = 1235; ],
2922 [ ac_cv_have_sa_family_t="yes" ],
2923
2924 [ ac_cv_have_sa_family_t="no" ]
2925 )]
2926 )
2927])
2928if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2929 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2930 [define if you have sa_family_t data type])
2931fi
2932
2933AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2934 AC_TRY_COMPILE(
2935 [
2936#include <sys/types.h>
2937 ],
2938 [ pid_t foo; foo = 1235; ],
2939 [ ac_cv_have_pid_t="yes" ],
2940 [ ac_cv_have_pid_t="no" ]
2941 )
2942])
2943if test "x$ac_cv_have_pid_t" = "xyes" ; then
2944 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2945fi
2946
2947AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2948 AC_TRY_COMPILE(
2949 [
2950#include <sys/types.h>
2951 ],
2952 [ mode_t foo; foo = 1235; ],
2953 [ ac_cv_have_mode_t="yes" ],
2954 [ ac_cv_have_mode_t="no" ]
2955 )
2956])
2957if test "x$ac_cv_have_mode_t" = "xyes" ; then
2958 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2959fi
2960
2961
2962AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2963 AC_TRY_COMPILE(
2964 [
2965#include <sys/types.h>
2966#include <sys/socket.h>
2967 ],
2968 [ struct sockaddr_storage s; ],
2969 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2970 [ ac_cv_have_struct_sockaddr_storage="no" ]
2971 )
2972])
2973if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2974 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2975 [define if you have struct sockaddr_storage data type])
2976fi
2977
2978AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2979 AC_TRY_COMPILE(
2980 [
2981#include <sys/types.h>
2982#include <netinet/in.h>
2983 ],
2984 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2985 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2986 [ ac_cv_have_struct_sockaddr_in6="no" ]
2987 )
2988])
2989if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2990 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2991 [define if you have struct sockaddr_in6 data type])
2992fi
2993
2994AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2995 AC_TRY_COMPILE(
2996 [
2997#include <sys/types.h>
2998#include <netinet/in.h>
2999 ],
3000 [ struct in6_addr s; s.s6_addr[0] = 0; ],
3001 [ ac_cv_have_struct_in6_addr="yes" ],
3002 [ ac_cv_have_struct_in6_addr="no" ]
3003 )
3004])
3005if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
3006 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
3007 [define if you have struct in6_addr data type])
3008
3009dnl Now check for sin6_scope_id
3010 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
3011 [
3012#ifdef HAVE_SYS_TYPES_H
3013#include <sys/types.h>
3014#endif
3015#include <netinet/in.h>
3016 ])
3017fi
3018
3019AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
3020 AC_TRY_COMPILE(
3021 [
3022#include <sys/types.h>
3023#include <sys/socket.h>
3024#include <netdb.h>
3025 ],
3026 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
3027 [ ac_cv_have_struct_addrinfo="yes" ],
3028 [ ac_cv_have_struct_addrinfo="no" ]
3029 )
3030])
3031if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
3032 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
3033 [define if you have struct addrinfo data type])
3034fi
3035
3036AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
3037 AC_TRY_COMPILE(
3038 [ #include <sys/time.h> ],
3039 [ struct timeval tv; tv.tv_sec = 1;],
3040 [ ac_cv_have_struct_timeval="yes" ],
3041 [ ac_cv_have_struct_timeval="no" ]
3042 )
3043])
3044if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
3045 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
3046 have_struct_timeval=1
3047fi
3048
3049AC_CHECK_TYPES(struct timespec)
3050
3051# We need int64_t or else certian parts of the compile will fail.
3052if test "x$ac_cv_have_int64_t" = "xno" && \
3053 test "x$ac_cv_sizeof_long_int" != "x8" && \
3054 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
3055 echo "OpenSSH requires int64_t support. Contact your vendor or install"
3056 echo "an alternative compiler (I.E., GCC) before continuing."
3057 echo ""
3058 exit 1;
3059else
3060dnl test snprintf (broken on SCO w/gcc)
3061 AC_RUN_IFELSE(
3062 [AC_LANG_SOURCE([[
3063#include <stdio.h>
3064#include <string.h>
3065#ifdef HAVE_SNPRINTF
3066main()
3067{
3068 char buf[50];
3069 char expected_out[50];
3070 int mazsize = 50 ;
3071#if (SIZEOF_LONG_INT == 8)
3072 long int num = 0x7fffffffffffffff;
3073#else
3074 long long num = 0x7fffffffffffffffll;
3075#endif
3076 strcpy(expected_out, "9223372036854775807");
3077 snprintf(buf, mazsize, "%lld", num);
3078 if(strcmp(buf, expected_out) != 0)
3079 exit(1);
3080 exit(0);
3081}
3082#else
3083main() { exit(0); }
3084#endif
3085 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
3086 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
3087 )
3088fi
3089
3090dnl Checks for structure members
3091OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
3092OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
3093OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
3094OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
3095OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
3096OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
3097OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
3098OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
3099OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
3100OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
3101OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
3102OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
3103OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
3104OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
3105OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
3106OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
3107OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
3108
3109AC_CHECK_MEMBERS([struct stat.st_blksize])
3110AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
3111 [Define if we don't have struct __res_state in resolv.h])],
3112[
3113#include <stdio.h>
3114#if HAVE_SYS_TYPES_H
3115# include <sys/types.h>
3116#endif
3117#include <netinet/in.h>
3118#include <arpa/nameser.h>
3119#include <resolv.h>
3120])
3121
3122AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
3123 ac_cv_have_ss_family_in_struct_ss, [
3124 AC_TRY_COMPILE(
3125 [
3126#include <sys/types.h>
3127#include <sys/socket.h>
3128 ],
3129 [ struct sockaddr_storage s; s.ss_family = 1; ],
3130 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
3131 [ ac_cv_have_ss_family_in_struct_ss="no" ],
3132 )
3133])
3134if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
3135 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
3136fi
3137
3138AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
3139 ac_cv_have___ss_family_in_struct_ss, [
3140 AC_TRY_COMPILE(
3141 [
3142#include <sys/types.h>
3143#include <sys/socket.h>
3144 ],
3145 [ struct sockaddr_storage s; s.__ss_family = 1; ],
3146 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
3147 [ ac_cv_have___ss_family_in_struct_ss="no" ]
3148 )
3149])
3150if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
3151 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
3152 [Fields in struct sockaddr_storage])
3153fi
3154
3155AC_CACHE_CHECK([for pw_class field in struct passwd],
3156 ac_cv_have_pw_class_in_struct_passwd, [
3157 AC_TRY_COMPILE(
3158 [
3159#include <pwd.h>
3160 ],
3161 [ struct passwd p; p.pw_class = 0; ],
3162 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
3163 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
3164 )
3165])
3166if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
3167 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
3168 [Define if your password has a pw_class field])
3169fi
3170
3171AC_CACHE_CHECK([for pw_expire field in struct passwd],
3172 ac_cv_have_pw_expire_in_struct_passwd, [
3173 AC_TRY_COMPILE(
3174 [
3175#include <pwd.h>
3176 ],
3177 [ struct passwd p; p.pw_expire = 0; ],
3178 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
3179 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
3180 )
3181])
3182if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
3183 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
3184 [Define if your password has a pw_expire field])
3185fi
3186
3187AC_CACHE_CHECK([for pw_change field in struct passwd],
3188 ac_cv_have_pw_change_in_struct_passwd, [
3189 AC_TRY_COMPILE(
3190 [
3191#include <pwd.h>
3192 ],
3193 [ struct passwd p; p.pw_change = 0; ],
3194 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
3195 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
3196 )
3197])
3198if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
3199 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
3200 [Define if your password has a pw_change field])
3201fi
3202
3203dnl make sure we're using the real structure members and not defines
3204AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
3205 ac_cv_have_accrights_in_msghdr, [
3206 AC_COMPILE_IFELSE(
3207 [
3208#include <sys/types.h>
3209#include <sys/socket.h>
3210#include <sys/uio.h>
3211int main() {
3212#ifdef msg_accrights
3213#error "msg_accrights is a macro"
3214exit(1);
3215#endif
3216struct msghdr m;
3217m.msg_accrights = 0;
3218exit(0);
3219}
3220 ],
3221 [ ac_cv_have_accrights_in_msghdr="yes" ],
3222 [ ac_cv_have_accrights_in_msghdr="no" ]
3223 )
3224])
3225if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
3226 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
3227 [Define if your system uses access rights style
3228 file descriptor passing])
3229fi
3230
3231AC_MSG_CHECKING(if struct statvfs.f_fsid is integral type)
3232AC_TRY_COMPILE([
3233#include <sys/types.h>
3234#include <sys/stat.h>
3235#ifdef HAVE_SYS_TIME_H
3236# include <sys/time.h>
3237#endif
3238#ifdef HAVE_SYS_MOUNT_H
3239#include <sys/mount.h>
3240#endif
3241#ifdef HAVE_SYS_STATVFS_H
3242#include <sys/statvfs.h>
3243#endif
3244], [struct statvfs s; s.f_fsid = 0;],
3245[ AC_MSG_RESULT(yes) ],
3246[ AC_MSG_RESULT(no)
3247
3248 AC_MSG_CHECKING(if fsid_t has member val)
3249 AC_TRY_COMPILE([
3250#include <sys/types.h>
3251#include <sys/statvfs.h>],
3252 [fsid_t t; t.val[0] = 0;],
3253 [ AC_MSG_RESULT(yes)
3254 AC_DEFINE(FSID_HAS_VAL, 1, fsid_t has member val) ],
3255 [ AC_MSG_RESULT(no) ])
3256
3257 AC_MSG_CHECKING(if f_fsid has member __val)
3258 AC_TRY_COMPILE([
3259#include <sys/types.h>
3260#include <sys/statvfs.h>],
3261 [fsid_t t; t.__val[0] = 0;],
3262 [ AC_MSG_RESULT(yes)
3263 AC_DEFINE(FSID_HAS___VAL, 1, fsid_t has member __val) ],
3264 [ AC_MSG_RESULT(no) ])
3265])
3266
3267AC_CACHE_CHECK([for msg_control field in struct msghdr],
3268 ac_cv_have_control_in_msghdr, [
3269 AC_COMPILE_IFELSE(
3270 [
3271#include <sys/types.h>
3272#include <sys/socket.h>
3273#include <sys/uio.h>
3274int main() {
3275#ifdef msg_control
3276#error "msg_control is a macro"
3277exit(1);
3278#endif
3279struct msghdr m;
3280m.msg_control = 0;
3281exit(0);
3282}
3283 ],
3284 [ ac_cv_have_control_in_msghdr="yes" ],
3285 [ ac_cv_have_control_in_msghdr="no" ]
3286 )
3287])
3288if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
3289 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3290 [Define if your system uses ancillary data style
3291 file descriptor passing])
3292fi
3293
3294AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
3295 AC_TRY_LINK([],
3296 [ extern char *__progname; printf("%s", __progname); ],
3297 [ ac_cv_libc_defines___progname="yes" ],
3298 [ ac_cv_libc_defines___progname="no" ]
3299 )
3300])
3301if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
3302 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
3303fi
3304
3305AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3306 AC_TRY_LINK([
3307#include <stdio.h>
3308],
3309 [ printf("%s", __FUNCTION__); ],
3310 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3311 [ ac_cv_cc_implements___FUNCTION__="no" ]
3312 )
3313])
3314if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
3315 AC_DEFINE(HAVE___FUNCTION__, 1,
3316 [Define if compiler implements __FUNCTION__])
3317fi
3318
3319AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3320 AC_TRY_LINK([
3321#include <stdio.h>
3322],
3323 [ printf("%s", __func__); ],
3324 [ ac_cv_cc_implements___func__="yes" ],
3325 [ ac_cv_cc_implements___func__="no" ]
3326 )
3327])
3328if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
3329 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
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 __va_copy exists], ac_cv_have___va_copy, [
3346 AC_TRY_LINK(
3347 [#include <stdarg.h>
3348 va_list x,y;],
3349 [__va_copy(x,y);],
3350 [ ac_cv_have___va_copy="yes" ],
3351 [ ac_cv_have___va_copy="no" ]
3352 )
3353])
3354if test "x$ac_cv_have___va_copy" = "xyes" ; then
3355 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3356fi
3357
3358AC_CACHE_CHECK([whether getopt has optreset support],
3359 ac_cv_have_getopt_optreset, [
3360 AC_TRY_LINK(
3361 [
3362#include <getopt.h>
3363 ],
3364 [ extern int optreset; optreset = 0; ],
3365 [ ac_cv_have_getopt_optreset="yes" ],
3366 [ ac_cv_have_getopt_optreset="no" ]
3367 )
3368])
3369if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
3370 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3371 [Define if your getopt(3) defines and uses optreset])
3372fi
3373
3374AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
3375 AC_TRY_LINK([],
3376 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
3377 [ ac_cv_libc_defines_sys_errlist="yes" ],
3378 [ ac_cv_libc_defines_sys_errlist="no" ]
3379 )
3380])
3381if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
3382 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3383 [Define if your system defines sys_errlist[]])
3384fi
3385
3386
3387AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
3388 AC_TRY_LINK([],
3389 [ extern int sys_nerr; printf("%i", sys_nerr);],
3390 [ ac_cv_libc_defines_sys_nerr="yes" ],
3391 [ ac_cv_libc_defines_sys_nerr="no" ]
3392 )
3393])
3394if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
3395 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
3396fi
3397
3398SCARD_MSG="no"
3399# Check whether user wants sectok support
3400AC_ARG_WITH(sectok,
3401 [ --with-sectok Enable smartcard support using libsectok],
3402 [
3403 if test "x$withval" != "xno" ; then
3404 if test "x$withval" != "xyes" ; then
3405 CPPFLAGS="$CPPFLAGS -I${withval}"
3406 LDFLAGS="$LDFLAGS -L${withval}"
3407 if test ! -z "$need_dash_r" ; then
3408 LDFLAGS="$LDFLAGS -R${withval}"
3409 fi
3410 if test ! -z "$blibpath" ; then
3411 blibpath="$blibpath:${withval}"
3412 fi
3413 fi
3414 AC_CHECK_HEADERS(sectok.h)
3415 if test "$ac_cv_header_sectok_h" != yes; then
3416 AC_MSG_ERROR(Can't find sectok.h)
3417 fi
3418 AC_CHECK_LIB(sectok, sectok_open)
3419 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3420 AC_MSG_ERROR(Can't find libsectok)
3421 fi
3422 AC_DEFINE(SMARTCARD, 1,
3423 [Define if you want smartcard support])
3424 AC_DEFINE(USE_SECTOK, 1,
3425 [Define if you want smartcard support
3426 using sectok])
3427 SCARD_MSG="yes, using sectok"
3428 fi
3429 ]
3430)
3431
3432# Check whether user wants OpenSC support
3433OPENSC_CONFIG="no"
3434AC_ARG_WITH(opensc,
3435 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
3436 [
3437 if test "x$withval" != "xno" ; then
3438 if test "x$withval" != "xyes" ; then
3439 OPENSC_CONFIG=$withval/bin/opensc-config
3440 else
3441 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3442 fi
3443 if test "$OPENSC_CONFIG" != "no"; then
3444 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3445 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3446 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
3447 LIBS="$LIBS $LIBOPENSC_LIBS"
3448 AC_DEFINE(SMARTCARD)
3449 AC_DEFINE(USE_OPENSC, 1,
3450 [Define if you want smartcard support
3451 using OpenSC])
3452 SCARD_MSG="yes, using OpenSC"
3453 fi
3454 fi
3455 ]
3456)
3457
3458# Check libraries needed by DNS fingerprint support
3459AC_SEARCH_LIBS(getrrsetbyname, resolv,
3460 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3461 [Define if getrrsetbyname() exists])],
3462 [
3463 # Needed by our getrrsetbyname()
3464 AC_SEARCH_LIBS(res_query, resolv)
3465 AC_SEARCH_LIBS(dn_expand, resolv)
3466 AC_MSG_CHECKING(if res_query will link)
3467 AC_LINK_IFELSE([
3468#include "confdefs.h"
3469#include <sys/types.h>
3470#include <netinet/in.h>
3471#include <arpa/nameser.h>
3472#include <netdb.h>
3473#include <resolv.h>
3474int main()
3475{
3476 res_query (0, 0, 0, 0, 0);
3477 return 0;
3478}
3479 ],
3480 AC_MSG_RESULT(yes),
3481 [AC_MSG_RESULT(no)
3482 saved_LIBS="$LIBS"
3483 LIBS="$LIBS -lresolv"
3484 AC_MSG_CHECKING(for res_query in -lresolv)
3485 AC_LINK_IFELSE([
3486#include "confdefs.h"
3487#include <sys/types.h>
3488#include <netinet/in.h>
3489#include <arpa/nameser.h>
3490#include <netdb.h>
3491#include <resolv.h>
3492int main()
3493{
3494 res_query (0, 0, 0, 0, 0);
3495 return 0;
3496}
3497 ],
3498 [AC_MSG_RESULT(yes)],
3499 [LIBS="$saved_LIBS"
3500 AC_MSG_RESULT(no)])
3501 ])
3502 AC_CHECK_FUNCS(_getshort _getlong)
3503 AC_CHECK_DECLS([_getshort, _getlong], , ,
3504 [#include <sys/types.h>
3505 #include <arpa/nameser.h>])
3506 AC_CHECK_MEMBER(HEADER.ad,
3507 [AC_DEFINE(HAVE_HEADER_AD, 1,
3508 [Define if HEADER.ad exists in arpa/nameser.h])],,
3509 [#include <arpa/nameser.h>])
3510 ])
3511
3512AC_MSG_CHECKING(if struct __res_state _res is an extern)
3513AC_LINK_IFELSE([
3514#include <stdio.h>
3515#if HAVE_SYS_TYPES_H
3516# include <sys/types.h>
3517#endif
3518#include <netinet/in.h>
3519#include <arpa/nameser.h>
3520#include <resolv.h>
3521extern struct __res_state _res;
3522int main() { return 0; }
3523 ],
3524 [AC_MSG_RESULT(yes)
3525 AC_DEFINE(HAVE__RES_EXTERN, 1,
3526 [Define if you have struct __res_state _res as an extern])
3527 ],
3528 [ AC_MSG_RESULT(no) ]
3529)
3530
3531# Check whether user wants SELinux support
3532SELINUX_MSG="no"
3533LIBSELINUX=""
3534AC_ARG_WITH(selinux,
3535 [ --with-selinux Enable SELinux support],
3536 [ if test "x$withval" != "xno" ; then
3537 save_LIBS="$LIBS"
3538 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3539 SELINUX_MSG="yes"
3540 AC_CHECK_HEADER([selinux/selinux.h], ,
3541 AC_MSG_ERROR(SELinux support requires selinux.h header))
3542 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3543 AC_MSG_ERROR(SELinux support requires libselinux library))
3544 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
3545 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
3546 LIBS="$save_LIBS"
3547 fi ]
3548)
3549
3550# Finish configuring Globus GSSAPI
3551if test "x$gsi_path" != "xno" ; then
3552 if test ! -z "$need_dash_r" ; then
3553 LDFLAGS="$LDFLAGS -R${gsi_path}/lib"
3554 fi
3555 if test ! -z "$blibpath" ; then
3556 blibpath="$blibpath:${gsi_path}/lib"
3557 fi
3558 # test that we got the libraries OK
3559 AC_TRY_LINK(
3560 [],
3561 [],
3562 [],
3563 [
3564 AC_MSG_ERROR(link with Globus libraries failed)
3565 ]
3566 )
3567 AC_CHECK_FUNCS(globus_gss_assist_map_and_authorize)
3568fi
3569AC_SUBST(INSTALL_GSISSH)
3570
3571# Check whether the user wants GSSAPI mechglue support
3572AC_ARG_WITH(mechglue,
3573 [ --with-mechglue=PATH Build with GSSAPI mechglue library],
3574 [
3575 AC_MSG_CHECKING(for mechglue library)
3576
3577 if test -e ${withval}/libgssapi.a ; then
3578 mechglue_lib=${withval}/libgssapi.a
3579 elif test -e ${withval}/lib/libgssapi.a ; then
3580 mechglue_lib=${withval}/lib/libgssapi.a
3581 else
3582 AC_MSG_ERROR("Can't find libgssapi in ${withval}");
3583 fi
3584 LIBS="${mechglue_lib} $LIBS"
3585 AC_MSG_RESULT(${mechglue_lib})
3586
3587 AC_CHECK_LIB(dl, dlopen, , )
3588 if test $ac_cv_lib_dl_dlopen = yes; then
3589 LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic"
3590 fi
3591
3592 AC_DEFINE(GSSAPI)
3593 AC_DEFINE(MECHGLUE, 1, [Define this if you're building with GSSAPI MechGlue.])
3594 GSSAPI="mechglue"
3595 ]
3596)
3597
3598
3599# Check whether user wants Kerberos 5 support
3600KRB5_MSG="no"
3601AC_ARG_WITH(kerberos5,
3602 [ --with-kerberos5=PATH Enable Kerberos 5 support],
3603 [ if test "x$withval" != "xno" ; then
3604 if test "x$withval" = "xyes" ; then
3605 KRB5ROOT="/usr/local"
3606 else
3607 KRB5ROOT=${withval}
3608 fi
3609
3610 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
3611 KRB5_MSG="yes"
3612
3613 AC_PATH_PROG([KRB5CONF],[krb5-config],
3614 [$KRB5ROOT/bin/krb5-config],
3615 [$KRB5ROOT/bin:$PATH])
3616 if test -x $KRB5CONF ; then
3617
3618 AC_MSG_CHECKING(for gssapi support)
3619 if $KRB5CONF | grep gssapi >/dev/null ; then
3620 AC_MSG_RESULT(yes)
3621 AC_DEFINE(GSSAPI, 1,
3622 [Define this if you want GSSAPI
3623 support in the version 2 protocol])
3624 k5confopts=gssapi
3625 else
3626 AC_MSG_RESULT(no)
3627 k5confopts=""
3628 fi
3629 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3630 K5LIBS="`$KRB5CONF --libs $k5confopts`"
3631 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
3632 AC_MSG_CHECKING(whether we are using Heimdal)
3633 AC_TRY_COMPILE([ #include <krb5.h> ],
3634 [ char *tmp = heimdal_version; ],
3635 [ AC_MSG_RESULT(yes)
3636 AC_DEFINE(HEIMDAL, 1,
3637 [Define this if you are using the
3638 Heimdal version of Kerberos V5]) ],
3639 AC_MSG_RESULT(no)
3640 )
3641 else
3642 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
3643 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
3644 AC_MSG_CHECKING(whether we are using Heimdal)
3645 AC_TRY_COMPILE([ #include <krb5.h> ],
3646 [ char *tmp = heimdal_version; ],
3647 [ AC_MSG_RESULT(yes)
3648 AC_DEFINE(HEIMDAL)
3649 K5LIBS="-lkrb5 -ldes"
3650 K5LIBS="$K5LIBS -lcom_err -lasn1"
3651 AC_CHECK_LIB(roken, net_write,
3652 [K5LIBS="$K5LIBS -lroken"])
3653 ],
3654 [ AC_MSG_RESULT(no)
3655 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3656 ]
3657 )
3658 AC_SEARCH_LIBS(dn_expand, resolv)
3659
3660 AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context,
3661 [ AC_DEFINE(GSSAPI)
3662 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3663 [ AC_CHECK_LIB(gssapi, gss_init_sec_context,
3664 [ AC_DEFINE(GSSAPI)
3665 K5LIBS="-lgssapi $K5LIBS" ],
3666 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3667 $K5LIBS)
3668 ],
3669 $K5LIBS)
3670
3671 AC_CHECK_HEADER(gssapi.h, ,
3672 [ unset ac_cv_header_gssapi_h
3673 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3674 AC_CHECK_HEADERS(gssapi.h, ,
3675 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
3676 )
3677 ]
3678 )
3679
3680 oldCPP="$CPPFLAGS"
3681 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3682 AC_CHECK_HEADER(gssapi_krb5.h, ,
3683 [ CPPFLAGS="$oldCPP" ])
3684
3685 # If we're using some other GSSAPI
3686 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
3687 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
3688 fi
3689
3690 if test -z "$GSSAPI"; then
3691 GSSAPI="KRB5";
3692 fi
3693
3694 oldCPP="$CPPFLAGS"
3695 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3696 AC_CHECK_HEADER(gssapi_krb5.h, ,
3697 [ CPPFLAGS="$oldCPP" ])
3698
3699 fi
3700 if test ! -z "$need_dash_r" ; then
3701 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3702 fi
3703 if test ! -z "$blibpath" ; then
3704 blibpath="$blibpath:${KRB5ROOT}/lib"
3705 fi
3706
3707 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3708 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3709 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3710
3711 LIBS="$LIBS $K5LIBS"
3712 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3713 [Define this if you want to use libkafs' AFS support]))
3714 fi
3715 ]
3716)
3717
3718# Check whether user wants AFS_KRB5 support
3719AFS_KRB5_MSG="no"
3720AC_ARG_WITH(afs-krb5,
3721 [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).],
3722 [
3723 if test "x$withval" != "xno" ; then
3724
3725 if test "x$withval" != "xyes" ; then
3726 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval",
3727 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3728 else
3729 AC_DEFINE_UNQUOTED(AKLOG_PATH,
3730 "/usr/bin/aklog",
3731 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3732 fi
3733
3734 if test -z "$KRB5ROOT" ; then
3735 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
3736 fi
3737
3738 LIBS="-lkrbafs -lkrb4 $LIBS"
3739 if test ! -z "$AFS_LIBS" ; then
3740 LIBS="$LIBS $AFS_LIBS"
3741 fi
3742 AC_DEFINE(AFS_KRB5, 1,
3743 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3744 AFS_KRB5_MSG="yes"
3745 fi
3746 ]
3747)
3748
3749AC_ARG_WITH(session-hooks,
3750 [ --with-session-hooks Enable hooks for executing external commands before/after a session],
3751 [ AC_DEFINE(SESSION_HOOKS, 1, [Define this if you want support for startup/shutdown hooks]) ]
3752)
3753
3754# Looking for programs, paths and files
3755
3756PRIVSEP_PATH=/var/empty
3757AC_ARG_WITH(privsep-path,
3758 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
3759 [
3760 if test -n "$withval" && test "x$withval" != "xno" && \
3761 test "x${withval}" != "xyes"; then
3762 PRIVSEP_PATH=$withval
3763 fi
3764 ]
3765)
3766AC_SUBST(PRIVSEP_PATH)
3767
3768AC_ARG_WITH(xauth,
3769 [ --with-xauth=PATH Specify path to xauth program ],
3770 [
3771 if test -n "$withval" && test "x$withval" != "xno" && \
3772 test "x${withval}" != "xyes"; then
3773 xauth_path=$withval
3774 fi
3775 ],
3776 [
3777 TestPath="$PATH"
3778 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3779 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3780 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3781 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3782 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3783 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3784 xauth_path="/usr/openwin/bin/xauth"
3785 fi
3786 ]
3787)
3788
3789# strip causes problems with GSI libraries...
3790if test -z "$GLOBUS_LDFLAGS" ; then
3791STRIP_OPT=-s
3792fi
3793AC_ARG_ENABLE(strip,
3794 [ --disable-strip Disable calling strip(1) on install],
3795 [
3796 if test "x$enableval" = "xno" ; then
3797 STRIP_OPT=
3798 fi
3799 ]
3800)
3801AC_SUBST(STRIP_OPT)
3802
3803if test -z "$xauth_path" ; then
3804 XAUTH_PATH="undefined"
3805 AC_SUBST(XAUTH_PATH)
3806else
3807 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3808 [Define if xauth is found in your path])
3809 XAUTH_PATH=$xauth_path
3810 AC_SUBST(XAUTH_PATH)
3811fi
3812
3813# Check for mail directory (last resort if we cannot get it from headers)
3814if test ! -z "$MAIL" ; then
3815 maildir=`dirname $MAIL`
3816 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3817 [Set this to your mail directory if you don't have maillock.h])
3818fi
3819
3820if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3821 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3822 disable_ptmx_check=yes
3823fi
3824if test -z "$no_dev_ptmx" ; then
3825 if test "x$disable_ptmx_check" != "xyes" ; then
3826 AC_CHECK_FILE("/dev/ptmx",
3827 [
3828 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3829 [Define if you have /dev/ptmx])
3830 have_dev_ptmx=1
3831 ]
3832 )
3833 fi
3834fi
3835
3836if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3837 AC_CHECK_FILE("/dev/ptc",
3838 [
3839 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3840 [Define if you have /dev/ptc])
3841 have_dev_ptc=1
3842 ]
3843 )
3844else
3845 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3846fi
3847
3848# Options from here on. Some of these are preset by platform above
3849AC_ARG_WITH(mantype,
3850 [ --with-mantype=man|cat|doc Set man page type],
3851 [
3852 case "$withval" in
3853 man|cat|doc)
3854 MANTYPE=$withval
3855 ;;
3856 *)
3857 AC_MSG_ERROR(invalid man type: $withval)
3858 ;;
3859 esac
3860 ]
3861)
3862if test -z "$MANTYPE"; then
3863 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3864 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3865 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3866 MANTYPE=doc
3867 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3868 MANTYPE=man
3869 else
3870 MANTYPE=cat
3871 fi
3872fi
3873AC_SUBST(MANTYPE)
3874if test "$MANTYPE" = "doc"; then
3875 mansubdir=man;
3876else
3877 mansubdir=$MANTYPE;
3878fi
3879AC_SUBST(mansubdir)
3880
3881# Check whether to enable MD5 passwords
3882MD5_MSG="no"
3883AC_ARG_WITH(md5-passwords,
3884 [ --with-md5-passwords Enable use of MD5 passwords],
3885 [
3886 if test "x$withval" != "xno" ; then
3887 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3888 [Define if you want to allow MD5 passwords])
3889 MD5_MSG="yes"
3890 fi
3891 ]
3892)
3893
3894# Whether to disable shadow password support
3895AC_ARG_WITH(shadow,
3896 [ --without-shadow Disable shadow password support],
3897 [
3898 if test "x$withval" = "xno" ; then
3899 AC_DEFINE(DISABLE_SHADOW)
3900 disable_shadow=yes
3901 fi
3902 ]
3903)
3904
3905if test -z "$disable_shadow" ; then
3906 AC_MSG_CHECKING([if the systems has expire shadow information])
3907 AC_TRY_COMPILE(
3908 [
3909#include <sys/types.h>
3910#include <shadow.h>
3911 struct spwd sp;
3912 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3913 [ sp_expire_available=yes ], []
3914 )
3915
3916 if test "x$sp_expire_available" = "xyes" ; then
3917 AC_MSG_RESULT(yes)
3918 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3919 [Define if you want to use shadow password expire field])
3920 else
3921 AC_MSG_RESULT(no)
3922 fi
3923fi
3924
3925# Use ip address instead of hostname in $DISPLAY
3926if test ! -z "$IPADDR_IN_DISPLAY" ; then
3927 DISPLAY_HACK_MSG="yes"
3928 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3929 [Define if you need to use IP address
3930 instead of hostname in $DISPLAY])
3931else
3932 DISPLAY_HACK_MSG="no"
3933 AC_ARG_WITH(ipaddr-display,
3934 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3935 [
3936 if test "x$withval" != "xno" ; then
3937 AC_DEFINE(IPADDR_IN_DISPLAY)
3938 DISPLAY_HACK_MSG="yes"
3939 fi
3940 ]
3941 )
3942fi
3943
3944# check for /etc/default/login and use it if present.
3945AC_ARG_ENABLE(etc-default-login,
3946 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3947 [ if test "x$enableval" = "xno"; then
3948 AC_MSG_NOTICE([/etc/default/login handling disabled])
3949 etc_default_login=no
3950 else
3951 etc_default_login=yes
3952 fi ],
3953 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3954 then
3955 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3956 etc_default_login=no
3957 else
3958 etc_default_login=yes
3959 fi ]
3960)
3961
3962if test "x$etc_default_login" != "xno"; then
3963 AC_CHECK_FILE("/etc/default/login",
3964 [ external_path_file=/etc/default/login ])
3965 if test "x$external_path_file" = "x/etc/default/login"; then
3966 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3967 [Define if your system has /etc/default/login])
3968 fi
3969fi
3970
3971dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3972if test $ac_cv_func_login_getcapbool = "yes" && \
3973 test $ac_cv_header_login_cap_h = "yes" ; then
3974 external_path_file=/etc/login.conf
3975fi
3976
3977# Whether to mess with the default path
3978SERVER_PATH_MSG="(default)"
3979AC_ARG_WITH(default-path,
3980 [ --with-default-path= Specify default \$PATH environment for server],
3981 [
3982 if test "x$external_path_file" = "x/etc/login.conf" ; then
3983 AC_MSG_WARN([
3984--with-default-path=PATH has no effect on this system.
3985Edit /etc/login.conf instead.])
3986 elif test "x$withval" != "xno" ; then
3987 if test ! -z "$external_path_file" ; then
3988 AC_MSG_WARN([
3989--with-default-path=PATH will only be used if PATH is not defined in
3990$external_path_file .])
3991 fi
3992 user_path="$withval"
3993 SERVER_PATH_MSG="$withval"
3994 fi
3995 ],
3996 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3997 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3998 else
3999 if test ! -z "$external_path_file" ; then
4000 AC_MSG_WARN([
4001If PATH is defined in $external_path_file, ensure the path to scp is included,
4002otherwise scp will not work.])
4003 fi
4004 AC_RUN_IFELSE(
4005 [AC_LANG_SOURCE([[
4006/* find out what STDPATH is */
4007#include <stdio.h>
4008#ifdef HAVE_PATHS_H
4009# include <paths.h>
4010#endif
4011#ifndef _PATH_STDPATH
4012# ifdef _PATH_USERPATH /* Irix */
4013# define _PATH_STDPATH _PATH_USERPATH
4014# else
4015# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
4016# endif
4017#endif
4018#include <sys/types.h>
4019#include <sys/stat.h>
4020#include <fcntl.h>
4021#define DATA "conftest.stdpath"
4022
4023main()
4024{
4025 FILE *fd;
4026 int rc;
4027
4028 fd = fopen(DATA,"w");
4029 if(fd == NULL)
4030 exit(1);
4031
4032 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
4033 exit(1);
4034
4035 exit(0);
4036}
4037 ]])],
4038 [ user_path=`cat conftest.stdpath` ],
4039 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
4040 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
4041 )
4042# make sure $bindir is in USER_PATH so scp will work
4043 t_bindir=`eval echo ${bindir}`
4044 case $t_bindir in
4045 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
4046 esac
4047 case $t_bindir in
4048 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
4049 esac
4050 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
4051 if test $? -ne 0 ; then
4052 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
4053 if test $? -ne 0 ; then
4054 user_path=$user_path:$t_bindir
4055 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
4056 fi
4057 fi
4058 fi ]
4059)
4060if test "x$external_path_file" != "x/etc/login.conf" ; then
4061 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
4062 AC_SUBST(user_path)
4063fi
4064
4065# Set superuser path separately to user path
4066AC_ARG_WITH(superuser-path,
4067 [ --with-superuser-path= Specify different path for super-user],
4068 [
4069 if test -n "$withval" && test "x$withval" != "xno" && \
4070 test "x${withval}" != "xyes"; then
4071 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
4072 [Define if you want a different $PATH
4073 for the superuser])
4074 superuser_path=$withval
4075 fi
4076 ]
4077)
4078
4079
4080AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
4081IPV4_IN6_HACK_MSG="no"
4082AC_ARG_WITH(4in6,
4083 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
4084 [
4085 if test "x$withval" != "xno" ; then
4086 AC_MSG_RESULT(yes)
4087 AC_DEFINE(IPV4_IN_IPV6, 1,
4088 [Detect IPv4 in IPv6 mapped addresses
4089 and treat as IPv4])
4090 IPV4_IN6_HACK_MSG="yes"
4091 else
4092 AC_MSG_RESULT(no)
4093 fi
4094 ],[
4095 if test "x$inet6_default_4in6" = "xyes"; then
4096 AC_MSG_RESULT([yes (default)])
4097 AC_DEFINE(IPV4_IN_IPV6)
4098 IPV4_IN6_HACK_MSG="yes"
4099 else
4100 AC_MSG_RESULT([no (default)])
4101 fi
4102 ]
4103)
4104
4105# Whether to enable BSD auth support
4106BSD_AUTH_MSG=no
4107AC_ARG_WITH(bsd-auth,
4108 [ --with-bsd-auth Enable BSD auth support],
4109 [
4110 if test "x$withval" != "xno" ; then
4111 AC_DEFINE(BSD_AUTH, 1,
4112 [Define if you have BSD auth support])
4113 BSD_AUTH_MSG=yes
4114 fi
4115 ]
4116)
4117
4118# Where to place sshd.pid
4119piddir=/var/run
4120# make sure the directory exists
4121if test ! -d $piddir ; then
4122 piddir=`eval echo ${sysconfdir}`
4123 case $piddir in
4124 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
4125 esac
4126fi
4127
4128AC_ARG_WITH(pid-dir,
4129 [ --with-pid-dir=PATH Specify location of ssh.pid file],
4130 [
4131 if test -n "$withval" && test "x$withval" != "xno" && \
4132 test "x${withval}" != "xyes"; then
4133 piddir=$withval
4134 if test ! -d $piddir ; then
4135 AC_MSG_WARN([** no $piddir directory on this system **])
4136 fi
4137 fi
4138 ]
4139)
4140
4141AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
4142AC_SUBST(piddir)
4143
4144dnl allow user to disable some login recording features
4145AC_ARG_ENABLE(lastlog,
4146 [ --disable-lastlog disable use of lastlog even if detected [no]],
4147 [
4148 if test "x$enableval" = "xno" ; then
4149 AC_DEFINE(DISABLE_LASTLOG)
4150 fi
4151 ]
4152)
4153AC_ARG_ENABLE(utmp,
4154 [ --disable-utmp disable use of utmp even if detected [no]],
4155 [
4156 if test "x$enableval" = "xno" ; then
4157 AC_DEFINE(DISABLE_UTMP)
4158 fi
4159 ]
4160)
4161AC_ARG_ENABLE(utmpx,
4162 [ --disable-utmpx disable use of utmpx even if detected [no]],
4163 [
4164 if test "x$enableval" = "xno" ; then
4165 AC_DEFINE(DISABLE_UTMPX, 1,
4166 [Define if you don't want to use utmpx])
4167 fi
4168 ]
4169)
4170AC_ARG_ENABLE(wtmp,
4171 [ --disable-wtmp disable use of wtmp even if detected [no]],
4172 [
4173 if test "x$enableval" = "xno" ; then
4174 AC_DEFINE(DISABLE_WTMP)
4175 fi
4176 ]
4177)
4178AC_ARG_ENABLE(wtmpx,
4179 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
4180 [
4181 if test "x$enableval" = "xno" ; then
4182 AC_DEFINE(DISABLE_WTMPX, 1,
4183 [Define if you don't want to use wtmpx])
4184 fi
4185 ]
4186)
4187AC_ARG_ENABLE(libutil,
4188 [ --disable-libutil disable use of libutil (login() etc.) [no]],
4189 [
4190 if test "x$enableval" = "xno" ; then
4191 AC_DEFINE(DISABLE_LOGIN)
4192 fi
4193 ]
4194)
4195AC_ARG_ENABLE(pututline,
4196 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
4197 [
4198 if test "x$enableval" = "xno" ; then
4199 AC_DEFINE(DISABLE_PUTUTLINE, 1,
4200 [Define if you don't want to use pututline()
4201 etc. to write [uw]tmp])
4202 fi
4203 ]
4204)
4205AC_ARG_ENABLE(pututxline,
4206 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
4207 [
4208 if test "x$enableval" = "xno" ; then
4209 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
4210 [Define if you don't want to use pututxline()
4211 etc. to write [uw]tmpx])
4212 fi
4213 ]
4214)
4215AC_ARG_WITH(lastlog,
4216 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
4217 [
4218 if test "x$withval" = "xno" ; then
4219 AC_DEFINE(DISABLE_LASTLOG)
4220 elif test -n "$withval" && test "x${withval}" != "xyes"; then
4221 conf_lastlog_location=$withval
4222 fi
4223 ]
4224)
4225
4226dnl lastlog, [uw]tmpx? detection
4227dnl NOTE: set the paths in the platform section to avoid the
4228dnl need for command-line parameters
4229dnl lastlog and [uw]tmp are subject to a file search if all else fails
4230
4231dnl lastlog detection
4232dnl NOTE: the code itself will detect if lastlog is a directory
4233AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
4234AC_TRY_COMPILE([
4235#include <sys/types.h>
4236#include <utmp.h>
4237#ifdef HAVE_LASTLOG_H
4238# include <lastlog.h>
4239#endif
4240#ifdef HAVE_PATHS_H
4241# include <paths.h>
4242#endif
4243#ifdef HAVE_LOGIN_H
4244# include <login.h>
4245#endif
4246 ],
4247 [ char *lastlog = LASTLOG_FILE; ],
4248 [ AC_MSG_RESULT(yes) ],
4249 [
4250 AC_MSG_RESULT(no)
4251 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
4252 AC_TRY_COMPILE([
4253#include <sys/types.h>
4254#include <utmp.h>
4255#ifdef HAVE_LASTLOG_H
4256# include <lastlog.h>
4257#endif
4258#ifdef HAVE_PATHS_H
4259# include <paths.h>
4260#endif
4261 ],
4262 [ char *lastlog = _PATH_LASTLOG; ],
4263 [ AC_MSG_RESULT(yes) ],
4264 [
4265 AC_MSG_RESULT(no)
4266 system_lastlog_path=no
4267 ])
4268 ]
4269)
4270
4271if test -z "$conf_lastlog_location"; then
4272 if test x"$system_lastlog_path" = x"no" ; then
4273 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
4274 if (test -d "$f" || test -f "$f") ; then
4275 conf_lastlog_location=$f
4276 fi
4277 done
4278 if test -z "$conf_lastlog_location"; then
4279 AC_MSG_WARN([** Cannot find lastlog **])
4280 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
4281 fi
4282 fi
4283fi
4284
4285if test -n "$conf_lastlog_location"; then
4286 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
4287 [Define if you want to specify the path to your lastlog file])
4288fi
4289
4290dnl utmp detection
4291AC_MSG_CHECKING([if your system defines UTMP_FILE])
4292AC_TRY_COMPILE([
4293#include <sys/types.h>
4294#include <utmp.h>
4295#ifdef HAVE_PATHS_H
4296# include <paths.h>
4297#endif
4298 ],
4299 [ char *utmp = UTMP_FILE; ],
4300 [ AC_MSG_RESULT(yes) ],
4301 [ AC_MSG_RESULT(no)
4302 system_utmp_path=no ]
4303)
4304if test -z "$conf_utmp_location"; then
4305 if test x"$system_utmp_path" = x"no" ; then
4306 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
4307 if test -f $f ; then
4308 conf_utmp_location=$f
4309 fi
4310 done
4311 if test -z "$conf_utmp_location"; then
4312 AC_DEFINE(DISABLE_UTMP)
4313 fi
4314 fi
4315fi
4316if test -n "$conf_utmp_location"; then
4317 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
4318 [Define if you want to specify the path to your utmp file])
4319fi
4320
4321dnl wtmp detection
4322AC_MSG_CHECKING([if your system defines WTMP_FILE])
4323AC_TRY_COMPILE([
4324#include <sys/types.h>
4325#include <utmp.h>
4326#ifdef HAVE_PATHS_H
4327# include <paths.h>
4328#endif
4329 ],
4330 [ char *wtmp = WTMP_FILE; ],
4331 [ AC_MSG_RESULT(yes) ],
4332 [ AC_MSG_RESULT(no)
4333 system_wtmp_path=no ]
4334)
4335if test -z "$conf_wtmp_location"; then
4336 if test x"$system_wtmp_path" = x"no" ; then
4337 for f in /usr/adm/wtmp /var/log/wtmp; do
4338 if test -f $f ; then
4339 conf_wtmp_location=$f
4340 fi
4341 done
4342 if test -z "$conf_wtmp_location"; then
4343 AC_DEFINE(DISABLE_WTMP)
4344 fi
4345 fi
4346fi
4347if test -n "$conf_wtmp_location"; then
4348 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
4349 [Define if you want to specify the path to your wtmp file])
4350fi
4351
4352
4353dnl utmpx detection - I don't know any system so perverse as to require
4354dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
4355dnl there, though.
4356AC_MSG_CHECKING([if your system defines UTMPX_FILE])
4357AC_TRY_COMPILE([
4358#include <sys/types.h>
4359#include <utmp.h>
4360#ifdef HAVE_UTMPX_H
4361#include <utmpx.h>
4362#endif
4363#ifdef HAVE_PATHS_H
4364# include <paths.h>
4365#endif
4366 ],
4367 [ char *utmpx = UTMPX_FILE; ],
4368 [ AC_MSG_RESULT(yes) ],
4369 [ AC_MSG_RESULT(no)
4370 system_utmpx_path=no ]
4371)
4372if test -z "$conf_utmpx_location"; then
4373 if test x"$system_utmpx_path" = x"no" ; then
4374 AC_DEFINE(DISABLE_UTMPX)
4375 fi
4376else
4377 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
4378 [Define if you want to specify the path to your utmpx file])
4379fi
4380
4381dnl wtmpx detection
4382AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4383AC_TRY_COMPILE([
4384#include <sys/types.h>
4385#include <utmp.h>
4386#ifdef HAVE_UTMPX_H
4387#include <utmpx.h>
4388#endif
4389#ifdef HAVE_PATHS_H
4390# include <paths.h>
4391#endif
4392 ],
4393 [ char *wtmpx = WTMPX_FILE; ],
4394 [ AC_MSG_RESULT(yes) ],
4395 [ AC_MSG_RESULT(no)
4396 system_wtmpx_path=no ]
4397)
4398if test -z "$conf_wtmpx_location"; then
4399 if test x"$system_wtmpx_path" = x"no" ; then
4400 AC_DEFINE(DISABLE_WTMPX)
4401 fi
4402else
4403 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
4404 [Define if you want to specify the path to your wtmpx file])
4405fi
4406
4407
4408if test ! -z "$blibpath" ; then
4409 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4410 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
4411fi
4412
4413dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4414dnl Add now.
4415CFLAGS="$CFLAGS $werror_flags"
4416
4417if grep "#define BROKEN_GETADDRINFO 1" confdefs.h >/dev/null || \
4418 test "x$ac_cv_func_getaddrinfo" != "xyes" ; then
4419 AC_SUBST(TEST_SSH_IPV6, no)
4420else
4421 AC_SUBST(TEST_SSH_IPV6, yes)
4422fi
4423
4424AC_EXEEXT
4425AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4426 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
4427 scard/Makefile ssh_prng_cmds survey.sh])
4428AC_OUTPUT
4429
4430# Print summary of options
4431
4432# Someone please show me a better way :)
4433A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4434B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4435C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4436D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
4437E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
4438F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
4439G=`eval echo ${piddir}` ; G=`eval echo ${G}`
4440H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4441I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4442J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
4443
4444echo ""
4445echo "OpenSSH has been configured with the following options:"
4446echo " User binaries: $B"
4447echo " System binaries: $C"
4448echo " Configuration files: $D"
4449echo " Askpass program: $E"
4450echo " Manual pages: $F"
4451echo " PID file: $G"
4452echo " Privilege separation chroot path: $H"
4453if test "x$external_path_file" = "x/etc/login.conf" ; then
4454echo " At runtime, sshd will use the path defined in $external_path_file"
4455echo " Make sure the path to scp is present, otherwise scp will not work"
4456else
4457echo " sshd default user PATH: $I"
4458 if test ! -z "$external_path_file"; then
4459echo " (If PATH is set in $external_path_file it will be used instead. If"
4460echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4461 fi
4462fi
4463if test ! -z "$superuser_path" ; then
4464echo " sshd superuser user PATH: $J"
4465fi
4466echo " Manpage format: $MANTYPE"
4467echo " PAM support: $PAM_MSG"
4468echo " OSF SIA support: $SIA_MSG"
4469echo " KerberosV support: $KRB5_MSG"
4470echo " SELinux support: $SELINUX_MSG"
4471echo " Smartcard support: $SCARD_MSG"
4472echo " S/KEY support: $SKEY_MSG"
4473echo " TCP Wrappers support: $TCPW_MSG"
4474echo " MD5 password support: $MD5_MSG"
4475echo " libedit support: $LIBEDIT_MSG"
4476echo " Solaris process contract support: $SPC_MSG"
4477echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
4478echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4479echo " BSD Auth support: $BSD_AUTH_MSG"
4480echo " Random number source: $RAND_MSG"
4481if test ! -z "$USE_RAND_HELPER" ; then
4482echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
4483fi
4484
4485echo ""
4486
4487echo " Host: ${host}"
4488echo " Compiler: ${CC}"
4489echo " Compiler flags: ${CFLAGS}"
4490echo "Preprocessor flags: ${CPPFLAGS}"
4491echo " Linker flags: ${LDFLAGS}"
4492echo " Libraries: ${LIBS}"
4493if test ! -z "${SSHDLIBS}"; then
4494echo " +for sshd: ${SSHDLIBS}"
4495fi
4496
4497echo ""
4498
4499if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
4500 echo "SVR4 style packages are supported with \"make package\""
4501 echo ""
4502fi
4503
4504if test "x$PAM_MSG" = "xyes" ; then
4505 echo "PAM is enabled. You may need to install a PAM control file "
4506 echo "for sshd, otherwise password authentication may fail. "
4507 echo "Example PAM control files can be found in the contrib/ "
4508 echo "subdirectory"
4509 echo ""
4510fi
4511
4512if test ! -z "$RAND_HELPER_CMDHASH" ; then
4513 echo "WARNING: you are using the builtin random number collection "
4514 echo "service. Please read WARNING.RNG and request that your OS "
4515 echo "vendor includes kernel-based random number collection in "
4516 echo "future versions of your OS."
4517 echo ""
4518fi
4519
4520if test ! -z "$NO_PEERCHECK" ; then
4521 echo "WARNING: the operating system that you are using does not"
4522 echo "appear to support getpeereid(), getpeerucred() or the"
4523 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4524 echo "enforce security checks to prevent unauthorised connections to"
4525 echo "ssh-agent. Their absence increases the risk that a malicious"
4526 echo "user can connect to your agent."
4527 echo ""
4528fi
4529
4530if test "$AUDIT_MODULE" = "bsm" ; then
4531 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4532 echo "See the Solaris section in README.platform for details."
4533fi
This page took 0.174147 seconds and 5 git commands to generate.