]>
Commit | Line | Data |
---|---|---|
3c0ef626 | 1 | # $Id$ |
2 | ||
3 | AC_INIT | |
4 | AC_CONFIG_SRCDIR([ssh.c]) | |
5 | ||
6 | AC_CONFIG_HEADER(config.h) | |
7 | AC_PROG_CC | |
8 | AC_CANONICAL_HOST | |
9 | AC_C_BIGENDIAN | |
10 | ||
11 | # Checks for programs. | |
12 | AC_PROG_CPP | |
13 | AC_PROG_RANLIB | |
14 | AC_PROG_INSTALL | |
15 | AC_PATH_PROG(AR, ar) | |
16 | AC_PATH_PROGS(PERL, perl5 perl) | |
17 | AC_SUBST(PERL) | |
18 | AC_PATH_PROG(ENT, ent) | |
19 | AC_SUBST(ENT) | |
20 | AC_PATH_PROGS(FILEPRIV, filepriv, true, /sbin:/usr/sbin) | |
21 | AC_PATH_PROG(TEST_MINUS_S_SH, bash) | |
22 | AC_PATH_PROG(TEST_MINUS_S_SH, ksh) | |
23 | AC_PATH_PROG(TEST_MINUS_S_SH, sh) | |
24 | ||
25 | # System features | |
26 | AC_SYS_LARGEFILE | |
27 | ||
28 | if test -z "$AR" ; then | |
29 | AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***]) | |
30 | fi | |
31 | ||
32 | # Use LOGIN_PROGRAM from environment if possible | |
33 | if test ! -z "$LOGIN_PROGRAM" ; then | |
34 | AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM") | |
35 | else | |
36 | # Search for login | |
37 | AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login) | |
38 | if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then | |
39 | AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK") | |
40 | fi | |
41 | fi | |
42 | ||
43 | if test -z "$LD" ; then | |
44 | LD=$CC | |
45 | fi | |
46 | AC_SUBST(LD) | |
47 | ||
48 | AC_C_INLINE | |
49 | if test "$GCC" = "yes" || test "$GCC" = "egcs"; then | |
50 | CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized" | |
51 | fi | |
52 | ||
53 | # Check for some target-specific stuff | |
54 | case "$host" in | |
55 | *-*-aix*) | |
56 | AFS_LIBS="-lld" | |
57 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" | |
58 | LDFLAGS="$LDFLAGS -L/usr/local/lib" | |
59 | if (test "$LD" != "gcc" && test -z "$blibpath"); then | |
60 | blibpath="/usr/lib:/lib:/usr/local/lib" | |
61 | fi | |
62 | AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)]) | |
63 | AC_DEFINE(BROKEN_GETADDRINFO) | |
64 | dnl AIX handles lastlog as part of its login message | |
65 | AC_DEFINE(DISABLE_LASTLOG) | |
e9a17296 | 66 | AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H) |
3c0ef626 | 67 | ;; |
68 | *-*-cygwin*) | |
e9a17296 | 69 | LIBS="$LIBS /usr/lib/textmode.o" |
3c0ef626 | 70 | AC_DEFINE(HAVE_CYGWIN) |
71 | AC_DEFINE(USE_PIPES) | |
72 | AC_DEFINE(DISABLE_SHADOW) | |
73 | AC_DEFINE(IPV4_DEFAULT) | |
74 | AC_DEFINE(IP_TOS_IS_BROKEN) | |
75 | AC_DEFINE(NO_X11_UNIX_SOCKETS) | |
76 | ;; | |
77 | *-*-dgux*) | |
78 | AC_DEFINE(IP_TOS_IS_BROKEN) | |
79 | ;; | |
80 | *-*-darwin*) | |
81 | AC_DEFINE(BROKEN_GETADDRINFO) | |
82 | ;; | |
83 | *-*-hpux10*) | |
84 | if test -z "$GCC"; then | |
85 | CFLAGS="$CFLAGS -Ae" | |
86 | fi | |
87 | CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1" | |
88 | IPADDR_IN_DISPLAY=yes | |
89 | AC_DEFINE(USE_PIPES) | |
90 | AC_DEFINE(DISABLE_SHADOW) | |
91 | AC_DEFINE(DISABLE_UTMP) | |
92 | AC_DEFINE(SPT_TYPE,SPT_PSTAT) | |
93 | LIBS="$LIBS -lxnet -lsec" | |
94 | ;; | |
95 | *-*-hpux11*) | |
96 | CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1" | |
97 | IPADDR_IN_DISPLAY=yes | |
98 | AC_DEFINE(PAM_SUN_CODEBASE) | |
99 | AC_DEFINE(USE_PIPES) | |
100 | AC_DEFINE(DISABLE_SHADOW) | |
101 | AC_DEFINE(DISABLE_UTMP) | |
102 | AC_DEFINE(SPT_TYPE,SPT_PSTAT) | |
103 | LIBS="$LIBS -lxnet -lsec" | |
104 | ;; | |
105 | *-*-irix5*) | |
106 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" | |
107 | LDFLAGS="$LDFLAGS" | |
108 | PATH="$PATH:/usr/etc" | |
109 | AC_DEFINE(BROKEN_INET_NTOA) | |
110 | ;; | |
111 | *-*-irix6*) | |
112 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" | |
113 | LDFLAGS="$LDFLAGS" | |
114 | PATH="$PATH:/usr/etc" | |
115 | AC_DEFINE(WITH_IRIX_ARRAY) | |
116 | AC_DEFINE(WITH_IRIX_PROJECT) | |
117 | AC_DEFINE(WITH_IRIX_AUDIT) | |
118 | AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)]) | |
119 | AC_DEFINE(BROKEN_INET_NTOA) | |
120 | ;; | |
121 | *-*-linux*) | |
122 | no_dev_ptmx=1 | |
123 | check_for_libcrypt_later=1 | |
124 | AC_DEFINE(DONT_TRY_OTHER_AF) | |
125 | AC_DEFINE(PAM_TTY_KLUDGE) | |
e9a17296 | 126 | AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H) |
3c0ef626 | 127 | inet6_default_4in6=yes |
128 | ;; | |
129 | mips-sony-bsd|mips-sony-newsos4) | |
130 | AC_DEFINE(HAVE_NEWS4) | |
131 | SONY=1 | |
132 | AC_CHECK_LIB(iberty, xatexit, AC_DEFINE(HAVE_XATEXIT), | |
133 | AC_MSG_ERROR([*** libiberty missing - please install first or check config.log ***]) | |
134 | ) | |
135 | ;; | |
136 | *-*-netbsd*) | |
137 | need_dash_r=1 | |
138 | ;; | |
139 | *-*-freebsd*) | |
140 | check_for_libcrypt_later=1 | |
141 | ;; | |
142 | *-next-*) | |
143 | conf_lastlog_location="/usr/adm/lastlog" | |
144 | conf_utmp_location=/etc/utmp | |
145 | conf_wtmp_location=/usr/adm/wtmp | |
146 | MAIL=/usr/spool/mail | |
147 | AC_DEFINE(HAVE_NEXT) | |
148 | AC_DEFINE(BROKEN_REALPATH) | |
149 | AC_DEFINE(USE_PIPES) | |
150 | AC_DEFINE(BROKEN_SAVED_UIDS) | |
151 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" | |
152 | CFLAGS="$CFLAGS" | |
153 | ;; | |
154 | *-*-solaris*) | |
155 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" | |
156 | LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib" | |
157 | need_dash_r=1 | |
158 | AC_DEFINE(PAM_SUN_CODEBASE) | |
159 | AC_DEFINE(LOGIN_NEEDS_UTMPX) | |
160 | AC_DEFINE(LOGIN_NEEDS_TERM) | |
161 | AC_DEFINE(PAM_TTY_KLUDGE) | |
162 | # hardwire lastlog location (can't detect it on some versions) | |
163 | conf_lastlog_location="/var/adm/lastlog" | |
164 | AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x) | |
165 | sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'` | |
166 | if test "$sol2ver" -ge 8; then | |
167 | AC_MSG_RESULT(yes) | |
168 | AC_DEFINE(DISABLE_UTMP) | |
169 | AC_DEFINE(DISABLE_WTMP) | |
170 | else | |
171 | AC_MSG_RESULT(no) | |
172 | fi | |
173 | ;; | |
174 | *-*-sunos4*) | |
175 | CPPFLAGS="$CPPFLAGS -DSUNOS4" | |
176 | AC_CHECK_FUNCS(getpwanam) | |
177 | AC_DEFINE(PAM_SUN_CODEBASE) | |
178 | AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H) | |
179 | conf_utmp_location=/etc/utmp | |
180 | conf_wtmp_location=/var/adm/wtmp | |
181 | conf_lastlog_location=/var/adm/lastlog | |
182 | AC_DEFINE(USE_PIPES) | |
183 | ;; | |
184 | *-ncr-sysv*) | |
185 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" | |
186 | LDFLAGS="$LDFLAGS -L/usr/local/lib" | |
187 | LIBS="$LIBS -lc89" | |
188 | AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H) | |
e9a17296 | 189 | AC_DEFINE(USE_PIPES) |
3c0ef626 | 190 | ;; |
191 | *-sni-sysv*) | |
192 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" | |
193 | # /usr/ucblib MUST NOT be searched on ReliantUNIX | |
194 | LDFLAGS="$LDFLAGS -L/usr/local/lib" | |
195 | IPADDR_IN_DISPLAY=yes | |
196 | AC_DEFINE(USE_PIPES) | |
197 | AC_DEFINE(IP_TOS_IS_BROKEN) | |
198 | AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H) | |
199 | # /usr/ucblib/libucb.a no longer needed on ReliantUNIX | |
200 | # Attention: always take care to bind libsocket and libnsl before libc, | |
201 | # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog | |
202 | ;; | |
203 | *-*-sysv4.2*) | |
204 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" | |
205 | LDFLAGS="$LDFLAGS -L/usr/local/lib" | |
206 | # enable_suid_ssh=no | |
207 | AC_DEFINE(USE_PIPES) | |
208 | ;; | |
209 | *-*-sysv5*) | |
210 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" | |
211 | LDFLAGS="$LDFLAGS -L/usr/local/lib" | |
212 | # enable_suid_ssh=no | |
213 | AC_DEFINE(USE_PIPES) | |
214 | ;; | |
215 | *-*-sysv*) | |
216 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" | |
217 | LDFLAGS="$LDFLAGS -L/usr/local/lib" | |
218 | ;; | |
219 | *-*-sco3.2v4*) | |
220 | CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include" | |
221 | LDFLAGS="$LDFLAGS -L/usr/local/lib" | |
222 | LIBS="$LIBS -los -lprot -lx -ltinfo -lm" | |
223 | rsh_path="/usr/bin/rcmd" | |
224 | RANLIB=true | |
225 | no_dev_ptmx=1 | |
226 | AC_DEFINE(BROKEN_SYS_TERMIO_H) | |
227 | AC_DEFINE(USE_PIPES) | |
228 | AC_DEFINE(HAVE_SCO_PROTECTED_PW) | |
229 | AC_DEFINE(DISABLE_SHADOW) | |
230 | AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H) | |
231 | AC_DEFINE(BROKEN_SAVED_UIDS) | |
232 | AC_CHECK_FUNCS(getluid setluid) | |
233 | MANTYPE=man | |
234 | do_sco3_extra_lib_check=yes | |
235 | ;; | |
236 | *-*-sco3.2v5*) | |
237 | CPPFLAGS="$CPPFLAGS -I/usr/local/include" | |
238 | LDFLAGS="$LDFLAGS -L/usr/local/lib" | |
239 | LIBS="$LIBS -lprot -lx -ltinfo -lm" | |
240 | no_dev_ptmx=1 | |
241 | rsh_path="/usr/bin/rcmd" | |
242 | AC_DEFINE(USE_PIPES) | |
243 | AC_DEFINE(HAVE_SCO_PROTECTED_PW) | |
244 | AC_DEFINE(DISABLE_SHADOW) | |
245 | AC_DEFINE(HAVE_BOGUS_SYS_QUEUE_H) | |
246 | AC_CHECK_FUNCS(getluid setluid) | |
247 | MANTYPE=man | |
248 | ;; | |
249 | *-*-unicos*) | |
250 | no_libsocket=1 | |
251 | no_libnsl=1 | |
252 | AC_DEFINE(USE_PIPES) | |
253 | LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal,-L/usr/local/lib" | |
254 | LIBS="$LIBS -lgen -lrsc" | |
255 | ;; | |
256 | *-dec-osf*) | |
257 | AC_MSG_CHECKING(for Digital Unix SIA) | |
258 | no_osfsia="" | |
259 | AC_ARG_WITH(osfsia, | |
260 | [ --with-osfsia Enable Digital Unix SIA], | |
261 | [ | |
262 | if test "x$withval" = "xno" ; then | |
263 | AC_MSG_RESULT(disabled) | |
264 | no_osfsia=1 | |
265 | fi | |
266 | ], | |
267 | ) | |
268 | if test -z "$no_osfsia" ; then | |
269 | if test -f /etc/sia/matrix.conf; then | |
270 | AC_MSG_RESULT(yes) | |
271 | AC_DEFINE(HAVE_OSF_SIA) | |
272 | AC_DEFINE(DISABLE_LOGIN) | |
273 | LIBS="$LIBS -lsecurity -ldb -lm -laud" | |
274 | else | |
275 | AC_MSG_RESULT(no) | |
276 | fi | |
277 | fi | |
278 | ;; | |
279 | ||
280 | *-*-nto-qnx) | |
281 | AC_DEFINE(USE_PIPES) | |
282 | AC_DEFINE(NO_X11_UNIX_SOCKETS) | |
283 | AC_DEFINE(MISSING_NFDBITS) | |
284 | AC_DEFINE(MISSING_HOWMANY) | |
285 | AC_DEFINE(MISSING_FD_MASK) | |
286 | ;; | |
287 | esac | |
288 | ||
289 | # Allow user to specify flags | |
290 | AC_ARG_WITH(cflags, | |
291 | [ --with-cflags Specify additional flags to pass to compiler], | |
292 | [ | |
293 | if test "x$withval" != "xno" ; then | |
294 | CFLAGS="$CFLAGS $withval" | |
295 | fi | |
296 | ] | |
297 | ) | |
298 | AC_ARG_WITH(cppflags, | |
299 | [ --with-cppflags Specify additional flags to pass to preprocessor] , | |
300 | [ | |
301 | if test "x$withval" != "xno"; then | |
302 | CPPFLAGS="$CPPFLAGS $withval" | |
303 | fi | |
304 | ] | |
305 | ) | |
306 | AC_ARG_WITH(ldflags, | |
307 | [ --with-ldflags Specify additional flags to pass to linker], | |
308 | [ | |
309 | if test "x$withval" != "xno" ; then | |
310 | LDFLAGS="$LDFLAGS $withval" | |
311 | fi | |
312 | ] | |
313 | ) | |
314 | AC_ARG_WITH(libs, | |
315 | [ --with-libs Specify additional libraries to link with], | |
316 | [ | |
317 | if test "x$withval" != "xno" ; then | |
318 | LIBS="$LIBS $withval" | |
319 | fi | |
320 | ] | |
321 | ) | |
322 | ||
e9a17296 | 323 | # Checks for header files. |
324 | AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \ | |
325 | getopt.h glob.h lastlog.h limits.h login.h \ | |
326 | login_cap.h maillock.h netdb.h netgroup.h \ | |
327 | netinet/in_systm.h paths.h poll.h pty.h \ | |
328 | security/pam_appl.h shadow.h stddef.h stdint.h \ | |
329 | strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \ | |
330 | sys/poll.h sys/queue.h sys/select.h sys/stat.h \ | |
331 | sys/stropts.h sys/sysmacros.h sys/time.h \ | |
332 | sys/ttcompat.h sys/un.h time.h ttyent.h usersec.h \ | |
333 | util.h utime.h utmp.h utmpx.h) | |
3c0ef626 | 334 | |
335 | # Checks for libraries. | |
336 | AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match)) | |
337 | AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) | |
338 | ||
339 | dnl SCO OS3 needs this for libwrap | |
340 | if test "x$with_tcp_wrappers" != "xno" ; then | |
341 | if test "x$do_sco3_extra_lib_check" = "xyes" ; then | |
342 | AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc) | |
343 | fi | |
344 | fi | |
345 | ||
346 | AC_CHECK_FUNC(getspnam, , | |
347 | AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen")) | |
348 | ||
e9a17296 | 349 | AC_ARG_WITH(rpath, |
350 | [ --without-rpath Disable auto-added -R linker paths], | |
351 | [ | |
352 | if test "x$withval" = "xno" ; then | |
353 | need_dash_r="" | |
354 | fi | |
355 | if test "x$withval" = "xyes" ; then | |
356 | need_dash_r=1 | |
357 | fi | |
358 | ] | |
359 | ) | |
360 | ||
3c0ef626 | 361 | dnl zlib is required |
362 | AC_ARG_WITH(zlib, | |
363 | [ --with-zlib=PATH Use zlib in PATH], | |
364 | [ | |
e9a17296 | 365 | if test "x$withval" = "xno" ; then |
366 | AC_MSG_ERROR([*** zlib is required ***]) | |
367 | fi | |
3c0ef626 | 368 | if test -d "$withval/lib"; then |
369 | if test -n "${need_dash_r}"; then | |
370 | LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}" | |
371 | else | |
372 | LDFLAGS="-L${withval}/lib ${LDFLAGS}" | |
373 | fi | |
374 | else | |
375 | if test -n "${need_dash_r}"; then | |
376 | LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}" | |
377 | else | |
378 | LDFLAGS="-L${withval} ${LDFLAGS}" | |
379 | fi | |
380 | fi | |
381 | if test -d "$withval/include"; then | |
382 | CPPFLAGS="-I${withval}/include ${CPPFLAGS}" | |
383 | else | |
384 | CPPFLAGS="-I${withval} ${CPPFLAGS}" | |
385 | fi | |
386 | ] | |
387 | ) | |
388 | ||
389 | AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])) | |
390 | ||
3c0ef626 | 391 | dnl UnixWare 2.x |
392 | AC_CHECK_FUNC(strcasecmp, | |
393 | [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ] | |
394 | ) | |
395 | AC_CHECK_FUNC(utimes, | |
396 | [], [ AC_CHECK_LIB(c89, utimes, LIBS="$LIBS -lc89") ] | |
397 | ) | |
398 | ||
399 | dnl Checks for libutil functions | |
400 | AC_CHECK_HEADERS(libutil.h) | |
401 | AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)]) | |
402 | AC_CHECK_FUNCS(logout updwtmp logwtmp) | |
403 | ||
404 | AC_FUNC_STRFTIME | |
405 | ||
3c0ef626 | 406 | # Check for ALTDIRFUNC glob() extension |
407 | AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support) | |
408 | AC_EGREP_CPP(FOUNDIT, | |
409 | [ | |
410 | #include <glob.h> | |
411 | #ifdef GLOB_ALTDIRFUNC | |
412 | FOUNDIT | |
413 | #endif | |
414 | ], | |
415 | [ | |
416 | AC_DEFINE(GLOB_HAS_ALTDIRFUNC) | |
417 | AC_MSG_RESULT(yes) | |
418 | ], | |
419 | [ | |
420 | AC_MSG_RESULT(no) | |
421 | ] | |
422 | ) | |
423 | ||
424 | # Check for g.gl_matchc glob() extension | |
425 | AC_MSG_CHECKING(for gl_matchc field in glob_t) | |
426 | AC_EGREP_CPP(FOUNDIT, | |
427 | [ | |
428 | #include <glob.h> | |
429 | int main(void){glob_t g; g.gl_matchc = 1;} | |
430 | ], | |
431 | [ | |
432 | AC_DEFINE(GLOB_HAS_GL_MATCHC) | |
433 | AC_MSG_RESULT(yes) | |
434 | ], | |
435 | [ | |
436 | AC_MSG_RESULT(no) | |
437 | ] | |
438 | ) | |
439 | ||
440 | AC_MSG_CHECKING([whether struct dirent allocates space for d_name]) | |
441 | AC_TRY_RUN( | |
442 | [ | |
443 | #include <sys/types.h> | |
444 | #include <dirent.h> | |
445 | int main(void){struct dirent d;return(sizeof(d.d_name)<=sizeof(char));} | |
446 | ], | |
447 | [AC_MSG_RESULT(yes)], | |
448 | [ | |
449 | AC_MSG_RESULT(no) | |
450 | AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME) | |
451 | ] | |
452 | ) | |
453 | ||
454 | # Check whether user wants S/Key support | |
455 | SKEY_MSG="no" | |
456 | AC_ARG_WITH(skey, | |
457 | [ --with-skey[[=PATH]] Enable S/Key support | |
458 | (optionally in PATH)], | |
459 | [ | |
460 | if test "x$withval" != "xno" ; then | |
461 | ||
462 | if test "x$withval" != "xyes" ; then | |
463 | CPPFLAGS="$CPPFLAGS -I${withval}/include" | |
464 | LDFLAGS="$LDFLAGS -L${withval}/lib" | |
465 | fi | |
466 | ||
467 | AC_DEFINE(SKEY) | |
468 | LIBS="-lskey $LIBS" | |
469 | SKEY_MSG="yes" | |
470 | ||
e9a17296 | 471 | AC_MSG_CHECKING([for s/key support]) |
472 | AC_TRY_RUN( | |
473 | [ | |
474 | #include <stdio.h> | |
475 | #include <skey.h> | |
476 | int main() { char *ff = skey_keyinfo(""); ff=""; return 0; } | |
477 | ], | |
478 | [AC_MSG_RESULT(yes)], | |
3c0ef626 | 479 | [ |
e9a17296 | 480 | AC_MSG_RESULT(no) |
3c0ef626 | 481 | AC_MSG_ERROR([** Incomplete or missing s/key libraries.]) |
482 | ]) | |
483 | fi | |
484 | ] | |
485 | ) | |
486 | ||
487 | # Check whether user wants TCP wrappers support | |
488 | TCPW_MSG="no" | |
489 | AC_ARG_WITH(tcp-wrappers, | |
490 | [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support | |
491 | (optionally in PATH)], | |
492 | [ | |
493 | if test "x$withval" != "xno" ; then | |
494 | saved_LIBS="$LIBS" | |
495 | saved_LDFLAGS="$LDFLAGS" | |
496 | saved_CPPFLAGS="$CPPFLAGS" | |
497 | if test -n "${withval}" -a "${withval}" != "yes"; then | |
498 | if test -d "${withval}/lib"; then | |
499 | if test -n "${need_dash_r}"; then | |
500 | LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}" | |
501 | else | |
502 | LDFLAGS="-L${withval}/lib ${LDFLAGS}" | |
503 | fi | |
504 | else | |
505 | if test -n "${need_dash_r}"; then | |
506 | LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}" | |
507 | else | |
508 | LDFLAGS="-L${withval} ${LDFLAGS}" | |
509 | fi | |
510 | fi | |
511 | if test -d "${withval}/include"; then | |
512 | CPPFLAGS="-I${withval}/include ${CPPFLAGS}" | |
513 | else | |
514 | CPPFLAGS="-I${withval} ${CPPFLAGS}" | |
515 | fi | |
516 | fi | |
e9a17296 | 517 | LIBWRAP="-lwrap" |
518 | LIBS="$LIBWRAP $LIBS" | |
3c0ef626 | 519 | AC_MSG_CHECKING(for libwrap) |
520 | AC_TRY_LINK( | |
521 | [ | |
522 | #include <tcpd.h> | |
523 | int deny_severity = 0, allow_severity = 0; | |
524 | ], | |
525 | [hosts_access(0);], | |
526 | [ | |
527 | AC_MSG_RESULT(yes) | |
528 | AC_DEFINE(LIBWRAP) | |
e9a17296 | 529 | AC_SUBST(LIBWRAP) |
3c0ef626 | 530 | TCPW_MSG="yes" |
531 | ], | |
532 | [ | |
533 | AC_MSG_ERROR([*** libwrap missing]) | |
534 | ] | |
535 | ) | |
e9a17296 | 536 | LIBS="$saved_LIBS" |
3c0ef626 | 537 | fi |
538 | ] | |
539 | ) | |
540 | ||
541 | dnl Checks for library functions. | |
542 | AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa \ | |
543 | clock fchmod fchown freeaddrinfo futimes gai_strerror \ | |
544 | getaddrinfo getcwd getgrouplist getnameinfo getopt \ | |
545 | getrlimit getrusage getttyent glob inet_aton inet_ntoa \ | |
546 | inet_ntop innetgr login_getcapbool md5_crypt memmove \ | |
547 | mkdtemp on_exit openpty readpassphrase realpath \ | |
548 | rresvport_af setdtablesize setegid setenv seteuid \ | |
549 | setlogin setproctitle setresgid setreuid setrlimit \ | |
550 | setsid setvbuf sigaction sigvec snprintf strerror \ | |
551 | strlcat strlcpy strmode strsep sysconf tcgetpgrp utimes \ | |
552 | vhangup vsnprintf waitpid __b64_ntop _getpty) | |
553 | ||
554 | dnl IRIX and Solaris 2.5.1 have dirname() in libgen | |
555 | AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[ | |
556 | AC_CHECK_LIB(gen, dirname,[ | |
557 | AC_CACHE_CHECK([for broken dirname], | |
558 | ac_cv_have_broken_dirname, [ | |
559 | save_LIBS="$LIBS" | |
560 | LIBS="$LIBS -lgen" | |
561 | AC_TRY_RUN( | |
562 | [ | |
563 | #include <libgen.h> | |
564 | #include <string.h> | |
565 | ||
566 | int main(int argc, char **argv) { | |
567 | char *s, buf[32]; | |
568 | ||
569 | strncpy(buf,"/etc", 32); | |
570 | s = dirname(buf); | |
571 | if (!s || strncmp(s, "/", 32) != 0) { | |
572 | exit(1); | |
573 | } else { | |
574 | exit(0); | |
575 | } | |
576 | } | |
577 | ], | |
578 | [ ac_cv_have_broken_dirname="no" ], | |
579 | [ ac_cv_have_broken_dirname="yes" ] | |
580 | ) | |
581 | LIBS="$save_LIBS" | |
582 | ]) | |
583 | if test "x$ac_cv_have_broken_dirname" = "xno" ; then | |
584 | LIBS="$LIBS -lgen" | |
585 | AC_DEFINE(HAVE_DIRNAME) | |
586 | AC_CHECK_HEADERS(libgen.h) | |
587 | fi | |
588 | ]) | |
589 | ]) | |
590 | ||
591 | dnl Checks for time functions | |
592 | AC_CHECK_FUNCS(gettimeofday time) | |
593 | dnl Checks for utmp functions | |
594 | AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent) | |
595 | AC_CHECK_FUNCS(utmpname) | |
596 | dnl Checks for utmpx functions | |
597 | AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline ) | |
598 | AC_CHECK_FUNCS(setutxent utmpxname) | |
599 | ||
600 | AC_CHECK_FUNC(getuserattr, | |
601 | [AC_DEFINE(HAVE_GETUSERATTR)], | |
602 | [AC_CHECK_LIB(s, getuserattr, [LIBS="$LIBS -ls"; AC_DEFINE(HAVE_GETUSERATTR)])] | |
603 | ) | |
604 | ||
605 | AC_CHECK_FUNC(daemon, | |
606 | [AC_DEFINE(HAVE_DAEMON)], | |
607 | [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])] | |
608 | ) | |
609 | ||
610 | AC_CHECK_FUNC(getpagesize, | |
611 | [AC_DEFINE(HAVE_GETPAGESIZE)], | |
612 | [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])] | |
613 | ) | |
614 | ||
615 | # Check for broken snprintf | |
616 | if test "x$ac_cv_func_snprintf" = "xyes" ; then | |
617 | AC_MSG_CHECKING([whether snprintf correctly terminates long strings]) | |
618 | AC_TRY_RUN( | |
619 | [ | |
620 | #include <stdio.h> | |
621 | int main(void){char b[5];snprintf(b,5,"123456789");return(b[4]!='\0');} | |
622 | ], | |
623 | [AC_MSG_RESULT(yes)], | |
624 | [ | |
625 | AC_MSG_RESULT(no) | |
626 | AC_DEFINE(BROKEN_SNPRINTF) | |
627 | AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor]) | |
628 | ] | |
629 | ) | |
630 | fi | |
631 | ||
632 | AC_FUNC_GETPGRP | |
633 | ||
634 | # Check for PAM libs | |
635 | PAM_MSG="no" | |
636 | AC_ARG_WITH(pam, | |
637 | [ --with-pam Enable PAM support ], | |
638 | [ | |
639 | if test "x$withval" != "xno" ; then | |
640 | if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then | |
641 | AC_MSG_ERROR([PAM headers not found]) | |
642 | fi | |
643 | ||
644 | AC_CHECK_LIB(dl, dlopen, , ) | |
645 | AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing])) | |
646 | AC_CHECK_FUNCS(pam_getenvlist) | |
647 | ||
648 | disable_shadow=yes | |
649 | PAM_MSG="yes" | |
650 | ||
651 | AC_DEFINE(USE_PAM) | |
e9a17296 | 652 | if test $ac_cv_lib_dl_dlopen = yes; then |
653 | LIBPAM="-lpam -ldl" | |
654 | else | |
655 | LIBPAM="-lpam" | |
656 | fi | |
657 | AC_SUBST(LIBPAM) | |
3c0ef626 | 658 | fi |
659 | ] | |
660 | ) | |
661 | ||
662 | # Check for older PAM | |
663 | if test "x$PAM_MSG" = "xyes" ; then | |
664 | # Check PAM strerror arguments (old PAM) | |
665 | AC_MSG_CHECKING([whether pam_strerror takes only one argument]) | |
666 | AC_TRY_COMPILE( | |
667 | [ | |
668 | #include <stdlib.h> | |
669 | #include <security/pam_appl.h> | |
670 | ], | |
671 | [(void)pam_strerror((pam_handle_t *)NULL, -1);], | |
672 | [AC_MSG_RESULT(no)], | |
673 | [ | |
674 | AC_DEFINE(HAVE_OLD_PAM) | |
675 | AC_MSG_RESULT(yes) | |
676 | PAM_MSG="yes (old library)" | |
677 | ] | |
678 | ) | |
679 | fi | |
680 | ||
681 | # The big search for OpenSSL | |
682 | AC_ARG_WITH(ssl-dir, | |
683 | [ --with-ssl-dir=PATH Specify path to OpenSSL installation ], | |
684 | [ | |
685 | if test "x$withval" != "xno" ; then | |
686 | tryssldir=$withval | |
687 | fi | |
688 | ] | |
689 | ) | |
690 | ||
691 | saved_LIBS="$LIBS" | |
692 | saved_LDFLAGS="$LDFLAGS" | |
693 | saved_CPPFLAGS="$CPPFLAGS" | |
694 | if test "x$prefix" != "xNONE" ; then | |
695 | tryssldir="$tryssldir $prefix" | |
696 | fi | |
697 | AC_CACHE_CHECK([for OpenSSL directory], ac_cv_openssldir, [ | |
698 | for ssldir in $tryssldir "" /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl ; do | |
699 | CPPFLAGS="$saved_CPPFLAGS" | |
700 | LDFLAGS="$saved_LDFLAGS" | |
701 | LIBS="$saved_LIBS -lcrypto" | |
702 | ||
703 | # Skip directories if they don't exist | |
704 | if test ! -z "$ssldir" -a ! -d "$ssldir" ; then | |
705 | continue; | |
706 | fi | |
707 | if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then | |
708 | # Try to use $ssldir/lib if it exists, otherwise | |
709 | # $ssldir | |
710 | if test -d "$ssldir/lib" ; then | |
711 | LDFLAGS="-L$ssldir/lib $saved_LDFLAGS" | |
712 | if test ! -z "$need_dash_r" ; then | |
713 | LDFLAGS="-R$ssldir/lib $LDFLAGS" | |
714 | fi | |
715 | else | |
716 | LDFLAGS="-L$ssldir $saved_LDFLAGS" | |
717 | if test ! -z "$need_dash_r" ; then | |
718 | LDFLAGS="-R$ssldir $LDFLAGS" | |
719 | fi | |
720 | fi | |
721 | # Try to use $ssldir/include if it exists, otherwise | |
722 | # $ssldir | |
723 | if test -d "$ssldir/include" ; then | |
724 | CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS" | |
725 | else | |
726 | CPPFLAGS="-I$ssldir $saved_CPPFLAGS" | |
727 | fi | |
728 | fi | |
729 | ||
730 | # Basic test to check for compatible version and correct linking | |
731 | # *does not* test for RSA - that comes later. | |
732 | AC_TRY_RUN( | |
733 | [ | |
734 | #include <string.h> | |
735 | #include <openssl/rand.h> | |
736 | int main(void) | |
737 | { | |
738 | char a[2048]; | |
739 | memset(a, 0, sizeof(a)); | |
740 | RAND_add(a, sizeof(a), sizeof(a)); | |
741 | return(RAND_status() <= 0); | |
742 | } | |
743 | ], | |
744 | [ | |
745 | found_crypto=1 | |
746 | break; | |
747 | ], [] | |
748 | ) | |
749 | ||
750 | if test ! -z "$found_crypto" ; then | |
751 | break; | |
752 | fi | |
753 | done | |
754 | ||
755 | if test -z "$found_crypto" ; then | |
756 | AC_MSG_ERROR([Could not find working OpenSSL library, please install or check config.log]) | |
757 | fi | |
758 | if test -z "$ssldir" ; then | |
759 | ssldir="(system)" | |
760 | fi | |
761 | ||
762 | ac_cv_openssldir=$ssldir | |
763 | ]) | |
764 | ||
765 | if (test ! -z "$ac_cv_openssldir" && test "x$ac_cv_openssldir" != "x(system)") ; then | |
766 | AC_DEFINE(HAVE_OPENSSL) | |
767 | dnl Need to recover ssldir - test above runs in subshell | |
768 | ssldir=$ac_cv_openssldir | |
769 | if test ! -z "$ssldir" -a "x$ssldir" != "x/usr"; then | |
770 | # Try to use $ssldir/lib if it exists, otherwise | |
771 | # $ssldir | |
772 | if test -d "$ssldir/lib" ; then | |
773 | LDFLAGS="-L$ssldir/lib $saved_LDFLAGS" | |
774 | if test ! -z "$need_dash_r" ; then | |
775 | LDFLAGS="-R$ssldir/lib $LDFLAGS" | |
776 | fi | |
777 | else | |
778 | LDFLAGS="-L$ssldir $saved_LDFLAGS" | |
779 | if test ! -z "$need_dash_r" ; then | |
780 | LDFLAGS="-R$ssldir $LDFLAGS" | |
781 | fi | |
782 | fi | |
783 | # Try to use $ssldir/include if it exists, otherwise | |
784 | # $ssldir | |
785 | if test -d "$ssldir/include" ; then | |
786 | CPPFLAGS="-I$ssldir/include $saved_CPPFLAGS" | |
787 | else | |
788 | CPPFLAGS="-I$ssldir $saved_CPPFLAGS" | |
789 | fi | |
790 | fi | |
791 | fi | |
792 | LIBS="$saved_LIBS -lcrypto" | |
793 | ||
794 | # Now test RSA support | |
795 | saved_LIBS="$LIBS" | |
796 | AC_MSG_CHECKING([for RSA support]) | |
797 | for WANTS_RSAREF in "" 1 ; do | |
798 | if test -z "$WANTS_RSAREF" ; then | |
799 | LIBS="$saved_LIBS" | |
800 | else | |
801 | LIBS="$saved_LIBS -lRSAglue -lrsaref" | |
802 | fi | |
803 | AC_TRY_RUN([ | |
804 | #include <string.h> | |
805 | #include <openssl/rand.h> | |
806 | #include <openssl/rsa.h> | |
807 | #include <openssl/bn.h> | |
808 | #include <openssl/sha.h> | |
809 | int main(void) | |
810 | { | |
811 | int num; RSA *key; static unsigned char p_in[] = "blahblah"; | |
812 | unsigned char c[256], p[256]; | |
813 | memset(c, 0, sizeof(c)); RAND_add(c, sizeof(c), sizeof(c)); | |
814 | if ((key=RSA_generate_key(512, 3, NULL, NULL))==NULL) return(1); | |
815 | num = RSA_public_encrypt(sizeof(p_in) - 1, p_in, c, key, RSA_PKCS1_PADDING); | |
816 | return(-1 == RSA_private_decrypt(num, c, p, key, RSA_PKCS1_PADDING)); | |
817 | } | |
818 | ], | |
819 | [ | |
820 | rsa_works=1 | |
821 | break; | |
822 | ], []) | |
823 | done | |
824 | LIBS="$saved_LIBS" | |
825 | ||
826 | if test ! -z "$no_rsa" ; then | |
827 | AC_MSG_RESULT(disabled) | |
828 | RSA_MSG="disabled" | |
829 | else | |
830 | if test -z "$rsa_works" ; then | |
831 | AC_MSG_WARN([*** No RSA support found *** ]) | |
832 | RSA_MSG="no" | |
833 | else | |
834 | if test -z "$WANTS_RSAREF" ; then | |
835 | AC_MSG_RESULT(yes) | |
836 | RSA_MSG="yes" | |
837 | else | |
838 | RSA_MSG="yes (using RSAref)" | |
839 | AC_MSG_RESULT(using RSAref) | |
840 | LIBS="$LIBS -lcrypto -lRSAglue -lrsaref" | |
841 | fi | |
842 | fi | |
843 | fi | |
844 | ||
e9a17296 | 845 | # Sanity check OpenSSL headers |
846 | AC_MSG_CHECKING([whether OpenSSL's headers match the library]) | |
847 | AC_TRY_RUN( | |
848 | [ | |
849 | #include <string.h> | |
850 | #include <openssl/opensslv.h> | |
851 | int main(void) { return(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); } | |
852 | ], | |
853 | [ | |
854 | AC_MSG_RESULT(yes) | |
855 | ], | |
856 | [ | |
857 | AC_MSG_RESULT(no) | |
858 | AC_MSG_ERROR(Your OpenSSL headers do not match your library) | |
859 | ] | |
860 | ) | |
861 | ||
3c0ef626 | 862 | # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the |
863 | # version in OpenSSL. Skip this for PAM | |
864 | if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then | |
865 | AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt") | |
866 | fi | |
867 | ||
e9a17296 | 868 | |
869 | ### Configure cryptographic random number support | |
870 | ||
871 | # Check wheter OpenSSL seeds itself | |
872 | AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded]) | |
873 | AC_TRY_RUN( | |
874 | [ | |
875 | #include <string.h> | |
876 | #include <openssl/rand.h> | |
877 | int main(void) { return(RAND_status() == 1 ? 0 : 1); } | |
878 | ], | |
879 | [ | |
880 | OPENSSL_SEEDS_ITSELF=yes | |
881 | AC_MSG_RESULT(yes) | |
882 | ], | |
883 | [ | |
884 | AC_MSG_RESULT(no) | |
885 | # Default to use of the rand helper if OpenSSL doesn't | |
886 | # seed itself | |
887 | USE_RAND_HELPER=yes | |
888 | ] | |
889 | ) | |
890 | ||
891 | ||
892 | # Do we want to force the use of the rand helper? | |
893 | AC_ARG_WITH(rand-helper, | |
894 | [ --with-rand-helper Use subprocess to gather strong randomness ], | |
895 | [ | |
896 | if test "x$withval" = "xno" ; then | |
897 | # Force use of OpenSSL's internal RNG, even if | |
898 | # the previous test showed it to be unseeded. | |
899 | if test -z "$OPENSSL_SEEDS_ITSELF" ; then | |
900 | AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG]) | |
901 | OPENSSL_SEEDS_ITSELF=yes | |
902 | USE_RAND_HELPER="" | |
903 | fi | |
904 | else | |
905 | USE_RAND_HELPER=yes | |
906 | fi | |
907 | ], | |
908 | ) | |
909 | ||
910 | # Which randomness source do we use? | |
911 | if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then | |
912 | # OpenSSL only | |
913 | AC_DEFINE(OPENSSL_PRNG_ONLY) | |
914 | RAND_MSG="OpenSSL internal ONLY" | |
915 | INSTALL_SSH_RAND_HELPER="" | |
916 | elif test ! -z "$USE_RAND_HELPER" ; then | |
917 | # install rand helper | |
918 | RAND_MSG="ssh-rand-helper" | |
919 | INSTALL_SSH_RAND_HELPER="yes" | |
920 | fi | |
921 | AC_SUBST(INSTALL_SSH_RAND_HELPER) | |
922 | ||
923 | ### Configuration of ssh-rand-helper | |
924 | ||
925 | # PRNGD TCP socket | |
926 | AC_ARG_WITH(prngd-port, | |
927 | [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT], | |
928 | [ | |
929 | case "$withval" in | |
930 | no) | |
931 | withval="" | |
932 | ;; | |
933 | [[0-9]]*) | |
934 | ;; | |
935 | *) | |
936 | AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port) | |
937 | ;; | |
938 | esac | |
939 | if test ! -z "$withval" ; then | |
940 | PRNGD_PORT="$withval" | |
941 | AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT) | |
942 | fi | |
943 | ] | |
944 | ) | |
945 | ||
946 | # PRNGD Unix domain socket | |
947 | AC_ARG_WITH(prngd-socket, | |
948 | [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)], | |
949 | [ | |
950 | case "$withval" in | |
951 | yes) | |
952 | withval="/var/run/egd-pool" | |
953 | ;; | |
954 | no) | |
955 | withval="" | |
956 | ;; | |
957 | /*) | |
958 | ;; | |
959 | *) | |
960 | AC_MSG_ERROR(You must specify an absolute path to the entropy socket) | |
961 | ;; | |
962 | esac | |
963 | ||
964 | if test ! -z "$withval" ; then | |
965 | if test ! -z "$PRNGD_PORT" ; then | |
966 | AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket) | |
967 | fi | |
968 | if test ! -r "$withval" ; then | |
969 | AC_MSG_WARN(Entropy socket is not readable) | |
970 | fi | |
971 | PRNGD_SOCKET="$withval" | |
972 | AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET") | |
973 | fi | |
974 | ], | |
975 | [ | |
976 | # Check for existing socket only if we don't have a random device already | |
977 | if test "$USE_RAND_HELPER" = yes ; then | |
978 | AC_MSG_CHECKING(for PRNGD/EGD socket) | |
979 | # Insert other locations here | |
980 | for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do | |
981 | if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then | |
982 | PRNGD_SOCKET="$sock" | |
983 | AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET") | |
984 | break; | |
985 | fi | |
986 | done | |
987 | if test ! -z "$PRNGD_SOCKET" ; then | |
988 | AC_MSG_RESULT($PRNGD_SOCKET) | |
989 | else | |
990 | AC_MSG_RESULT(not found) | |
991 | fi | |
992 | fi | |
993 | ] | |
994 | ) | |
995 | ||
996 | # Change default command timeout for hashing entropy source | |
997 | entropy_timeout=200 | |
998 | AC_ARG_WITH(entropy-timeout, | |
999 | [ --with-entropy-timeout Specify entropy gathering command timeout (msec)], | |
1000 | [ | |
1001 | if test "x$withval" != "xno" ; then | |
1002 | entropy_timeout=$withval | |
1003 | fi | |
1004 | ] | |
1005 | ) | |
1006 | ||
1007 | AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout) | |
1008 | ||
1009 | # These programs are used by the command hashing source to gather entropy | |
1010 | OSSH_PATH_ENTROPY_PROG(PROG_LS, ls) | |
1011 | OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat) | |
1012 | OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp) | |
1013 | OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig) | |
1014 | OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat) | |
1015 | OSSH_PATH_ENTROPY_PROG(PROG_PS, ps) | |
1016 | OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar) | |
1017 | OSSH_PATH_ENTROPY_PROG(PROG_W, w) | |
1018 | OSSH_PATH_ENTROPY_PROG(PROG_WHO, who) | |
1019 | OSSH_PATH_ENTROPY_PROG(PROG_LAST, last) | |
1020 | OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog) | |
1021 | OSSH_PATH_ENTROPY_PROG(PROG_DF, df) | |
1022 | OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat) | |
1023 | OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime) | |
1024 | OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs) | |
1025 | OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail) | |
1026 | ||
1027 | # Where does ssh-rand-helper get its randomness from? | |
1028 | INSTALL_SSH_PRNG_CMDS="" | |
1029 | if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then | |
1030 | if test ! -z "$PRNGD_PORT" ; then | |
1031 | RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT" | |
1032 | elif test ! -z "$PRNGD_SOCKET" ; then | |
1033 | RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\"" | |
1034 | else | |
1035 | RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)" | |
1036 | RAND_HELPER_CMDHASH=yes | |
1037 | INSTALL_SSH_PRNG_CMDS="yes" | |
1038 | fi | |
1039 | fi | |
1040 | AC_SUBST(INSTALL_SSH_PRNG_CMDS) | |
1041 | ||
1042 | ||
3c0ef626 | 1043 | # Cheap hack to ensure NEWS-OS libraries are arranged right. |
1044 | if test ! -z "$SONY" ; then | |
1045 | LIBS="$LIBS -liberty"; | |
1046 | fi | |
1047 | ||
1048 | # Checks for data types | |
1049 | AC_CHECK_SIZEOF(char, 1) | |
1050 | AC_CHECK_SIZEOF(short int, 2) | |
1051 | AC_CHECK_SIZEOF(int, 4) | |
1052 | AC_CHECK_SIZEOF(long int, 4) | |
1053 | AC_CHECK_SIZEOF(long long int, 8) | |
1054 | ||
1055 | # More checks for data types | |
1056 | AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [ | |
1057 | AC_TRY_COMPILE( | |
1058 | [ #include <sys/types.h> ], | |
1059 | [ u_int a; a = 1;], | |
1060 | [ ac_cv_have_u_int="yes" ], | |
1061 | [ ac_cv_have_u_int="no" ] | |
1062 | ) | |
1063 | ]) | |
1064 | if test "x$ac_cv_have_u_int" = "xyes" ; then | |
1065 | AC_DEFINE(HAVE_U_INT) | |
1066 | have_u_int=1 | |
1067 | fi | |
1068 | ||
1069 | AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [ | |
1070 | AC_TRY_COMPILE( | |
1071 | [ #include <sys/types.h> ], | |
1072 | [ int8_t a; int16_t b; int32_t c; a = b = c = 1;], | |
1073 | [ ac_cv_have_intxx_t="yes" ], | |
1074 | [ ac_cv_have_intxx_t="no" ] | |
1075 | ) | |
1076 | ]) | |
1077 | if test "x$ac_cv_have_intxx_t" = "xyes" ; then | |
1078 | AC_DEFINE(HAVE_INTXX_T) | |
1079 | have_intxx_t=1 | |
1080 | fi | |
1081 | ||
1082 | if (test -z "$have_intxx_t" && \ | |
1083 | test "x$ac_cv_header_stdint_h" = "xyes") | |
1084 | then | |
1085 | AC_MSG_CHECKING([for intXX_t types in stdint.h]) | |
1086 | AC_TRY_COMPILE( | |
1087 | [ #include <stdint.h> ], | |
1088 | [ int8_t a; int16_t b; int32_t c; a = b = c = 1;], | |
1089 | [ | |
1090 | AC_DEFINE(HAVE_INTXX_T) | |
1091 | AC_MSG_RESULT(yes) | |
1092 | ], | |
1093 | [ AC_MSG_RESULT(no) ] | |
1094 | ) | |
1095 | fi | |
1096 | ||
1097 | AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [ | |
1098 | AC_TRY_COMPILE( | |
1099 | [ #include <sys/types.h> ], | |
1100 | [ int64_t a; a = 1;], | |
1101 | [ ac_cv_have_int64_t="yes" ], | |
1102 | [ ac_cv_have_int64_t="no" ] | |
1103 | ) | |
1104 | ]) | |
1105 | if test "x$ac_cv_have_int64_t" = "xyes" ; then | |
1106 | AC_DEFINE(HAVE_INT64_T) | |
1107 | have_int64_t=1 | |
1108 | fi | |
1109 | ||
1110 | if test -z "$have_int64_t" ; then | |
1111 | AC_MSG_CHECKING([for int64_t type in sys/socket.h]) | |
1112 | AC_TRY_COMPILE( | |
1113 | [ #include <sys/socket.h> ], | |
1114 | [ int64_t a; a = 1], | |
1115 | [ | |
1116 | AC_DEFINE(HAVE_INT64_T) | |
1117 | AC_MSG_RESULT(yes) | |
1118 | ], | |
1119 | [ AC_MSG_RESULT(no) ] | |
1120 | ) | |
1121 | fi | |
1122 | ||
e9a17296 | 1123 | if test -z "$have_int64_t" ; then |
1124 | AC_MSG_CHECKING([for int64_t type in sys/bitypes.h]) | |
1125 | AC_TRY_COMPILE( | |
1126 | [ #include <sys/bitypes.h> ], | |
1127 | [ int64_t a; a = 1], | |
1128 | [ | |
1129 | AC_DEFINE(HAVE_INT64_T) | |
1130 | AC_MSG_RESULT(yes) | |
1131 | ], | |
1132 | [ AC_MSG_RESULT(no) ] | |
1133 | ) | |
1134 | fi | |
1135 | ||
3c0ef626 | 1136 | AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [ |
1137 | AC_TRY_COMPILE( | |
1138 | [ #include <sys/types.h> ], | |
1139 | [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;], | |
1140 | [ ac_cv_have_u_intxx_t="yes" ], | |
1141 | [ ac_cv_have_u_intxx_t="no" ] | |
1142 | ) | |
1143 | ]) | |
1144 | if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then | |
1145 | AC_DEFINE(HAVE_U_INTXX_T) | |
1146 | have_u_intxx_t=1 | |
1147 | fi | |
1148 | ||
1149 | if test -z "$have_u_intxx_t" ; then | |
1150 | AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h]) | |
1151 | AC_TRY_COMPILE( | |
1152 | [ #include <sys/socket.h> ], | |
1153 | [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;], | |
1154 | [ | |
1155 | AC_DEFINE(HAVE_U_INTXX_T) | |
1156 | AC_MSG_RESULT(yes) | |
1157 | ], | |
1158 | [ AC_MSG_RESULT(no) ] | |
1159 | ) | |
1160 | fi | |
1161 | ||
1162 | AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [ | |
1163 | AC_TRY_COMPILE( | |
1164 | [ #include <sys/types.h> ], | |
1165 | [ u_int64_t a; a = 1;], | |
1166 | [ ac_cv_have_u_int64_t="yes" ], | |
1167 | [ ac_cv_have_u_int64_t="no" ] | |
1168 | ) | |
1169 | ]) | |
1170 | if test "x$ac_cv_have_u_int64_t" = "xyes" ; then | |
1171 | AC_DEFINE(HAVE_U_INT64_T) | |
1172 | have_u_int64_t=1 | |
1173 | fi | |
1174 | ||
e9a17296 | 1175 | if test -z "$have_u_int64_t" ; then |
1176 | AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h]) | |
1177 | AC_TRY_COMPILE( | |
1178 | [ #include <sys/bitypes.h> ], | |
1179 | [ u_int64_t a; a = 1], | |
1180 | [ | |
1181 | AC_DEFINE(HAVE_U_INT64_T) | |
1182 | AC_MSG_RESULT(yes) | |
1183 | ], | |
1184 | [ AC_MSG_RESULT(no) ] | |
1185 | ) | |
1186 | fi | |
1187 | ||
3c0ef626 | 1188 | if test -z "$have_u_intxx_t" ; then |
1189 | AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [ | |
1190 | AC_TRY_COMPILE( | |
1191 | [ | |
1192 | #include <sys/types.h> | |
1193 | ], | |
1194 | [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ], | |
1195 | [ ac_cv_have_uintxx_t="yes" ], | |
1196 | [ ac_cv_have_uintxx_t="no" ] | |
1197 | ) | |
1198 | ]) | |
1199 | if test "x$ac_cv_have_uintxx_t" = "xyes" ; then | |
1200 | AC_DEFINE(HAVE_UINTXX_T) | |
1201 | fi | |
1202 | fi | |
1203 | ||
1204 | if test -z "$have_uintxx_t" ; then | |
1205 | AC_MSG_CHECKING([for uintXX_t types in stdint.h]) | |
1206 | AC_TRY_COMPILE( | |
1207 | [ #include <stdint.h> ], | |
1208 | [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;], | |
1209 | [ | |
1210 | AC_DEFINE(HAVE_UINTXX_T) | |
1211 | AC_MSG_RESULT(yes) | |
1212 | ], | |
1213 | [ AC_MSG_RESULT(no) ] | |
1214 | ) | |
1215 | fi | |
1216 | ||
1217 | if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \ | |
1218 | test "x$ac_cv_header_sys_bitypes_h" = "xyes") | |
1219 | then | |
1220 | AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h]) | |
1221 | AC_TRY_COMPILE( | |
1222 | [ | |
1223 | #include <sys/bitypes.h> | |
1224 | ], | |
1225 | [ | |
1226 | int8_t a; int16_t b; int32_t c; | |
1227 | u_int8_t e; u_int16_t f; u_int32_t g; | |
1228 | a = b = c = e = f = g = 1; | |
1229 | ], | |
1230 | [ | |
1231 | AC_DEFINE(HAVE_U_INTXX_T) | |
1232 | AC_DEFINE(HAVE_INTXX_T) | |
1233 | AC_MSG_RESULT(yes) | |
1234 | ], | |
1235 | [AC_MSG_RESULT(no)] | |
1236 | ) | |
1237 | fi | |
1238 | ||
1239 | ||
1240 | AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [ | |
1241 | AC_TRY_COMPILE( | |
1242 | [ | |
1243 | #include <sys/types.h> | |
1244 | ], | |
1245 | [ u_char foo; foo = 125; ], | |
1246 | [ ac_cv_have_u_char="yes" ], | |
1247 | [ ac_cv_have_u_char="no" ] | |
1248 | ) | |
1249 | ]) | |
1250 | if test "x$ac_cv_have_u_char" = "xyes" ; then | |
1251 | AC_DEFINE(HAVE_U_CHAR) | |
1252 | fi | |
1253 | ||
1254 | TYPE_SOCKLEN_T | |
1255 | ||
e9a17296 | 1256 | AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>]) |
1257 | ||
3c0ef626 | 1258 | AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [ |
1259 | AC_TRY_COMPILE( | |
1260 | [ | |
1261 | #include <sys/types.h> | |
1262 | ], | |
1263 | [ size_t foo; foo = 1235; ], | |
1264 | [ ac_cv_have_size_t="yes" ], | |
1265 | [ ac_cv_have_size_t="no" ] | |
1266 | ) | |
1267 | ]) | |
1268 | if test "x$ac_cv_have_size_t" = "xyes" ; then | |
1269 | AC_DEFINE(HAVE_SIZE_T) | |
1270 | fi | |
1271 | ||
1272 | AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [ | |
1273 | AC_TRY_COMPILE( | |
1274 | [ | |
1275 | #include <sys/types.h> | |
1276 | ], | |
1277 | [ ssize_t foo; foo = 1235; ], | |
1278 | [ ac_cv_have_ssize_t="yes" ], | |
1279 | [ ac_cv_have_ssize_t="no" ] | |
1280 | ) | |
1281 | ]) | |
1282 | if test "x$ac_cv_have_ssize_t" = "xyes" ; then | |
1283 | AC_DEFINE(HAVE_SSIZE_T) | |
1284 | fi | |
1285 | ||
1286 | AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [ | |
1287 | AC_TRY_COMPILE( | |
1288 | [ | |
1289 | #include <time.h> | |
1290 | ], | |
1291 | [ clock_t foo; foo = 1235; ], | |
1292 | [ ac_cv_have_clock_t="yes" ], | |
1293 | [ ac_cv_have_clock_t="no" ] | |
1294 | ) | |
1295 | ]) | |
1296 | if test "x$ac_cv_have_clock_t" = "xyes" ; then | |
1297 | AC_DEFINE(HAVE_CLOCK_T) | |
1298 | fi | |
1299 | ||
1300 | AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [ | |
1301 | AC_TRY_COMPILE( | |
1302 | [ | |
1303 | #include <sys/types.h> | |
1304 | #include <sys/socket.h> | |
1305 | ], | |
1306 | [ sa_family_t foo; foo = 1235; ], | |
1307 | [ ac_cv_have_sa_family_t="yes" ], | |
1308 | [ AC_TRY_COMPILE( | |
1309 | [ | |
1310 | #include <sys/types.h> | |
1311 | #include <sys/socket.h> | |
1312 | #include <netinet/in.h> | |
1313 | ], | |
1314 | [ sa_family_t foo; foo = 1235; ], | |
1315 | [ ac_cv_have_sa_family_t="yes" ], | |
1316 | ||
1317 | [ ac_cv_have_sa_family_t="no" ] | |
1318 | )] | |
1319 | ) | |
1320 | ]) | |
1321 | if test "x$ac_cv_have_sa_family_t" = "xyes" ; then | |
1322 | AC_DEFINE(HAVE_SA_FAMILY_T) | |
1323 | fi | |
1324 | ||
1325 | AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [ | |
1326 | AC_TRY_COMPILE( | |
1327 | [ | |
1328 | #include <sys/types.h> | |
1329 | ], | |
1330 | [ pid_t foo; foo = 1235; ], | |
1331 | [ ac_cv_have_pid_t="yes" ], | |
1332 | [ ac_cv_have_pid_t="no" ] | |
1333 | ) | |
1334 | ]) | |
1335 | if test "x$ac_cv_have_pid_t" = "xyes" ; then | |
1336 | AC_DEFINE(HAVE_PID_T) | |
1337 | fi | |
1338 | ||
1339 | AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [ | |
1340 | AC_TRY_COMPILE( | |
1341 | [ | |
1342 | #include <sys/types.h> | |
1343 | ], | |
1344 | [ mode_t foo; foo = 1235; ], | |
1345 | [ ac_cv_have_mode_t="yes" ], | |
1346 | [ ac_cv_have_mode_t="no" ] | |
1347 | ) | |
1348 | ]) | |
1349 | if test "x$ac_cv_have_mode_t" = "xyes" ; then | |
1350 | AC_DEFINE(HAVE_MODE_T) | |
1351 | fi | |
1352 | ||
1353 | ||
1354 | AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [ | |
1355 | AC_TRY_COMPILE( | |
1356 | [ | |
1357 | #include <sys/types.h> | |
1358 | #include <sys/socket.h> | |
1359 | ], | |
1360 | [ struct sockaddr_storage s; ], | |
1361 | [ ac_cv_have_struct_sockaddr_storage="yes" ], | |
1362 | [ ac_cv_have_struct_sockaddr_storage="no" ] | |
1363 | ) | |
1364 | ]) | |
1365 | if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then | |
1366 | AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE) | |
1367 | fi | |
1368 | ||
1369 | AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [ | |
1370 | AC_TRY_COMPILE( | |
1371 | [ | |
1372 | #include <sys/types.h> | |
1373 | #include <netinet/in.h> | |
1374 | ], | |
1375 | [ struct sockaddr_in6 s; s.sin6_family = 0; ], | |
1376 | [ ac_cv_have_struct_sockaddr_in6="yes" ], | |
1377 | [ ac_cv_have_struct_sockaddr_in6="no" ] | |
1378 | ) | |
1379 | ]) | |
1380 | if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then | |
1381 | AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6) | |
1382 | fi | |
1383 | ||
1384 | AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [ | |
1385 | AC_TRY_COMPILE( | |
1386 | [ | |
1387 | #include <sys/types.h> | |
1388 | #include <netinet/in.h> | |
1389 | ], | |
1390 | [ struct in6_addr s; s.s6_addr[0] = 0; ], | |
1391 | [ ac_cv_have_struct_in6_addr="yes" ], | |
1392 | [ ac_cv_have_struct_in6_addr="no" ] | |
1393 | ) | |
1394 | ]) | |
1395 | if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then | |
1396 | AC_DEFINE(HAVE_STRUCT_IN6_ADDR) | |
1397 | fi | |
1398 | ||
1399 | AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [ | |
1400 | AC_TRY_COMPILE( | |
1401 | [ | |
1402 | #include <sys/types.h> | |
1403 | #include <sys/socket.h> | |
1404 | #include <netdb.h> | |
1405 | ], | |
1406 | [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ], | |
1407 | [ ac_cv_have_struct_addrinfo="yes" ], | |
1408 | [ ac_cv_have_struct_addrinfo="no" ] | |
1409 | ) | |
1410 | ]) | |
1411 | if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then | |
1412 | AC_DEFINE(HAVE_STRUCT_ADDRINFO) | |
1413 | fi | |
1414 | ||
1415 | AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [ | |
1416 | AC_TRY_COMPILE( | |
1417 | [ #include <sys/time.h> ], | |
1418 | [ struct timeval tv; tv.tv_sec = 1;], | |
1419 | [ ac_cv_have_struct_timeval="yes" ], | |
1420 | [ ac_cv_have_struct_timeval="no" ] | |
1421 | ) | |
1422 | ]) | |
1423 | if test "x$ac_cv_have_struct_timeval" = "xyes" ; then | |
1424 | AC_DEFINE(HAVE_STRUCT_TIMEVAL) | |
1425 | have_struct_timeval=1 | |
1426 | fi | |
1427 | ||
1428 | # If we don't have int64_t then we can't compile sftp-server. So don't | |
1429 | # even attempt to do it. | |
1430 | if test "x$ac_cv_have_int64_t" = "xno" -a \ | |
1431 | "x$ac_cv_sizeof_long_int" != "x8" -a \ | |
1432 | "x$ac_cv_sizeof_long_long_int" = "x0" ; then | |
1433 | NO_SFTP='#' | |
1434 | else | |
1435 | dnl test snprintf (broken on SCO w/gcc) | |
1436 | AC_TRY_RUN( | |
1437 | [ | |
1438 | #include <stdio.h> | |
1439 | #include <string.h> | |
1440 | #ifdef HAVE_SNPRINTF | |
1441 | main() | |
1442 | { | |
1443 | char buf[50]; | |
1444 | char expected_out[50]; | |
1445 | int mazsize = 50 ; | |
1446 | #if (SIZEOF_LONG_INT == 8) | |
1447 | long int num = 0x7fffffffffffffff; | |
1448 | #else | |
1449 | long long num = 0x7fffffffffffffffll; | |
1450 | #endif | |
1451 | strcpy(expected_out, "9223372036854775807"); | |
1452 | snprintf(buf, mazsize, "%lld", num); | |
1453 | if(strcmp(buf, expected_out) != 0) | |
1454 | exit(1); | |
1455 | exit(0); | |
1456 | } | |
1457 | #else | |
1458 | main() { exit(0); } | |
1459 | #endif | |
1460 | ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ] | |
1461 | ) | |
1462 | fi | |
1463 | AC_SUBST(NO_SFTP) | |
1464 | ||
1465 | dnl Checks for structure members | |
1466 | OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP) | |
1467 | OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX) | |
1468 | OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX) | |
1469 | OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP) | |
1470 | OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP) | |
1471 | OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX) | |
1472 | OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP) | |
1473 | OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP) | |
1474 | OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX) | |
1475 | OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP) | |
1476 | OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX) | |
1477 | OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP) | |
1478 | OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX) | |
1479 | OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP) | |
1480 | OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP) | |
1481 | OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX) | |
1482 | OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX) | |
1483 | ||
1484 | AC_CHECK_MEMBERS([struct stat.st_blksize]) | |
1485 | ||
1486 | AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage], | |
1487 | ac_cv_have_ss_family_in_struct_ss, [ | |
1488 | AC_TRY_COMPILE( | |
1489 | [ | |
1490 | #include <sys/types.h> | |
1491 | #include <sys/socket.h> | |
1492 | ], | |
1493 | [ struct sockaddr_storage s; s.ss_family = 1; ], | |
1494 | [ ac_cv_have_ss_family_in_struct_ss="yes" ], | |
1495 | [ ac_cv_have_ss_family_in_struct_ss="no" ], | |
1496 | ) | |
1497 | ]) | |
1498 | if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then | |
1499 | AC_DEFINE(HAVE_SS_FAMILY_IN_SS) | |
1500 | fi | |
1501 | ||
1502 | AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage], | |
1503 | ac_cv_have___ss_family_in_struct_ss, [ | |
1504 | AC_TRY_COMPILE( | |
1505 | [ | |
1506 | #include <sys/types.h> | |
1507 | #include <sys/socket.h> | |
1508 | ], | |
1509 | [ struct sockaddr_storage s; s.__ss_family = 1; ], | |
1510 | [ ac_cv_have___ss_family_in_struct_ss="yes" ], | |
1511 | [ ac_cv_have___ss_family_in_struct_ss="no" ] | |
1512 | ) | |
1513 | ]) | |
1514 | if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then | |
1515 | AC_DEFINE(HAVE___SS_FAMILY_IN_SS) | |
1516 | fi | |
1517 | ||
1518 | AC_CACHE_CHECK([for pw_class field in struct passwd], | |
1519 | ac_cv_have_pw_class_in_struct_passwd, [ | |
1520 | AC_TRY_COMPILE( | |
1521 | [ | |
1522 | #include <pwd.h> | |
1523 | ], | |
1524 | [ struct passwd p; p.pw_class = 0; ], | |
1525 | [ ac_cv_have_pw_class_in_struct_passwd="yes" ], | |
1526 | [ ac_cv_have_pw_class_in_struct_passwd="no" ] | |
1527 | ) | |
1528 | ]) | |
1529 | if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then | |
1530 | AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD) | |
1531 | fi | |
1532 | ||
1533 | AC_CACHE_CHECK([for pw_expire field in struct passwd], | |
1534 | ac_cv_have_pw_expire_in_struct_passwd, [ | |
1535 | AC_TRY_COMPILE( | |
1536 | [ | |
1537 | #include <pwd.h> | |
1538 | ], | |
1539 | [ struct passwd p; p.pw_expire = 0; ], | |
1540 | [ ac_cv_have_pw_expire_in_struct_passwd="yes" ], | |
1541 | [ ac_cv_have_pw_expire_in_struct_passwd="no" ] | |
1542 | ) | |
1543 | ]) | |
1544 | if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then | |
1545 | AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD) | |
1546 | fi | |
1547 | ||
1548 | AC_CACHE_CHECK([for pw_change field in struct passwd], | |
1549 | ac_cv_have_pw_change_in_struct_passwd, [ | |
1550 | AC_TRY_COMPILE( | |
1551 | [ | |
1552 | #include <pwd.h> | |
1553 | ], | |
1554 | [ struct passwd p; p.pw_change = 0; ], | |
1555 | [ ac_cv_have_pw_change_in_struct_passwd="yes" ], | |
1556 | [ ac_cv_have_pw_change_in_struct_passwd="no" ] | |
1557 | ) | |
1558 | ]) | |
1559 | if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then | |
1560 | AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD) | |
1561 | fi | |
1562 | ||
1563 | AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [ | |
1564 | AC_TRY_LINK([], | |
1565 | [ extern char *__progname; printf("%s", __progname); ], | |
1566 | [ ac_cv_libc_defines___progname="yes" ], | |
1567 | [ ac_cv_libc_defines___progname="no" ] | |
1568 | ) | |
1569 | ]) | |
1570 | if test "x$ac_cv_libc_defines___progname" = "xyes" ; then | |
1571 | AC_DEFINE(HAVE___PROGNAME) | |
1572 | fi | |
1573 | ||
1574 | AC_CACHE_CHECK([whether getopt has optreset support], | |
1575 | ac_cv_have_getopt_optreset, [ | |
1576 | AC_TRY_LINK( | |
1577 | [ | |
1578 | #include <getopt.h> | |
1579 | ], | |
1580 | [ extern int optreset; optreset = 0; ], | |
1581 | [ ac_cv_have_getopt_optreset="yes" ], | |
1582 | [ ac_cv_have_getopt_optreset="no" ] | |
1583 | ) | |
1584 | ]) | |
1585 | if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then | |
1586 | AC_DEFINE(HAVE_GETOPT_OPTRESET) | |
1587 | fi | |
1588 | ||
1589 | AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [ | |
1590 | AC_TRY_LINK([], | |
1591 | [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);], | |
1592 | [ ac_cv_libc_defines_sys_errlist="yes" ], | |
1593 | [ ac_cv_libc_defines_sys_errlist="no" ] | |
1594 | ) | |
1595 | ]) | |
1596 | if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then | |
1597 | AC_DEFINE(HAVE_SYS_ERRLIST) | |
1598 | fi | |
1599 | ||
1600 | ||
1601 | AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [ | |
1602 | AC_TRY_LINK([], | |
1603 | [ extern int sys_nerr; printf("%i", sys_nerr);], | |
1604 | [ ac_cv_libc_defines_sys_nerr="yes" ], | |
1605 | [ ac_cv_libc_defines_sys_nerr="no" ] | |
1606 | ) | |
1607 | ]) | |
1608 | if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then | |
1609 | AC_DEFINE(HAVE_SYS_NERR) | |
1610 | fi | |
1611 | ||
1612 | ||
1613 | # Check whether user wants Kerberos support | |
1614 | SCARD_MSG="no" | |
1615 | AC_ARG_WITH(smartcard, | |
1616 | [ --with-smartcard Enable smartcard support], | |
1617 | [ | |
1618 | if test "x$withval" != "xno" ; then | |
1619 | if test "x$withval" != "xyes" ; then | |
1620 | CPPFLAGS="$CPPFLAGS -I${withval}" | |
1621 | LDFLAGS="$LDFLAGS -L${withval}" | |
1622 | if test ! -z "$need_dash_r" ; then | |
1623 | LDFLAGS="$LDFLAGS -R${withval}" | |
1624 | fi | |
1625 | if test ! -z "$blibpath" ; then | |
1626 | blibpath="$blibpath:${withval}" | |
1627 | fi | |
1628 | fi | |
1629 | AC_CHECK_HEADERS(sectok.h) | |
1630 | if test "$ac_cv_header_sectok_h" != yes; then | |
1631 | AC_MSG_ERROR(Can't find sectok.h) | |
1632 | fi | |
1633 | AC_CHECK_LIB(sectok, sectok_open) | |
1634 | if test "$ac_cv_lib_sectok_sectok_open" != yes; then | |
1635 | AC_MSG_ERROR(Can't find libsectok) | |
1636 | fi | |
1637 | AC_DEFINE(SMARTCARD) | |
1638 | SCARD_MSG="yes" | |
1639 | fi | |
1640 | ] | |
1641 | ) | |
1642 | ||
1643 | # Check whether user wants Kerberos support | |
1644 | KRB4_MSG="no" | |
1645 | AC_ARG_WITH(kerberos4, | |
1646 | [ --with-kerberos4=PATH Enable Kerberos 4 support], | |
1647 | [ | |
1648 | if test "x$withval" != "xno" ; then | |
1649 | if test "x$withval" != "xyes" ; then | |
1650 | CPPFLAGS="$CPPFLAGS -I${withval}/include" | |
1651 | LDFLAGS="$LDFLAGS -L${withval}/lib" | |
1652 | if test ! -z "$need_dash_r" ; then | |
1653 | LDFLAGS="$LDFLAGS -R${withval}/lib" | |
1654 | fi | |
1655 | if test ! -z "$blibpath" ; then | |
1656 | blibpath="$blibpath:${withval}/lib" | |
1657 | fi | |
1658 | else | |
1659 | if test -d /usr/include/kerberosIV ; then | |
1660 | CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV" | |
1661 | fi | |
1662 | fi | |
1663 | ||
1664 | AC_CHECK_HEADERS(krb.h) | |
1665 | if test "$ac_cv_header_krb_h" != yes; then | |
1666 | AC_MSG_WARN([Cannot find krb.h, build may fail]) | |
1667 | fi | |
1668 | AC_CHECK_LIB(krb, main) | |
1669 | if test "$ac_cv_lib_krb_main" != yes; then | |
1670 | AC_CHECK_LIB(krb4, main) | |
1671 | if test "$ac_cv_lib_krb4_main" != yes; then | |
1672 | AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail]) | |
1673 | else | |
1674 | KLIBS="-lkrb4" | |
1675 | fi | |
1676 | else | |
1677 | KLIBS="-lkrb" | |
1678 | fi | |
1679 | AC_CHECK_LIB(des, des_cbc_encrypt) | |
1680 | if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then | |
1681 | AC_CHECK_LIB(des425, des_cbc_encrypt) | |
1682 | if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then | |
1683 | AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail]) | |
1684 | else | |
1685 | KLIBS="-ldes425" | |
1686 | fi | |
1687 | else | |
1688 | KLIBS="-ldes" | |
1689 | fi | |
1690 | AC_CHECK_LIB(resolv, dn_expand, , ) | |
1691 | KRB4=yes | |
1692 | KRB4_MSG="yes" | |
1693 | AC_DEFINE(KRB4) | |
1694 | fi | |
1695 | ] | |
1696 | ) | |
1697 | ||
1698 | # Check whether user wants AFS support | |
1699 | AFS_MSG="no" | |
1700 | AC_ARG_WITH(afs, | |
1701 | [ --with-afs=PATH Enable AFS support], | |
1702 | [ | |
1703 | if test "x$withval" != "xno" ; then | |
1704 | ||
1705 | if test "x$withval" != "xyes" ; then | |
1706 | CPPFLAGS="$CPPFLAGS -I${withval}/include" | |
1707 | LDFLAGS="$LDFLAGS -L${withval}/lib" | |
1708 | fi | |
1709 | ||
1710 | if test -z "$KRB4" ; then | |
1711 | AC_MSG_WARN([AFS requires Kerberos IV support, build may fail]) | |
1712 | fi | |
1713 | ||
1714 | LIBS="-lkafs $LIBS" | |
1715 | if test ! -z "$AFS_LIBS" ; then | |
1716 | LIBS="$LIBS $AFS_LIBS" | |
1717 | fi | |
1718 | AC_DEFINE(AFS) | |
1719 | AFS_MSG="yes" | |
1720 | fi | |
1721 | ] | |
1722 | ) | |
1723 | LIBS="$LIBS $KLIBS" | |
1724 | ||
1725 | # Looking for programs, paths and files | |
1726 | AC_ARG_WITH(rsh, | |
1727 | [ --with-rsh=PATH Specify path to remote shell program ], | |
1728 | [ | |
1729 | if test "x$withval" != "$no" ; then | |
1730 | rsh_path=$withval | |
1731 | fi | |
1732 | ], | |
1733 | [ | |
1734 | AC_PATH_PROG(rsh_path, rsh) | |
1735 | ] | |
1736 | ) | |
1737 | ||
1738 | AC_ARG_WITH(xauth, | |
1739 | [ --with-xauth=PATH Specify path to xauth program ], | |
1740 | [ | |
1741 | if test "x$withval" != "xno" ; then | |
1742 | xauth_path=$withval | |
1743 | fi | |
1744 | ], | |
1745 | [ | |
1746 | AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin) | |
1747 | if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then | |
1748 | xauth_path="/usr/openwin/bin/xauth" | |
1749 | fi | |
1750 | ] | |
1751 | ) | |
1752 | ||
1753 | if test -z "$xauth_path" ; then | |
1754 | XAUTH_PATH="undefined" | |
1755 | AC_SUBST(XAUTH_PATH) | |
1756 | else | |
1757 | AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path") | |
1758 | XAUTH_PATH=$xauth_path | |
1759 | AC_SUBST(XAUTH_PATH) | |
1760 | fi | |
1761 | if test ! -z "$rsh_path" ; then | |
1762 | AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path") | |
1763 | fi | |
1764 | ||
1765 | # Check for mail directory (last resort if we cannot get it from headers) | |
1766 | if test ! -z "$MAIL" ; then | |
1767 | maildir=`dirname $MAIL` | |
1768 | AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir") | |
1769 | fi | |
1770 | ||
1771 | if test -z "$no_dev_ptmx" ; then | |
1772 | AC_CHECK_FILE("/dev/ptmx", | |
1773 | [ | |
1774 | AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX) | |
1775 | have_dev_ptmx=1 | |
1776 | ] | |
1777 | ) | |
1778 | fi | |
1779 | AC_CHECK_FILE("/dev/ptc", | |
1780 | [ | |
1781 | AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC) | |
1782 | have_dev_ptc=1 | |
1783 | ] | |
1784 | ) | |
1785 | ||
1786 | # Options from here on. Some of these are preset by platform above | |
3c0ef626 | 1787 | AC_ARG_WITH(mantype, |
1788 | [ --with-mantype=man|cat|doc Set man page type], | |
1789 | [ | |
1790 | case "$withval" in | |
1791 | man|cat|doc) | |
1792 | MANTYPE=$withval | |
1793 | ;; | |
1794 | *) | |
1795 | AC_MSG_ERROR(invalid man type: $withval) | |
1796 | ;; | |
1797 | esac | |
1798 | ] | |
1799 | ) | |
1800 | if test -z "$MANTYPE"; then | |
1801 | AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb) | |
1802 | if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then | |
1803 | MANTYPE=doc | |
1804 | elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then | |
1805 | MANTYPE=man | |
1806 | else | |
1807 | MANTYPE=cat | |
1808 | fi | |
1809 | fi | |
1810 | AC_SUBST(MANTYPE) | |
1811 | if test "$MANTYPE" = "doc"; then | |
1812 | mansubdir=man; | |
1813 | else | |
1814 | mansubdir=$MANTYPE; | |
1815 | fi | |
1816 | AC_SUBST(mansubdir) | |
1817 | ||
1818 | # Check whether to enable MD5 passwords | |
1819 | MD5_MSG="no" | |
1820 | AC_ARG_WITH(md5-passwords, | |
1821 | [ --with-md5-passwords Enable use of MD5 passwords], | |
1822 | [ | |
1823 | if test "x$withval" != "xno" ; then | |
1824 | AC_DEFINE(HAVE_MD5_PASSWORDS) | |
1825 | MD5_MSG="yes" | |
1826 | fi | |
1827 | ] | |
1828 | ) | |
1829 | ||
1830 | # Whether to disable shadow password support | |
1831 | AC_ARG_WITH(shadow, | |
1832 | [ --without-shadow Disable shadow password support], | |
1833 | [ | |
1834 | if test "x$withval" = "xno" ; then | |
1835 | AC_DEFINE(DISABLE_SHADOW) | |
1836 | disable_shadow=yes | |
1837 | fi | |
1838 | ] | |
1839 | ) | |
1840 | ||
1841 | if test -z "$disable_shadow" ; then | |
1842 | AC_MSG_CHECKING([if the systems has expire shadow information]) | |
1843 | AC_TRY_COMPILE( | |
1844 | [ | |
1845 | #include <sys/types.h> | |
1846 | #include <shadow.h> | |
1847 | struct spwd sp; | |
1848 | ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ], | |
1849 | [ sp_expire_available=yes ], [] | |
1850 | ) | |
1851 | ||
1852 | if test "x$sp_expire_available" = "xyes" ; then | |
1853 | AC_MSG_RESULT(yes) | |
1854 | AC_DEFINE(HAS_SHADOW_EXPIRE) | |
1855 | else | |
1856 | AC_MSG_RESULT(no) | |
1857 | fi | |
1858 | fi | |
1859 | ||
1860 | # Use ip address instead of hostname in $DISPLAY | |
1861 | if test ! -z "$IPADDR_IN_DISPLAY" ; then | |
1862 | DISPLAY_HACK_MSG="yes" | |
1863 | AC_DEFINE(IPADDR_IN_DISPLAY) | |
1864 | else | |
1865 | DISPLAY_HACK_MSG="no" | |
1866 | AC_ARG_WITH(ipaddr-display, | |
1867 | [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY], | |
1868 | [ | |
1869 | if test "x$withval" != "xno" ; then | |
1870 | AC_DEFINE(IPADDR_IN_DISPLAY) | |
1871 | DISPLAY_HACK_MSG="yes" | |
1872 | fi | |
1873 | ] | |
1874 | ) | |
1875 | fi | |
1876 | ||
1877 | # Whether to mess with the default path | |
1878 | SERVER_PATH_MSG="(default)" | |
1879 | AC_ARG_WITH(default-path, | |
1880 | [ --with-default-path=PATH Specify default \$PATH environment for server], | |
1881 | [ | |
1882 | if test "x$withval" != "xno" ; then | |
1883 | user_path="$withval" | |
1884 | SERVER_PATH_MSG="$withval" | |
1885 | fi | |
1886 | ], | |
1887 | [ | |
1888 | AC_TRY_RUN( | |
1889 | [ | |
1890 | /* find out what STDPATH is */ | |
1891 | #include <stdio.h> | |
1892 | #ifdef HAVE_PATHS_H | |
1893 | # include <paths.h> | |
1894 | #endif | |
1895 | #ifndef _PATH_STDPATH | |
1896 | # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" | |
1897 | #endif | |
1898 | #include <sys/types.h> | |
1899 | #include <sys/stat.h> | |
1900 | #include <fcntl.h> | |
1901 | #define DATA "conftest.stdpath" | |
1902 | ||
1903 | main() | |
1904 | { | |
1905 | FILE *fd; | |
1906 | int rc; | |
1907 | ||
1908 | fd = fopen(DATA,"w"); | |
1909 | if(fd == NULL) | |
1910 | exit(1); | |
1911 | ||
1912 | if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0) | |
1913 | exit(1); | |
1914 | ||
1915 | exit(0); | |
1916 | } | |
1917 | ], [ user_path=`cat conftest.stdpath` ], | |
1918 | [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ], | |
1919 | [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ] | |
1920 | ) | |
1921 | # make sure $bindir is in USER_PATH so scp will work | |
1922 | t_bindir=`eval echo ${bindir}` | |
1923 | case $t_bindir in | |
1924 | NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;; | |
1925 | esac | |
1926 | case $t_bindir in | |
1927 | NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;; | |
1928 | esac | |
1929 | echo $user_path | grep ":$t_bindir" > /dev/null 2>&1 | |
1930 | if test $? -ne 0 ; then | |
1931 | echo $user_path | grep "^$t_bindir" > /dev/null 2>&1 | |
1932 | if test $? -ne 0 ; then | |
1933 | user_path=$user_path:$t_bindir | |
1934 | AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work) | |
1935 | fi | |
1936 | fi | |
1937 | ] | |
1938 | ) | |
1939 | AC_DEFINE_UNQUOTED(USER_PATH, "$user_path") | |
1940 | AC_SUBST(user_path) | |
1941 | ||
1942 | # Whether to force IPv4 by default (needed on broken glibc Linux) | |
1943 | IPV4_HACK_MSG="no" | |
1944 | AC_ARG_WITH(ipv4-default, | |
1945 | [ --with-ipv4-default Use IPv4 by connections unless '-6' specified], | |
1946 | [ | |
1947 | if test "x$withval" != "xno" ; then | |
1948 | AC_DEFINE(IPV4_DEFAULT) | |
1949 | IPV4_HACK_MSG="yes" | |
1950 | fi | |
1951 | ] | |
1952 | ) | |
1953 | ||
1954 | AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses]) | |
1955 | IPV4_IN6_HACK_MSG="no" | |
1956 | AC_ARG_WITH(4in6, | |
1957 | [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses], | |
1958 | [ | |
1959 | if test "x$withval" != "xno" ; then | |
1960 | AC_MSG_RESULT(yes) | |
1961 | AC_DEFINE(IPV4_IN_IPV6) | |
1962 | IPV4_IN6_HACK_MSG="yes" | |
1963 | else | |
1964 | AC_MSG_RESULT(no) | |
1965 | fi | |
1966 | ],[ | |
1967 | if test "x$inet6_default_4in6" = "xyes"; then | |
1968 | AC_MSG_RESULT([yes (default)]) | |
1969 | AC_DEFINE(IPV4_IN_IPV6) | |
1970 | IPV4_IN6_HACK_MSG="yes" | |
1971 | else | |
1972 | AC_MSG_RESULT([no (default)]) | |
1973 | fi | |
1974 | ] | |
1975 | ) | |
1976 | ||
1977 | # Whether to enable BSD auth support | |
e9a17296 | 1978 | BSD_AUTH_MSG=no |
3c0ef626 | 1979 | AC_ARG_WITH(bsd-auth, |
1980 | [ --with-bsd-auth Enable BSD auth support], | |
1981 | [ | |
1982 | if test "x$withval" != "xno" ; then | |
1983 | AC_DEFINE(BSD_AUTH) | |
e9a17296 | 1984 | BSD_AUTH_MSG=yes |
3c0ef626 | 1985 | fi |
1986 | ] | |
1987 | ) | |
1988 | ||
1989 | AC_MSG_CHECKING(whether to install ssh as suid root) | |
1990 | AC_ARG_ENABLE(suid-ssh, | |
1991 | [ --enable-suid-ssh Install ssh as suid root (default) | |
1992 | --disable-suid-ssh Install ssh without suid bit], | |
1993 | [ case "$enableval" in | |
1994 | no) | |
1995 | AC_MSG_RESULT(no) | |
1996 | SSHMODE=0711 | |
1997 | ;; | |
1998 | *) AC_MSG_RESULT(yes) | |
1999 | SSHMODE=4711 | |
2000 | ;; | |
2001 | esac ], | |
2002 | AC_MSG_RESULT(yes) | |
2003 | SSHMODE=4711 | |
2004 | ) | |
2005 | AC_SUBST(SSHMODE) | |
2006 | ||
2007 | ||
2008 | # Where to place sshd.pid | |
2009 | piddir=/var/run | |
2010 | AC_ARG_WITH(pid-dir, | |
2011 | [ --with-pid-dir=PATH Specify location of ssh.pid file], | |
2012 | [ | |
2013 | if test "x$withval" != "xno" ; then | |
2014 | piddir=$withval | |
2015 | fi | |
2016 | ] | |
2017 | ) | |
2018 | ||
2019 | # make sure the directory exists | |
2020 | if test ! -d $piddir ; then | |
2021 | piddir=`eval echo ${sysconfdir}` | |
2022 | case $piddir in | |
2023 | NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;; | |
2024 | esac | |
2025 | fi | |
2026 | ||
2027 | AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir") | |
2028 | AC_SUBST(piddir) | |
2029 | ||
2030 | dnl allow user to disable some login recording features | |
2031 | AC_ARG_ENABLE(lastlog, | |
2032 | [ --disable-lastlog disable use of lastlog even if detected [no]], | |
2033 | [ AC_DEFINE(DISABLE_LASTLOG) ] | |
2034 | ) | |
2035 | AC_ARG_ENABLE(utmp, | |
2036 | [ --disable-utmp disable use of utmp even if detected [no]], | |
2037 | [ AC_DEFINE(DISABLE_UTMP) ] | |
2038 | ) | |
2039 | AC_ARG_ENABLE(utmpx, | |
2040 | [ --disable-utmpx disable use of utmpx even if detected [no]], | |
2041 | [ AC_DEFINE(DISABLE_UTMPX) ] | |
2042 | ) | |
2043 | AC_ARG_ENABLE(wtmp, | |
2044 | [ --disable-wtmp disable use of wtmp even if detected [no]], | |
2045 | [ AC_DEFINE(DISABLE_WTMP) ] | |
2046 | ) | |
2047 | AC_ARG_ENABLE(wtmpx, | |
2048 | [ --disable-wtmpx disable use of wtmpx even if detected [no]], | |
2049 | [ AC_DEFINE(DISABLE_WTMPX) ] | |
2050 | ) | |
2051 | AC_ARG_ENABLE(libutil, | |
2052 | [ --disable-libutil disable use of libutil (login() etc.) [no]], | |
2053 | [ AC_DEFINE(DISABLE_LOGIN) ] | |
2054 | ) | |
2055 | AC_ARG_ENABLE(pututline, | |
2056 | [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]], | |
2057 | [ AC_DEFINE(DISABLE_PUTUTLINE) ] | |
2058 | ) | |
2059 | AC_ARG_ENABLE(pututxline, | |
2060 | [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]], | |
2061 | [ AC_DEFINE(DISABLE_PUTUTXLINE) ] | |
2062 | ) | |
2063 | AC_ARG_WITH(lastlog, | |
2064 | [ --with-lastlog=FILE|DIR specify lastlog location [common locations]], | |
2065 | [ | |
2066 | if test "x$withval" = "xno" ; then | |
2067 | AC_DEFINE(DISABLE_LASTLOG) | |
2068 | else | |
2069 | conf_lastlog_location=$withval | |
2070 | fi | |
2071 | ] | |
2072 | ) | |
2073 | ||
2074 | dnl lastlog, [uw]tmpx? detection | |
2075 | dnl NOTE: set the paths in the platform section to avoid the | |
2076 | dnl need for command-line parameters | |
2077 | dnl lastlog and [uw]tmp are subject to a file search if all else fails | |
2078 | ||
2079 | dnl lastlog detection | |
2080 | dnl NOTE: the code itself will detect if lastlog is a directory | |
2081 | AC_MSG_CHECKING([if your system defines LASTLOG_FILE]) | |
2082 | AC_TRY_COMPILE([ | |
2083 | #include <sys/types.h> | |
2084 | #include <utmp.h> | |
2085 | #ifdef HAVE_LASTLOG_H | |
2086 | # include <lastlog.h> | |
2087 | #endif | |
2088 | #ifdef HAVE_PATHS_H | |
2089 | # include <paths.h> | |
2090 | #endif | |
2091 | #ifdef HAVE_LOGIN_H | |
2092 | # include <login.h> | |
2093 | #endif | |
2094 | ], | |
2095 | [ char *lastlog = LASTLOG_FILE; ], | |
2096 | [ AC_MSG_RESULT(yes) ], | |
2097 | [ | |
2098 | AC_MSG_RESULT(no) | |
2099 | AC_MSG_CHECKING([if your system defines _PATH_LASTLOG]) | |
2100 | AC_TRY_COMPILE([ | |
2101 | #include <sys/types.h> | |
2102 | #include <utmp.h> | |
2103 | #ifdef HAVE_LASTLOG_H | |
2104 | # include <lastlog.h> | |
2105 | #endif | |
2106 | #ifdef HAVE_PATHS_H | |
2107 | # include <paths.h> | |
2108 | #endif | |
2109 | ], | |
2110 | [ char *lastlog = _PATH_LASTLOG; ], | |
2111 | [ AC_MSG_RESULT(yes) ], | |
2112 | [ | |
2113 | AC_MSG_RESULT(no) | |
2114 | system_lastlog_path=no | |
2115 | ]) | |
2116 | ] | |
2117 | ) | |
2118 | ||
2119 | if test -z "$conf_lastlog_location"; then | |
2120 | if test x"$system_lastlog_path" = x"no" ; then | |
2121 | for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do | |
2122 | if (test -d "$f" || test -f "$f") ; then | |
2123 | conf_lastlog_location=$f | |
2124 | fi | |
2125 | done | |
2126 | if test -z "$conf_lastlog_location"; then | |
2127 | AC_MSG_WARN([** Cannot find lastlog **]) | |
2128 | dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx | |
2129 | fi | |
2130 | fi | |
2131 | fi | |
2132 | ||
2133 | if test -n "$conf_lastlog_location"; then | |
2134 | AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location") | |
2135 | fi | |
2136 | ||
2137 | dnl utmp detection | |
2138 | AC_MSG_CHECKING([if your system defines UTMP_FILE]) | |
2139 | AC_TRY_COMPILE([ | |
2140 | #include <sys/types.h> | |
2141 | #include <utmp.h> | |
2142 | #ifdef HAVE_PATHS_H | |
2143 | # include <paths.h> | |
2144 | #endif | |
2145 | ], | |
2146 | [ char *utmp = UTMP_FILE; ], | |
2147 | [ AC_MSG_RESULT(yes) ], | |
2148 | [ AC_MSG_RESULT(no) | |
2149 | system_utmp_path=no ] | |
2150 | ) | |
2151 | if test -z "$conf_utmp_location"; then | |
2152 | if test x"$system_utmp_path" = x"no" ; then | |
2153 | for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do | |
2154 | if test -f $f ; then | |
2155 | conf_utmp_location=$f | |
2156 | fi | |
2157 | done | |
2158 | if test -z "$conf_utmp_location"; then | |
2159 | AC_DEFINE(DISABLE_UTMP) | |
2160 | fi | |
2161 | fi | |
2162 | fi | |
2163 | if test -n "$conf_utmp_location"; then | |
2164 | AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location") | |
2165 | fi | |
2166 | ||
2167 | dnl wtmp detection | |
2168 | AC_MSG_CHECKING([if your system defines WTMP_FILE]) | |
2169 | AC_TRY_COMPILE([ | |
2170 | #include <sys/types.h> | |
2171 | #include <utmp.h> | |
2172 | #ifdef HAVE_PATHS_H | |
2173 | # include <paths.h> | |
2174 | #endif | |
2175 | ], | |
2176 | [ char *wtmp = WTMP_FILE; ], | |
2177 | [ AC_MSG_RESULT(yes) ], | |
2178 | [ AC_MSG_RESULT(no) | |
2179 | system_wtmp_path=no ] | |
2180 | ) | |
2181 | if test -z "$conf_wtmp_location"; then | |
2182 | if test x"$system_wtmp_path" = x"no" ; then | |
2183 | for f in /usr/adm/wtmp /var/log/wtmp; do | |
2184 | if test -f $f ; then | |
2185 | conf_wtmp_location=$f | |
2186 | fi | |
2187 | done | |
2188 | if test -z "$conf_wtmp_location"; then | |
2189 | AC_DEFINE(DISABLE_WTMP) | |
2190 | fi | |
2191 | fi | |
2192 | fi | |
2193 | if test -n "$conf_wtmp_location"; then | |
2194 | AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location") | |
2195 | fi | |
2196 | ||
2197 | ||
2198 | dnl utmpx detection - I don't know any system so perverse as to require | |
2199 | dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out | |
2200 | dnl there, though. | |
2201 | AC_MSG_CHECKING([if your system defines UTMPX_FILE]) | |
2202 | AC_TRY_COMPILE([ | |
2203 | #include <sys/types.h> | |
2204 | #include <utmp.h> | |
2205 | #ifdef HAVE_UTMPX_H | |
2206 | #include <utmpx.h> | |
2207 | #endif | |
2208 | #ifdef HAVE_PATHS_H | |
2209 | # include <paths.h> | |
2210 | #endif | |
2211 | ], | |
2212 | [ char *utmpx = UTMPX_FILE; ], | |
2213 | [ AC_MSG_RESULT(yes) ], | |
2214 | [ AC_MSG_RESULT(no) | |
2215 | system_utmpx_path=no ] | |
2216 | ) | |
2217 | if test -z "$conf_utmpx_location"; then | |
2218 | if test x"$system_utmpx_path" = x"no" ; then | |
2219 | AC_DEFINE(DISABLE_UTMPX) | |
2220 | fi | |
2221 | else | |
2222 | AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location") | |
2223 | fi | |
2224 | ||
2225 | dnl wtmpx detection | |
2226 | AC_MSG_CHECKING([if your system defines WTMPX_FILE]) | |
2227 | AC_TRY_COMPILE([ | |
2228 | #include <sys/types.h> | |
2229 | #include <utmp.h> | |
2230 | #ifdef HAVE_UTMPX_H | |
2231 | #include <utmpx.h> | |
2232 | #endif | |
2233 | #ifdef HAVE_PATHS_H | |
2234 | # include <paths.h> | |
2235 | #endif | |
2236 | ], | |
2237 | [ char *wtmpx = WTMPX_FILE; ], | |
2238 | [ AC_MSG_RESULT(yes) ], | |
2239 | [ AC_MSG_RESULT(no) | |
2240 | system_wtmpx_path=no ] | |
2241 | ) | |
2242 | if test -z "$conf_wtmpx_location"; then | |
2243 | if test x"$system_wtmpx_path" = x"no" ; then | |
2244 | AC_DEFINE(DISABLE_WTMPX) | |
2245 | fi | |
2246 | else | |
2247 | AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location") | |
2248 | fi | |
2249 | ||
2250 | ||
3c0ef626 | 2251 | if test ! -z "$blibpath" ; then |
2252 | LDFLAGS="$LDFLAGS -blibpath:$blibpath" | |
2253 | AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile]) | |
2254 | fi | |
2255 | ||
e9a17296 | 2256 | dnl remove pam and dl because they are in $LIBPAM |
2257 | if test "$PAM_MSG" = yes ; then | |
2258 | LIBS=`echo $LIBS | sed 's/-lpam //'` | |
2259 | fi | |
2260 | if test "$ac_cv_lib_pam_pam_set_item" = yes ; then | |
2261 | LIBS=`echo $LIBS | sed 's/-ldl //'` | |
2262 | fi | |
3c0ef626 | 2263 | |
e9a17296 | 2264 | AC_EXEEXT |
3c0ef626 | 2265 | AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds]) |
2266 | AC_OUTPUT | |
2267 | ||
2268 | # Print summary of options | |
2269 | ||
3c0ef626 | 2270 | # Someone please show me a better way :) |
2271 | A=`eval echo ${prefix}` ; A=`eval echo ${A}` | |
2272 | B=`eval echo ${bindir}` ; B=`eval echo ${B}` | |
2273 | C=`eval echo ${sbindir}` ; C=`eval echo ${C}` | |
2274 | D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}` | |
2275 | E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}` | |
2276 | F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}` | |
2277 | G=`eval echo ${piddir}` ; G=`eval echo ${G}` | |
2278 | H=`eval echo ${user_path}` ; H=`eval echo ${H}` | |
2279 | ||
2280 | echo "" | |
2281 | echo "OpenSSH has been configured with the following options:" | |
2282 | echo " User binaries: $B" | |
2283 | echo " System binaries: $C" | |
2284 | echo " Configuration files: $D" | |
2285 | echo " Askpass program: $E" | |
2286 | echo " Manual pages: $F" | |
2287 | echo " PID file: $G" | |
2288 | echo " sshd default user PATH: $H" | |
3c0ef626 | 2289 | echo " Manpage format: $MANTYPE" |
2290 | echo " PAM support: ${PAM_MSG}" | |
2291 | echo " KerberosIV support: $KRB4_MSG" | |
2292 | echo " Smartcard support: $SCARD_MSG" | |
2293 | echo " AFS support: $AFS_MSG" | |
2294 | echo " S/KEY support: $SKEY_MSG" | |
2295 | echo " TCP Wrappers support: $TCPW_MSG" | |
2296 | echo " MD5 password support: $MD5_MSG" | |
2297 | echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG" | |
2298 | echo " Use IPv4 by default hack: $IPV4_HACK_MSG" | |
2299 | echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG" | |
e9a17296 | 2300 | echo " BSD Auth support: $BSD_AUTH_MSG" |
2301 | echo " Random number source: $RAND_MSG" | |
2302 | if test ! -z "$USE_RAND_HELPER" ; then | |
2303 | echo " ssh-rand-helper collects from: $RAND_HELPER_MSG" | |
3c0ef626 | 2304 | fi |
2305 | ||
2306 | echo "" | |
2307 | ||
2308 | echo " Host: ${host}" | |
2309 | echo " Compiler: ${CC}" | |
2310 | echo " Compiler flags: ${CFLAGS}" | |
2311 | echo "Preprocessor flags: ${CPPFLAGS}" | |
2312 | echo " Linker flags: ${LDFLAGS}" | |
e9a17296 | 2313 | echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}" |
3c0ef626 | 2314 | |
2315 | echo "" | |
2316 | ||
2317 | if test "x$PAM_MSG" = "xyes" ; then | |
e9a17296 | 2318 | echo "PAM is enabled. You may need to install a PAM control file " |
2319 | echo "for sshd, otherwise password authentication may fail. " | |
2320 | echo "Example PAM control files can be found in the contrib/ " | |
2321 | echo "subdirectory" | |
3c0ef626 | 2322 | echo "" |
2323 | fi | |
2324 | ||
e9a17296 | 2325 | if test ! -z "$NO_SFTP"; then |
2326 | echo "sftp-server will be disabled. Your compiler does not " | |
2327 | echo "support 64bit integers." | |
3c0ef626 | 2328 | echo "" |
2329 | fi | |
2330 | ||
e9a17296 | 2331 | if test ! -z "$RAND_HELPER_CMDHASH" ; then |
2332 | echo "WARNING: you are using the builtin random number collection " | |
2333 | echo "service. Please read WARNING.RNG and request that your OS " | |
2334 | echo "vendor includes kernel-based random number collection in " | |
2335 | echo "future versions of your OS." | |
3c0ef626 | 2336 | echo "" |
2337 | fi | |
2338 |