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