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