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