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