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