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