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