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