1 nl source: configure.in
2 dnl Copyright Gerhard Rieger 2001-2008
3 dnl Published under the GNU General Public License V.2, see file COPYING
5 dnl Process this file with autoconf to produce a configure script.
8 AC_CONFIG_HEADER(config.h)
10 if test -f /usr/xpg4/bin/fgrep; then
11 FGREP=/usr/xpg4/bin/fgrep # Solaris
16 # find out which defines gcc passes to cpp, so makedepend does not run into
17 # (harmless) "error architecture not supported"
18 AC_MSG_CHECKING(which defines needed for makedepend)
19 __cpp_defs=`gcc -v -E - </dev/null 2>&1 |$FGREP -e '/cpp ' -e '/cc1 '`
20 SYSDEFS=`aa=; for a in $__cpp_defs
21 do case "$a" in -D*) aa="$aa $a";; esac; done; echo "$aa"`
23 AC_MSG_RESULT($SYSDEFS)
26 # this must come before AC_PROG_CC
27 if test -z "$CFLAGS"; then
28 # if CFLAGS is not set, we preset it to -O
29 # with this setting, we prevent autoconf from defaulting to "-g -O2"
33 dnl Checks for programs.
34 AC_PROG_INSTALL(install)
38 AC_CHECK_PROG(AR, ar, ar, gar)
40 # we need to explicitely call this here; otherwise, with --disable-libwrap we
42 AC_LANG_COMPILER_REQUIRE()
44 if test "$GCC" = yes; then
45 CFLAGS="$CFLAGS -D_GNU_SOURCE"
50 dnl Checks for header files.
53 AC_CHECK_HEADERS(fcntl.h limits.h strings.h sys/param.h sys/ioctl.h sys/time.h syslog.h unistd.h)
54 AC_CHECK_HEADERS(pwd.h grp.h stdint.h sys/types.h sys/poll.h sys/socket.h sys/uio.h sys/stat.h netdb.h sys/un.h)
55 AC_CHECK_HEADERS(pty.h)
56 AC_CHECK_HEADERS(netinet/in.h netinet/in_systm.h netinet/ip.h netinet/tcp.h)
57 AC_CHECK_HEADERS(netinet6/in6.h) # found on OpenBSD, used for IPV6_*
58 AC_CHECK_HEADERS(net/if.h, [], [], [AC_INCLUDES_DEFAULT
60 #include <sys/socket.h>
61 #endif]) # Mac OS X requires including sys/socket.h
62 AC_CHECK_HEADERS(arpa/nameser.h)
66 AC_CHECK_HEADERS(termios.h linux/if_tun.h)
67 AC_CHECK_HEADERS(net/if_dl.h)
68 AC_CHECK_HEADERS(linux/types.h linux/errqueue.h)
69 AC_CHECK_HEADERS(sys/utsname.h sys/select.h sys/file.h)
70 AC_CHECK_HEADERS(util.h libutil.h sys/stropts.h regex.h)
71 AC_CHECK_HEADERS(linux/fs.h linux/ext2_fs.h)
74 dnl Link libresolv if necessary (for Mac OS X)
75 AC_SEARCH_LIBS([res_9_init], [resolv])
78 dnl Check for extra socket library (for Solaris)
79 AC_CHECK_FUNC(hstrerror, , AC_CHECK_LIB(resolv, hstrerror, [LIBS="$LIBS -lresolv"; AC_DEFINE(HAVE_HSTRERROR)]))
80 AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
81 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
84 dnl Check for hstrerror prototype
85 AC_MSG_CHECKING(for hstrerror prototype)
86 AC_CACHE_VAL(sc_cv_have_prototype_hstrerror,
87 [CFLAGS1="$CFLAGS"; CFLAGS="-Werror -O0 $CFLAGS1";
88 AC_TRY_COMPILE([#include <netdb.h>],[hstrerror();],
89 [sc_cv_have_prototype_hstrerror=no],
90 [sc_cv_have_prototype_hstrerror=yes]);
92 if test $sc_cv_have_prototype_hstrerror = yes; then
93 AC_DEFINE(HAVE_PROTOTYPE_HSTRERROR)
95 AC_MSG_RESULT($sc_cv_have_prototype_hstrerror)
98 AC_MSG_CHECKING(whether to include help)
99 AC_ARG_ENABLE(help, [ --disable-help disable help],
100 [case "$enableval" in
101 no) AC_MSG_RESULT(no);;
102 *) AC_DEFINE(WITH_HELP) AC_MSG_RESULT(yes);;
104 [AC_DEFINE(WITH_HELP) AC_MSG_RESULT(yes)])
106 AC_MSG_CHECKING(whether to include STDIO support)
107 AC_ARG_ENABLE(stdio, [ --disable-stdio disable STDIO support],
108 [case "$enableval" in
109 no) AC_MSG_RESULT(no);;
110 *) AC_DEFINE(WITH_STDIO) AC_MSG_RESULT(yes);;
112 [AC_DEFINE(WITH_STDIO) AC_MSG_RESULT(yes)])
114 AC_MSG_CHECKING(whether to include FD-number support)
115 AC_ARG_ENABLE(fdnum, [ --disable-fdnum disable FD-number support],
116 [case "$enableval" in
117 no) AC_MSG_RESULT(no);;
118 *) AC_DEFINE(WITH_FDNUM) AC_MSG_RESULT(yes);;
120 [AC_DEFINE(WITH_FDNUM) AC_MSG_RESULT(yes)])
122 AC_MSG_CHECKING(whether to include direct file support)
123 AC_ARG_ENABLE(file, [ --disable-file disable direct file support],
124 [case "$enableval" in
125 no) AC_MSG_RESULT(no);;
126 *) AC_DEFINE(WITH_FILE) AC_MSG_RESULT(yes);;
128 [AC_DEFINE(WITH_FILE) AC_MSG_RESULT(yes)])
130 AC_MSG_CHECKING(whether to include direct create support)
131 AC_ARG_ENABLE(creat, [ --disable-creat disable direct create support],
132 [case "$enableval" in
133 no) AC_MSG_RESULT(no);;
134 *) AC_DEFINE(WITH_CREAT) AC_MSG_RESULT(yes);;
136 [AC_DEFINE(WITH_CREAT) AC_MSG_RESULT(yes)])
138 AC_MSG_CHECKING(whether to include gopen support)
139 AC_ARG_ENABLE(gopen, [ --disable-gopen disable open for UNIX socket support],
140 [case "$enableval" in
141 no) AC_MSG_RESULT(no);;
142 *) AC_DEFINE(WITH_GOPEN) AC_MSG_RESULT(yes);;
144 [AC_DEFINE(WITH_GOPEN) AC_MSG_RESULT(yes)])
146 AC_MSG_CHECKING(whether to include explicit pipe support)
147 AC_ARG_ENABLE(pipe, [ --disable-pipe disable pipe support],
148 [case "$enableval" in
149 no) AC_MSG_RESULT(no);;
150 *) AC_DEFINE(WITH_PIPE) AC_MSG_RESULT(yes);;
152 [AC_DEFINE(WITH_PIPE) AC_MSG_RESULT(yes)])
154 AC_MSG_CHECKING(whether to include explicit termios support)
155 AC_ARG_ENABLE(termios, [ --disable-termios disable termios support],
156 [case "$enableval" in
157 no) AC_MSG_RESULT(no);;
158 *) AC_DEFINE(WITH_TERMIOS) AC_MSG_RESULT(yes);;
160 [AC_DEFINE(WITH_TERMIOS) AC_MSG_RESULT(yes)])
162 AC_MSG_CHECKING(whether to include UNIX socket support)
163 AC_ARG_ENABLE(unix, [ --disable-unix disable UNIX domain socket support],
164 [case "$enableval" in
165 no) AC_MSG_RESULT(no);;
166 *) AC_DEFINE(WITH_UNIX) AC_MSG_RESULT(yes);;
168 [AC_DEFINE(WITH_UNIX) AC_MSG_RESULT(yes)])
170 AC_MSG_CHECKING(whether to include abstract UNIX socket support)
171 AC_ARG_ENABLE(abstract_unixsocket, [ --disable-abstract-unixsocket disable abstract UNIX domain socket support],
172 [case "$enableval" in
173 no) AC_MSG_RESULT(no);;
174 *) AC_DEFINE(WITH_ABSTRACT_UNIXSOCKET) AC_MSG_RESULT(yes);;
178 AC_DEFINE(WITH_ABSTRACT_UNIXSOCKET) AC_MSG_RESULT(yes);;
183 AC_MSG_CHECKING(whether to include IPv4 support)
184 AC_ARG_ENABLE(ip4, [ --disable-ip4 disable IPv4 support],
185 [case "$enableval" in
186 no) AC_MSG_RESULT(no);;
187 *) AC_DEFINE(WITH_IP4) AC_MSG_RESULT(yes);;
189 [AC_DEFINE(WITH_IP4) AC_MSG_RESULT(yes)])
191 AC_MSG_CHECKING(whether to include IPv6 support)
192 AC_ARG_ENABLE(ip6, [ --disable-ip6 disable IPv6 support],
193 [case "$enableval" in
194 no) AC_MSG_RESULT(no); WITH_IP6= ;;
195 *) AC_MSG_RESULT(yes); WITH_IP6=1 ;;
197 [ AC_MSG_RESULT(yes); WITH_IP6=1 ])
198 if test "$WITH_IP6"; then
199 AC_CHECK_HEADERS([netinet/ip6.h],
200 [AC_DEFINE(HAVE_NETINET_IP6_H) AC_DEFINE(WITH_IP6)],
201 [AC_MSG_WARN([include file netinet/ip6.h not found, disabling IP6])],
203 #ifdef HAVE_NETINET_IN_H
204 # include <netinet/in.h>
208 AC_MSG_CHECKING(whether to include raw IP support)
209 AC_ARG_ENABLE(rawip, [ --disable-rawip disable raw IP support],
210 [case "$enableval" in
211 no) AC_MSG_RESULT(no);;
212 *) AC_DEFINE(WITH_RAWIP) AC_MSG_RESULT(yes);;
214 [AC_DEFINE(WITH_RAWIP) AC_MSG_RESULT(yes)])
216 AC_MSG_CHECKING(whether to include generic socket support)
217 AC_ARG_ENABLE(rawsocket, [ --disable-genericsocket disable generic socket support],
218 [case "$enableval" in
219 no) AC_MSG_RESULT(no);;
220 *) AC_DEFINE(WITH_GENERICSOCKET) AC_MSG_RESULT(yes);;
222 [AC_DEFINE(WITH_GENERICSOCKET) AC_MSG_RESULT(yes)])
223 AC_MSG_CHECKING(whether to include raw network interface support)
224 AC_ARG_ENABLE(interface, [ --disable-interface disable network interface support],
225 [case "$enableval" in
226 no) AC_MSG_RESULT(no); WITH_INTERFACE= ;;
227 *) AC_MSG_RESULT(yes); WITH_INTERFACE=1 ;;
229 [AC_MSG_RESULT(yes); WITH_INTERFACE=1 ])
230 if test "$WITH_INTERFACE"; then
231 AC_CHECK_HEADER(netpacket/packet.h,
232 AC_DEFINE(HAVE_NETPACKET_PACKET_H),
234 AC_MSG_WARN([include file netpacket/packet.h not found, disabling interface])])
236 if test "$WITH_INTERFACE"; then
237 AC_CHECK_HEADER(netinet/if_ether.h,
238 AC_DEFINE(HAVE_NETINET_IF_ETHER_H),
240 AC_MSG_WARN([include file netinet/if_ether.h not found, disabling interface])])
242 if test "$WITH_INTERFACE"; then
243 AC_DEFINE(WITH_INTERFACE)
246 AC_MSG_CHECKING(whether to include TCP support)
247 AC_ARG_ENABLE(tcp, [ --disable-tcp disable TCP support],
248 [case "$enableval" in
249 no) AC_MSG_RESULT(no);;
250 *) AC_DEFINE(WITH_TCP) AC_MSG_RESULT(yes);;
252 [AC_DEFINE(WITH_TCP) AC_MSG_RESULT(yes)])
254 AC_MSG_CHECKING(whether to include UDP support)
255 AC_ARG_ENABLE(udp, [ --disable-udp disable UDP support],
256 [case "$enableval" in
257 no) AC_MSG_RESULT(no);;
258 *) AC_DEFINE(WITH_UDP) AC_MSG_RESULT(yes);;
260 [AC_DEFINE(WITH_UDP) AC_MSG_RESULT(yes)])
262 AC_MSG_CHECKING(whether to include SCTP support)
263 AC_ARG_ENABLE(sctp, [ --disable-sctp disable SCTP support],
264 [case "$enableval" in
265 no) AC_MSG_RESULT(no); WITH_SCTP= ;;
266 *) AC_MSG_RESULT(yes); WITH_SCTP=1 ;;
268 [AC_MSG_RESULT(yes); WITH_SCTP=1 ])
270 if test -n "$WITH_SCTP"; then
271 AC_MSG_CHECKING(for IPPROTO_SCTP)
272 AC_CACHE_VAL(sc_cv_define_ipproto_sctp,
273 [AC_TRY_COMPILE([#include <sys/types.h>
274 #include <netinet/in.h>],
276 [sc_cv_define_ipproto_sctp=yes],
277 [sc_cv_define_ipproto_sctp=no])])
278 AC_MSG_RESULT($sc_cv_define_ipproto_sctp)
279 if test $sc_cv_define_ipproto_sctp = yes; then
282 AC_MSG_WARN([IPPROTO_SCTP undefined, disabling SCTP support])
286 AC_MSG_CHECKING(whether to include listen support)
287 AC_ARG_ENABLE(listen, [ --disable-listen disable listen support],
288 [case "$enableval" in
289 no) AC_MSG_RESULT(no);;
290 *) AC_DEFINE(WITH_LISTEN) AC_MSG_RESULT(yes);;
292 [AC_DEFINE(WITH_LISTEN) AC_MSG_RESULT(yes)])
294 AC_MSG_CHECKING(whether to include socks4 support)
295 AC_ARG_ENABLE(socks4, [ --disable-socks4 disable socks4 support],
296 [case "$enableval" in
297 no) AC_MSG_RESULT(no);;
298 *) AC_DEFINE(WITH_SOCKS4) AC_MSG_RESULT(yes);;
300 [AC_DEFINE(WITH_SOCKS4) AC_MSG_RESULT(yes)])
302 AC_MSG_CHECKING(whether to include socks4a support)
303 AC_ARG_ENABLE(socks4a, [ --disable-socks4a disable socks4a support],
304 [case "$enableval" in
305 no) AC_MSG_RESULT(no);;
306 *) AC_DEFINE(WITH_SOCKS4A) AC_MSG_RESULT(yes);;
308 [AC_DEFINE(WITH_SOCKS4A) AC_MSG_RESULT(yes)])
310 AC_MSG_CHECKING(whether to include proxy connect support)
311 AC_ARG_ENABLE(proxy, [ --disable-proxy disable proxy connect support],
312 [case "$enableval" in
313 no) AC_MSG_RESULT(no);;
314 *) AC_DEFINE(WITH_PROXY) AC_MSG_RESULT(yes);;
316 [AC_DEFINE(WITH_PROXY) AC_MSG_RESULT(yes)])
318 AC_MSG_CHECKING(whether to include exec support)
319 AC_ARG_ENABLE(exec, [ --disable-exec disable exec support],
320 [case "$enableval" in
321 no) AC_MSG_RESULT(no);;
322 *) AC_DEFINE(WITH_EXEC) AC_MSG_RESULT(yes);;
324 [AC_DEFINE(WITH_EXEC) AC_MSG_RESULT(yes)])
326 AC_MSG_CHECKING([whether to include system (shell) support])
327 AC_ARG_ENABLE(system, [ --disable-system disable system (shell) support],
328 [case "$enableval" in
329 no) AC_MSG_RESULT(no);;
330 *) AC_DEFINE(WITH_SYSTEM) AC_MSG_RESULT(yes);;
332 [AC_DEFINE(WITH_SYSTEM) AC_MSG_RESULT(yes)])
334 AC_MSG_CHECKING(whether to include pty address support)
335 AC_ARG_ENABLE(pty, [ --disable-pty disable pty support],
336 [case "$enableval" in
337 no) AC_MSG_RESULT(no);;
338 *) AC_DEFINE(WITH_PTY) AC_MSG_RESULT(yes);;
340 [AC_DEFINE(WITH_PTY) AC_MSG_RESULT(yes)])
342 AC_MSG_CHECKING(whether to include ext2 fs attributes support)
343 AC_ARG_ENABLE(ext2, [ --disable-ext2 disable ext2 fs attributes support],
344 [case "$enableval" in
345 no) AC_MSG_RESULT(no);;
346 *) AC_DEFINE(WITH_EXT2) AC_MSG_RESULT(yes);;
348 [AC_DEFINE(WITH_EXT2) AC_MSG_RESULT(yes)])
350 AC_MSG_CHECKING(whether to include readline support)
351 AC_ARG_ENABLE(readline, [ --disable-readline disable readline support],
352 [case "$enableval" in
353 no) AC_MSG_RESULT(no); WITH_READLINE= ;;
354 *) AC_MSG_RESULT(yes); WITH_READLINE=1 ;;
356 [AC_MSG_RESULT(yes); WITH_READLINE=1 ])
358 if test -n "$WITH_READLINE"; then
359 CPPFLAGS_ORIG=$CPPFLAGS
362 sc_usable_readline_found=
364 for D in "" "/usr/local" "/opt/local" "/sw" "/opt/freeware" "/usr/sfw"; do
365 if test -n "$D" ; then
366 CPPFLAGS="$CPPFLAGS -I$D/include"
367 CFLAGS="$CFLAGS -L$D/lib"
368 DLOC="in location $D"
370 DLOC="in default location"
372 AC_MSG_CHECKING(for usable readline $DLOC)
374 # Some systems require -lcurses, some require -lncurses.
375 # Mac OS X 10.4 (and others) ships with libedit masquerading as readline,
376 # but it doesn't work well with socat. It can be recognized by the absence
379 for L in "" "-lcurses" "-lncurses"; do
380 LIBS="$LIBS_ORIG -lreadline $L"
383 #include <readline/readline.h>
384 #include <readline/history.h>],
386 append_history(0, NULL); ],
387 [ sc_usable_readline_found=1
391 if test -n "$sc_usable_readline_found"; then
393 AC_DEFINE(HAVE_READLINE_READLINE_H,1)
394 AC_DEFINE(HAVE_READLINE_HISTORY_H,1)
395 AC_DEFINE(HAVE_LIBREADLINE,1)
396 AC_DEFINE(WITH_READLINE,1)
400 CPPFLAGS=$CPPFLAGS_ORIG
406 if test -z "$sc_usable_readline_found"; then
407 AC_MSG_WARN([no suitable version of readline found; perhaps you need to install a newer version])
411 AC_MSG_CHECKING(whether to include openssl support)
412 AC_ARG_ENABLE(openssl, [ --disable-openssl disable OpenSSL support],
413 [ case "$enableval" in
414 no) AC_MSG_RESULT(no); WITH_OPENSSL= ;;
415 *) AC_MSG_RESULT(yes); WITH_OPENSSL=1 ;;
417 [ AC_MSG_RESULT(yes); WITH_OPENSSL=1 ])
419 if test -n "$WITH_OPENSSL"; then
420 AC_MSG_NOTICE(checking for components of OpenSSL)
421 # first, we need to find the include file <openssl/ssl.h>
422 AC_CACHE_VAL(sc_cv_have_openssl_ssl_h,
423 [AC_TRY_COMPILE([#include <openssl/ssl.h>],[;],
424 [sc_cv_have_openssl_ssl_h=yes; OPENSSL_ROOT=""; ],
425 [sc_cv_have_openssl_ssl_h=no
426 for D in "/sw" "/usr/local" "/opt/freeware" "/usr/sfw" "/usr/local/ssl"; do
429 if test -r "$i"; then
430 #V_INCL="$V_INCL -I$I"
431 CPPFLAGS="$CPPFLAGS -I$I"
432 AC_MSG_NOTICE(found $i)
433 sc_cv_have_openssl_ssl_h=yes; OPENSSL_ROOT="$D"
438 if test "$sc_cv_have_openssl_ssl_h" = "yes"; then
439 AC_DEFINE(HAVE_OPENSSL_SSL_H)
441 AC_MSG_NOTICE(checked for openssl/ssl.h... $sc_cv_have_openssl_ssl_h)
442 fi # end checking for openssl/ssl.h
444 if test -n "$WITH_OPENSSL" -a "$sc_cv_have_openssl_ssl_h" = 'yes'; then
445 # next, we search for the openssl library (libssl.*)
446 # interesting: Linux only requires -lssl, FreeBSD requires -lssl -lcrypto
447 # Note, version OpenSSL 0.9.7j requires -lcrypto even on Linux.
448 AC_MSG_CHECKING(for libssl)
449 AC_CACHE_VAL(sc_cv_have_libssl,
451 if test -n "$OPENSSL_ROOT"; then
452 L="$OPENSSL_ROOT/lib"; LIBS="$LIBS -L$L -lssl"
456 AC_TRY_LINK([#include <openssl/ssl.h>],
457 [SSL_library_init();ERR_error_string()],
458 [sc_cv_have_libssl='yes'],
459 [ LIBS="$LIBS -lcrypto"
460 AC_TRY_LINK([#include <openssl/ssl.h>],
461 [SSL_library_init()],
462 [sc_cv_have_libssl='yes'],
463 [sc_cv_have_libssl='no'])
465 if test "$sc_cv_have_libssl" != 'yes'; then
470 if test "$sc_cv_have_libssl" = 'yes'; then
471 AC_DEFINE(HAVE_LIBSSL)
473 AC_MSG_RESULT($sc_cv_have_libssl)
476 # # a possible location for openssl (on Sourceforge/Solaris)
477 # AC_CHECK_FILE(/usr/local/ssl/lib, LIBS="$LIBS -L/usr/local/ssl/lib/")
478 # # sometimes on Solaris:
479 # AC_CHECK_FILE(/pkgs/lib, LIBS="$LIBS -L/pkgs/lib/")
480 # # for AIX 5.1 with Linux toolbox:
481 # AC_CHECK_FILE(/opt/freeware/lib, LIBS="$LIBS -L/opt/freeware/lib/")
483 # AC_CHECK_LIB(crypto, main)
484 # AC_CHECK_LIB(ssl, main)
486 # # MacOSX has openssl includes in another directory
487 # if test -d /sw/include/; then
488 # V_INCL="$V_INCL -I/sw/include"
489 # # and Solaris at sourceforge here:
490 # elif test -d /usr/local/ssl/include/; then
491 # V_INCL="$V_INCL -I/usr/local/ssl/include"
492 # # and AIX 5.1 with Linux toolbox:
493 # elif test -d /opt/freeware/include; then
494 # V_INCL="$V_INCL -I/opt/freeware/include"
497 if test -n "$WITH_OPENSSL"; then
498 if test "$sc_cv_have_openssl_ssl_h" = "yes" -a "$sc_cv_have_libssl" = "yes"; then
499 AC_DEFINE(WITH_OPENSSL)
501 AC_MSG_WARN([not all components of OpenSSL found, disabling it]);
505 # check for fips support
506 AC_MSG_CHECKING(whether to include openssl fips support)
507 AC_ARG_ENABLE(fips, [ --disable-fips disable OpenSSL FIPS support],
508 [ case "$enableval" in
509 no) AC_MSG_RESULT(no); WITH_FIPS= ;;
510 *) AC_MSG_RESULT(yes); WITH_FIPS=1 ;;
512 [ AC_MSG_RESULT(yes); WITH_FIPS=1 ])
514 if test -n "$WITH_FIPS"; then
515 if test -n "$WITH_OPENSSL"; then
516 if test "$sc_cv_have_openssl_ssl_h" != "yes" -o "$sc_cv_have_libssl" != "yes"; then
517 AC_MSG_WARN([not all components of OpenSSL found, disabling FIPS]);
521 AC_MSG_WARN([must enable OpenSSL to enable FIPS; use --enable-openssl]);
525 if test -n "$WITH_FIPS"; then
526 AC_MSG_NOTICE(checking for components of OpenSSL FIPS)
527 # first, we need to find the include file <openssl/fips.h>
528 AC_CACHE_VAL(sc_cv_have_openssl_fips_h,
529 [AC_TRY_COMPILE([#define OPENSSL_FIPS
530 #include <openssl/fips.h>],[;],
531 [sc_cv_have_openssl_fips_h=yes; ],
532 [sv_cv_have_openssl_fips_h=no
533 if test -n "$OPENSSL_ROOT"; then
534 I="$OPENSSL_ROOT/include"
535 i="$I/openssl/fips.h"
536 if test -r "$i"; then
537 AC_MSG_NOTICE(found $i)
538 sc_cv_have_openssl_fips_h=yes;
544 if test "$sv_cv_have_openssl_fips_h" = "yes"; then
545 AC_DEFINE(HAVE_OPENSSL_FIPS_H)
547 AC_MSG_NOTICE(checked for openssl/fips.h... $sc_cv_have_openssl_ssl_h)
550 if test -n "$WITH_FIPS" -a "$sc_cv_have_openssl_fips_h" = 'yes'; then
551 # check for the libcrypto library with fips support
552 AC_MSG_CHECKING(for libcrypto with FIPS support)
553 AC_CACHE_VAL(sc_cv_have_libcrypto,
555 echo $LIBS | grep -q "\-lcrypto"
556 if test $? -ne 0; then
557 if test -n "$OPENSSL_ROOT"; then
558 L="$OPENSSL_ROOT/lib"; LIBS="$LIBS -L$L -lcrypto"
560 LIBS="$LIBS -lcrypto"
563 AC_TRY_LINK([#define OPENSSL_FIPS
564 #include <openssl/ssl.h>
565 #include <openssl/fips.h>],
566 [int res = FIPS_mode_set(1);],
567 [sc_cv_have_libcrypto='yes'],
568 [sc_cv_have_libcrypto='no']
570 if test "$sc_cv_have_libcrypto" != 'yes'; then
575 if test "$sc_cv_have_libcrypto" = 'yes'; then
576 AC_DEFINE(HAVE_LIBCRYPTO)
578 AC_MSG_RESULT($sc_cv_have_libcrypto)
581 if test -n "$WITH_FIPS"; then
582 if test "$sc_cv_have_openssl_fips_h" = 'yes' -a "$sc_cv_have_libcrypto" = 'yes'; then
584 AC_DEFINE(OPENSSL_FIPS)
586 AC_MSG_WARN([not all components of OpenSSL FIPS found, disabling it]);
590 AC_MSG_CHECKING(whether to include tun/tap address support)
591 AC_ARG_ENABLE(tun, [ --disable-tun disable TUN/TAP support],
592 [case "$enableval" in
593 no) AC_MSG_RESULT(no); WITH_TUN= ;;
594 *) AC_MSG_RESULT(yes); WITH_TUN=1 ;;
596 [AC_MSG_RESULT(yes); WITH_TUN=1 ])
599 if ! test "$ac_cv_header_linux_if_tun_h" = 'yes'; then
600 AC_MSG_WARN(include file linux/if_tun.h not found, disabling TUN)
604 if test -n "$WITH_TUN"; then
608 AC_MSG_CHECKING(whether to include system call tracing)
609 AC_ARG_ENABLE(sycls, [ --disable-sycls disable system call tracing],
610 [case "$enableval" in
611 no) SYCLS=""; SSLCLS=""; AC_MSG_RESULT(no);;
612 *) AC_DEFINE(WITH_SYCLS)
613 SYCLS="sycls.c"; SSLCLS="sslcls.c"; AC_MSG_RESULT(yes);;
615 [AC_DEFINE(WITH_SYCLS)
616 SYCLS="sycls.c"; SSLCLS="sslcls.c"; AC_MSG_RESULT(yes)])
620 AC_MSG_CHECKING(whether to include file descriptor analyzer)
621 AC_ARG_ENABLE(filan, [ --disable-filan disable file descriptor analyzer],
622 [case "$enableval" in
623 no) FILAN=""; AC_MSG_RESULT(no);;
624 *) AC_DEFINE(WITH_FILAN) FILAN="filan.c"; AC_MSG_RESULT(yes);;
626 [AC_DEFINE(WITH_FILAN) FILAN="filan.c"; AC_MSG_RESULT(yes)])
629 AC_MSG_CHECKING(whether to include retry support)
630 AC_ARG_ENABLE(retry, [ --disable-retry disable retry support],
631 [case "$enableval" in
632 no) AC_MSG_RESULT(no);;
633 *) AC_DEFINE(WITH_RETRY) AC_MSG_RESULT(yes);;
635 [AC_DEFINE(WITH_RETRY) AC_MSG_RESULT(yes)])
637 AC_MSG_CHECKING(included message level)
638 AC_ARG_ENABLE(msglevel, [ --enable-msglevel=N set max verbosity to debug,info,notice,warn,error,fatal],
639 [case "$enableval" in
640 debug) AC_DEFINE(WITH_MSGLEVEL,0) AC_MSG_RESULT(debug);;
641 info) AC_DEFINE(WITH_MSGLEVEL,1) AC_MSG_RESULT(info);;
642 notice) AC_DEFINE(WITH_MSGLEVEL,2) AC_MSG_RESULT(notice);;
643 warn) AC_DEFINE(WITH_MSGLEVEL,3) AC_MSG_RESULT(warn);;
644 error) AC_DEFINE(WITH_MSGLEVEL,4) AC_MSG_RESULT(error);;
645 fatal) AC_DEFINE(WITH_MSGLEVEL,5) AC_MSG_RESULT(fatal);;
646 *) AC_DEFINE(WITH_MSGLEVEL,0) AC_MSG_RESULT(debug);;
648 [AC_DEFINE(WITH_MSGLEVEL,0) AC_MSG_RESULT(debug)])
652 dnl Checks for typedefs, structures, and compiler characteristics.
664 dnl Check for extra realtime library (for Solaris)
665 AC_CHECK_FUNC(nanosleep, AC_DEFINE(HAVE_NANOSLEEP), AC_CHECK_LIB(rt, nanosleep, [LIBS="-lrt $LIBS"; AC_DEFINE(HAVE_NANOSLEEP)]))
666 #AC_CHECK_FUNC(nanosleep, , AC_CHECK_LIB(rt, nanosleep))
668 dnl Checks for library functions.
669 AC_PROG_GCC_TRADITIONAL
673 AC_CHECK_FUNCS(putenv select poll socket strdup strerror strstr strtod strtol)
674 AC_CHECK_FUNCS(strtoul uname getpgid getsid getaddrinfo)
675 AC_CHECK_FUNCS(getipnodebyname setgroups inet_aton memrchr)
676 AC_CHECK_FUNCS(if_indextoname)
678 AC_CHECK_FUNCS(grantpt unlockpt ptsname)
681 AC_MSG_CHECKING(for long long)
682 AC_CACHE_VAL(sc_cv_type_longlong,
683 [AC_TRY_COMPILE([],[long long s;],
684 [sc_cv_type_longlong=yes],
685 [sc_cv_type_longlong=no])])
686 if test $sc_cv_type_longlong = yes; then
687 AC_DEFINE(HAVE_TYPE_LONGLONG)
689 AC_MSG_RESULT($sc_cv_type_longlong)
691 # following builtin macro does not check unistd.h and sys/socket.h where
692 # socklen_t might be defined
693 #AC_CHECK_TYPE(socklen_t, int)
695 AC_MSG_CHECKING(for socklen_t)
696 AC_CACHE_VAL(sc_cv_type_socklen,
697 [AC_TRY_COMPILE([#include <sys/types.h>
698 #include <sys/socket.h>
699 #include <unistd.h>],[socklen_t s;],
700 [sc_cv_type_socklen=yes],
701 [sc_cv_type_socklen=no])])
702 if test $sc_cv_type_socklen = yes; then
703 AC_DEFINE(HAVE_TYPE_SOCKLEN)
705 AC_MSG_RESULT($sc_cv_type_socklen)
707 AC_MSG_CHECKING(for struct stat64)
708 AC_CACHE_VAL(sc_cv_type_stat64,
709 [AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 s;],
710 [sc_cv_type_stat64=yes],
711 [sc_cv_type_stat64=no])])
712 if test $sc_cv_type_stat64 = yes; then
713 AC_DEFINE(HAVE_TYPE_STAT64)
715 AC_MSG_RESULT($sc_cv_type_stat64)
717 AC_MSG_CHECKING(for off64_t)
718 AC_CACHE_VAL(sc_cv_type_off64,
719 [AC_TRY_COMPILE([#include <unistd.h>],[off64_t s;],
720 [sc_cv_type_off64=yes],
721 [sc_cv_type_off64=no])])
722 if test $sc_cv_type_off64 = yes; then
723 AC_DEFINE(HAVE_TYPE_OFF64)
725 AC_MSG_RESULT($sc_cv_type_off64)
727 AC_MSG_CHECKING(for sighandler_t)
728 AC_CACHE_VAL(sc_cv_type_sighandler,
729 [AC_TRY_COMPILE([#include <signal.h>],[sighandler_t s;],
730 [sc_cv_type_sighandler=yes],
731 [sc_cv_type_sighandler=no])])
732 if test $sc_cv_type_sighandler = yes; then
733 AC_DEFINE(HAVE_TYPE_SIGHANDLER)
735 AC_MSG_RESULT($sc_cv_type_socklen)
737 AC_MSG_CHECKING(for uint8_t)
738 AC_CACHE_VAL(sc_cv_type_uint8,
739 [AC_TRY_COMPILE([#include <sys/types.h>
743 /* Tru64 has uint8_t etc from netdb.h */
747 #include <unistd.h>],[uint8_t s;],
748 [sc_cv_type_uint8=yes],
749 [sc_cv_type_uint8=no])])
750 if test $sc_cv_type_uint8 = yes; then
751 AC_DEFINE(HAVE_TYPE_UINT8)
753 AC_MSG_RESULT($sc_cv_type_uint8)
755 AC_MSG_CHECKING(for uint16_t)
756 AC_CACHE_VAL(sc_cv_type_uint16,
757 [AC_TRY_COMPILE([#include <sys/types.h>
761 /* Tru64 has uint16_t etc from netdb.h */
765 #include <unistd.h>],[uint16_t s;],
766 [sc_cv_type_uint16=yes],
767 [sc_cv_type_uint16=no])])
768 if test $sc_cv_type_uint16 = yes; then
769 AC_DEFINE(HAVE_TYPE_UINT16)
771 AC_MSG_RESULT($sc_cv_type_uint16)
773 AC_MSG_CHECKING(for uint32_t)
774 AC_CACHE_VAL(sc_cv_type_uint32,
775 [AC_TRY_COMPILE([#include <sys/types.h>
779 /* Tru64 has uint32_t etc from netdb.h */
783 #include <unistd.h>],[uint32_t s;],
784 [sc_cv_type_uint32=yes],
785 [sc_cv_type_uint32=no])])
786 if test $sc_cv_type_uint32 = yes; then
787 AC_DEFINE(HAVE_TYPE_UINT32)
789 AC_MSG_RESULT($sc_cv_type_uint32)
791 AC_MSG_CHECKING(for uint64_t)
792 AC_CACHE_VAL(sc_cv_type_uint64,
793 [AC_TRY_COMPILE([#include <sys/types.h>
797 /* Tru64 has uint32_t etc from netdb.h */
801 #include <unistd.h>],[uint64_t s;],
802 [sc_cv_type_uint64=yes],
803 [sc_cv_type_uint64=no])])
804 if test $sc_cv_type_uint64 = yes; then
805 AC_DEFINE(HAVE_TYPE_UINT64)
807 AC_MSG_RESULT($sc_cv_type_uint64)
809 ### AIX 4.1 needs _XOPEN_EXTENDED_SOURCE for syslog headers,
810 # but then gets problems with 3rd arg of getsockaddr...
811 #AC_MSG_CHECKING(for _XOPEN_EXTENDED_SOURCE requirement)
812 #CFLAGS="-Werror -Wall"
813 #AC_TRY_COMPILE([#include <sys/syslog.h>],
815 #[AC_MSG_RESULT(no)],
816 #[AC_MSG_RESULT(required); AC_DEFINE(_XOPEN_EXTENDED_SOURCE)])
821 AC_MSG_CHECKING(for fdset->fds_bits)
822 AC_TRY_COMPILE([#include <sys/types.h>
823 #if HAVE_SYS_SELECT_H
824 #include <sys/select.h>
826 [fd_set s; s.fds_bits[0]=0;],
827 [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FDS_BITS)],
828 [AC_MSG_RESULT(no);])
830 AC_MSG_CHECKING(for sa_family_t)
831 AC_CACHE_VAL(sc_cv_type_sa_family_t,
832 [AC_TRY_COMPILE([#include <sys/types.h>
833 #include <netinet/in.h>],[sa_family_t s;],
834 [sc_cv_type_sa_family_t=yes],
835 [sc_cv_type_sa_family_t=no])])
836 if test $sc_cv_type_sa_family_t = yes; then
837 AC_DEFINE(HAVE_TYPE_SA_FAMILY_T)
839 AC_MSG_RESULT($sc_cv_type_sa_family_t)
841 AC_MSG_CHECKING(for struct sigaction.sa_sigaction)
842 AC_CACHE_VAL(sc_cv_struct_sigaction_sa_sigaction,
843 [AC_TRY_COMPILE([#include <signal.h>],[struct sigaction s;s.sa_sigaction=0;],
844 [sc_cv_struct_sigaction_sa_sigaction=yes],
845 [sc_cv_struct_sigaction_sa_sigaction=no])])
846 if test $sc_cv_struct_sigaction_sa_sigaction = yes; then
847 AC_DEFINE(HAVE_STRUCT_SIGACTION_SA_SIGACTION)
849 AC_MSG_RESULT($sc_cv_struct_sigaction_sa_sigaction)
851 ### struct termios .c_ispeed
852 AC_MSG_CHECKING(for termios.c_ispeed)
853 AC_CACHE_VAL(sc_cv_termios_ispeed,
854 [AC_TRY_COMPILE([#include <termios.h>],
855 [struct termios t; t.c_ispeed=0;],
856 [sc_cv_termios_ispeed=yes],
857 [sc_cv_termios_ispeed=no])])
858 if test $sc_cv_termios_ispeed = yes; then
859 AC_DEFINE(HAVE_TERMIOS_ISPEED)
861 AC_MSG_RESULT($sc_cv_termios_ispeed)
863 if test $sc_cv_termios_ispeed = yes; then
864 AC_MSG_CHECKING(for offset of c_ispeed in struct termios)
865 LIBS1="$LIBS"; LIBS="" # avoid libwrap allow_severity undefined
866 AC_CACHE_VAL(ac_cv_ispeed_offset,
867 [conftestspeedoff="conftestspeedoff.out"
876 if ((f=fopen("$conftestspeedoff","w"))==NULL){
877 fprintf(stderr,"\\"$conftestspeedoff\\": %s\n",strerror(errno)); exit(-1);
879 fprintf(f, "%d", ((char*)&t.c_ispeed-(char*)&t)/sizeof(speed_t));
883 [ac_cv_ispeed_offset=`cat $conftestspeedoff`],
884 [ac_cv_ispeed_offset=-1],
885 [ac_cv_ispeed_offset=-1] #!
888 AC_MSG_RESULT($ac_cv_ispeed_offset)
889 if test $ac_cv_ispeed_offset -ge 0; then
890 AC_DEFINE_UNQUOTED(ISPEED_OFFSET, $ac_cv_ispeed_offset)
894 # there is another issue with termios: OSR requires "#define _SVID3 ..."
895 # for reasonable termios support. We check this situation using IMAXBEL
896 AC_MSG_CHECKING(if _SVID3 is helpful)
897 AC_CACHE_VAL(ac_cv_svid3,
898 [AC_TRY_COMPILE([#include <termios.h>],
901 [AC_TRY_COMPILE([#define _SVID3 1
902 #include <termios.h>],
908 if test $ac_cv_svid3 = yes; then
911 AC_MSG_RESULT($ac_cv_svid3)
915 AC_MSG_CHECKING(for struct timespec)
916 AC_CACHE_VAL(sc_cv_struct_timespec,
917 [AC_TRY_COMPILE([#include <time.h>
919 #include <sys/time.h>
920 #endif],[struct timespec s;],
921 [sc_cv_struct_timespec=yes],
922 [sc_cv_struct_timespec=no])])
923 if test $sc_cv_struct_timespec = yes; then
924 AC_DEFINE(HAVE_STRUCT_TIMESPEC)
926 AC_MSG_RESULT($sc_cv_struct_timespec)
929 # struct linger; FreeBSD requires sys/types.h for sys/socket.h
930 AC_MSG_CHECKING(for struct linger)
931 AC_CACHE_VAL(sc_cv_struct_linger,
932 [AC_TRY_COMPILE([#include <sys/types.h>
933 #include <sys/socket.h>],[struct linger s;],
934 [sc_cv_struct_linger=yes],
935 [sc_cv_struct_linger=no])])
936 if test $sc_cv_struct_linger = yes; then
937 AC_DEFINE(HAVE_STRUCT_LINGER)
939 AC_MSG_RESULT($sc_cv_struct_linger)
942 # struct ip_mreq (for multicasting options)
943 AC_MSG_CHECKING(for struct ip_mreq)
944 AC_CACHE_VAL(sc_cv_struct_ip_mreq,
945 [AC_TRY_COMPILE([#include <sys/types.h>
946 #include <sys/socket.h>
947 #include <netinet/in.h>],[struct ip_mreq s;],
948 [sc_cv_struct_ip_mreq=yes],
949 [sc_cv_struct_ip_mreq=no])])
950 if test $sc_cv_struct_ip_mreq = yes; then
951 AC_DEFINE(HAVE_STRUCT_IP_MREQ)
953 AC_MSG_RESULT($sc_cv_struct_ip_mreq)
955 # struct ip_mreqn (for multicasting options)
956 AC_MSG_CHECKING(for struct ip_mreqn)
957 AC_CACHE_VAL(sc_cv_struct_ip_mreqn,
958 [AC_TRY_COMPILE([#include <sys/types.h>
959 #include <sys/socket.h>
960 #include <netinet/ip.h>],[struct ip_mreqn s;],
961 [sc_cv_struct_ip_mreqn=yes],
962 [sc_cv_struct_ip_mreqn=no])])
963 if test $sc_cv_struct_ip_mreqn = yes; then
964 AC_DEFINE(HAVE_STRUCT_IP_MREQN)
966 AC_MSG_RESULT($sc_cv_struct_ip_mreqn)
968 # struct ipv6_mreq (for multicasting options)
969 AC_MSG_CHECKING(for struct ipv6_mreq)
970 AC_CACHE_VAL(sc_cv_struct_ipv6_mreq,
971 [AC_TRY_COMPILE([#include <sys/types.h>
972 #include <sys/socket.h>
973 #include <netinet/in.h>],[struct ipv6_mreq s;],
974 [sc_cv_struct_ipv6_mreq=yes],
975 [sc_cv_struct_ipv6_mreq=no])])
976 if test $sc_cv_struct_ipv6_mreq = yes; then
977 AC_DEFINE(HAVE_STRUCT_IPV6_MREQ)
979 AC_MSG_RESULT($sc_cv_struct_ipv6_mreq)
982 # struct ifreq (for network interfaces)
983 AC_MSG_CHECKING(for struct ifreq)
984 AC_CACHE_VAL(sc_cv_struct_ifreq,
985 [AC_TRY_COMPILE([#include <sys/types.h>
986 #include <sys/socket.h>
987 #include <net/if.h>],[struct ifreq s;],
988 [sc_cv_struct_ifreq=yes],
989 [sc_cv_struct_ifreq=no])])
990 if test $sc_cv_struct_ifreq = yes; then
991 AC_DEFINE(HAVE_STRUCT_IFREQ)
993 AC_MSG_RESULT($sc_cv_struct_ifreq)
995 # struct ifreq.ifr_index
996 # on most systems that have struct ifreq
997 AC_MSG_CHECKING(for struct ifreq.ifr_index)
998 AC_CACHE_VAL(sc_cv_struct_ifreq_ifr_index,
999 [AC_TRY_COMPILE([#include <sys/types.h>
1000 #include <sys/socket.h>
1001 #include <net/if.h>],
1002 [struct ifreq ir;ir.ifr_index=0;],
1003 [sc_cv_struct_ifreq_ifr_index=yes],
1004 [sc_cv_struct_ifreq_ifr_index=no])])
1005 if test $sc_cv_struct_ifreq_ifr_index = yes; then
1006 AC_DEFINE(HAVE_STRUCT_IFREQ_IFR_INDEX)
1008 AC_MSG_RESULT($sc_cv_struct_ifreq_ifr_index)
1010 # struct ifreq.ifr_ifindex
1011 # Linux has ifr_ifindex instead of ifr_index
1012 AC_MSG_CHECKING(for struct ifreq.ifr_ifindex)
1013 AC_CACHE_VAL(sc_cv_struct_ifreq_ifr_ifindex,
1014 [AC_TRY_COMPILE([#include <sys/types.h>
1015 #include <sys/socket.h>
1016 #include <net/if.h>],
1017 [struct ifreq ir;ir.ifr_ifindex=0;],
1018 [sc_cv_struct_ifreq_ifr_ifindex=yes],
1019 [sc_cv_struct_ifreq_ifr_ifindex=no])])
1020 if test $sc_cv_struct_ifreq_ifr_ifindex = yes; then
1021 AC_DEFINE(HAVE_STRUCT_IFREQ_IFR_IFINDEX)
1023 AC_MSG_RESULT($sc_cv_struct_ifreq_ifr_ifindex)
1026 # some systems have a sa_len field in struct sockaddr and we need to support it
1027 # so we can compare sockaddrs simply with memcmp
1028 AC_MSG_CHECKING(for struct sockaddr.sa_len)
1029 AC_CACHE_VAL(sc_cv_struct_sockaddr_salen,
1030 [AC_TRY_COMPILE([#include <sys/types.h>
1031 #include <sys/socket.h>],
1032 [struct sockaddr sa;sa.sa_len=0;],
1033 [sc_cv_struct_sockaddr_salen=yes],
1034 [sc_cv_struct_sockaddr_salen=no])])
1035 if test $sc_cv_struct_sockaddr_salen = yes; then
1036 AC_DEFINE(HAVE_STRUCT_SOCKADDR_SALEN)
1038 AC_MSG_RESULT($sc_cv_struct_sockaddr_salen)
1040 ### IP6 sockaddr_in6
1042 AC_MSG_CHECKING(for component names of sockaddr_in6)
1043 AC_TRY_COMPILE([#include <sys/types.h>
1044 #include <netinet/in.h>],
1045 [struct sockaddr_in6 sa6;sa6.sin6_addr.s6_addr[0]=0;],
1046 [AC_MSG_RESULT(s6_addr);
1047 AC_DEFINE(HAVE_IP6_SOCKADDR, 0)],
1048 [AC_TRY_COMPILE([#include <sys/types.h>
1049 #include <netinet/in.h>],
1050 [struct sockaddr_in6 sa6;sa6.sin6_addr.u6_addr.u6_addr16[0]=0;],
1051 [AC_MSG_RESULT(u6_addr.u6_addr16);
1052 AC_DEFINE(HAVE_IP6_SOCKADDR, 1)],
1053 [AC_TRY_COMPILE([#include <sys/types.h>
1054 #include <netinet/in.h>],
1055 [struct sockaddr_in6 sa6;sa6.sin6_addr.u6_addr16[0]=0;],
1056 [AC_MSG_RESULT(u6_addr16); AC_DEFINE(HAVE_IP6_SOCKADDR, 2)],
1057 [AC_TRY_COMPILE([#include <sys/types.h>
1058 #include <netinet/in.h>],
1059 [struct sockaddr_in6 sa6;sa6.sin6_addr.in6_u.u6_addr16[0]=0;],
1060 [AC_MSG_RESULT(in6_u.u6_addr16);
1061 AC_DEFINE(HAVE_IP6_SOCKADDR, 3)],
1062 [AC_TRY_COMPILE([#include <sys/types.h>
1063 #include <netinet/in.h>],
1064 [struct sockaddr_in6 sa6;sa6.sin6_addr._S6_un._S6_u32[0]=0;],
1065 [AC_MSG_RESULT(_S6_un._S6_u32);
1066 AC_DEFINE(HAVE_IP6_SOCKADDR, 4)],
1067 [AC_TRY_COMPILE([#include <sys/types.h>
1068 #include <netinet/in.h>],
1069 [struct sockaddr_in6 sa6;sa6.sin6_addr.__u6_addr.__u6_addr32[0]=0;],
1070 [AC_MSG_RESULT(__u6_addr.__u6_addr32);
1071 AC_DEFINE(HAVE_IP6_SOCKADDR, 5)],
1073 [AC_MSG_RESULT([none or unknown])]
1076 dnl Check for struct iovec
1077 AC_MSG_CHECKING(for struct iovec)
1078 AC_CACHE_VAL(sc_cv_struct_iovec,
1079 [AC_TRY_COMPILE([#include <sys/uio.h>],[struct iovec s;],
1080 [sc_cv_struct_iovec=yes],
1081 [sc_cv_struct_iovec=no])])
1082 if test $sc_cv_struct_iovec = yes; then
1083 AC_DEFINE(HAVE_STRUCT_IOVEC)
1085 AC_MSG_RESULT($sc_cv_struct_iovec)
1087 dnl check for msg_control in struct msghdr
1088 AC_MSG_CHECKING(for struct msghdr.msg_control)
1089 AC_CACHE_VAL(sc_cv_struct_msghdr_msgcontrol,
1090 [AC_TRY_COMPILE([#include <sys/types.h>
1091 #include <sys/socket.h>],
1092 [struct msghdr s;s.msg_control=0;],
1093 [sc_cv_struct_msghdr_msgcontrol=yes],
1094 [sc_cv_struct_msghdr_msgcontrol=no])])
1095 if test $sc_cv_struct_msghdr_msgcontrol = yes; then
1096 AC_DEFINE(HAVE_STRUCT_MSGHDR_MSGCONTROL)
1098 AC_MSG_RESULT($sc_cv_struct_msghdr_msgcontrol)
1100 dnl check for msg_controllen in struct msghdr
1101 AC_MSG_CHECKING(for struct msghdr.msg_controllen)
1102 AC_CACHE_VAL(sc_cv_struct_msghdr_msgcontrollen,
1103 [AC_TRY_COMPILE([#include <sys/types.h>
1104 #include <sys/socket.h>],
1105 [struct msghdr s;s.msg_controllen=0;],
1106 [sc_cv_struct_msghdr_msgcontrollen=yes],
1107 [sc_cv_struct_msghdr_msgcontrollen=no])])
1108 if test $sc_cv_struct_msghdr_msgcontrollen = yes; then
1109 AC_DEFINE(HAVE_STRUCT_MSGHDR_MSGCONTROLLEN)
1111 AC_MSG_RESULT($sc_cv_struct_msghdr_msgcontrollen)
1113 dnl check for msg_flags in struct msghdr
1114 AC_MSG_CHECKING(for struct msghdr.msgflags)
1115 AC_CACHE_VAL(sc_cv_struct_msghdr_msgflags,
1116 [AC_TRY_COMPILE([#include <sys/types.h>
1117 #include <sys/socket.h>],
1118 [struct msghdr s;s.msg_flags=0;],
1119 [sc_cv_struct_msghdr_msgflags=yes],
1120 [sc_cv_struct_msghdr_msgflags=no])])
1121 if test $sc_cv_struct_msghdr_msgflags = yes; then
1122 AC_DEFINE(HAVE_STRUCT_MSGHDR_MSGFLAGS)
1124 AC_MSG_RESULT($sc_cv_struct_msghdr_msgflags)
1126 dnl check for struct cmsghdr
1127 AC_MSG_CHECKING(for struct cmsghdr)
1128 AC_CACHE_VAL(sc_cv_struct_cmsghdr,
1129 [AC_TRY_COMPILE([#include <sys/types.h>
1130 #include <sys/socket.h>
1131 #include <net/if.h>],[struct cmsghdr s;],
1132 [sc_cv_struct_cmsghdr=yes],
1133 [sc_cv_struct_cmsghdr=no])])
1134 if test $sc_cv_struct_cmsghdr = yes; then
1135 AC_DEFINE(HAVE_STRUCT_CMSGHDR)
1137 AC_MSG_RESULT($sc_cv_struct_cmsghdr)
1139 dnl check for struct in_pktinfo
1140 AC_MSG_CHECKING(for struct in_pktinfo)
1141 AC_CACHE_VAL(sc_cv_struct_in_pktinfo,
1142 [AC_TRY_COMPILE([#include <sys/types.h>
1143 #include <sys/socket.h>
1144 #include <netinet/in.h>],[struct in_pktinfo s;],
1145 [sc_cv_struct_in_pktinfo=yes],
1146 [sc_cv_struct_in_pktinfo=no])])
1147 if test $sc_cv_struct_in_pktinfo = yes; then
1148 AC_DEFINE(HAVE_STRUCT_IN_PKTINFO)
1150 AC_MSG_RESULT($sc_cv_struct_in_pktinfo)
1152 dnl check for ip_hl in struct ip
1153 AC_MSG_CHECKING(for struct ip.ip_hl)
1154 AC_CACHE_VAL(sc_cv_struct_ip_ip_hl,
1155 [AC_TRY_COMPILE([#include <sys/types.h>
1156 #include <netinet/in_systm.h>
1157 #include <netinet/in.h>
1158 #include <netinet/ip.h>],
1159 [struct ip s;s.ip_hl=0;],
1160 [sc_cv_struct_ip_ip_hl=yes],
1161 [sc_cv_struct_ip_ip_hl=no])])
1162 if test $sc_cv_struct_ip_ip_hl = yes; then
1163 AC_DEFINE(HAVE_STRUCT_IP_IP_HL)
1165 AC_MSG_RESULT($sc_cv_struct_ip_ip_hl)
1168 dnl Library function checks
1170 dnl Check sigaction()
1171 AC_CHECK_FUNC(sigaction, AC_DEFINE(HAVE_SIGACTION))
1173 dnl Check for 64bit versions of system calls
1174 AC_CHECK_FUNC(stat64, AC_DEFINE(HAVE_STAT64))
1175 AC_CHECK_FUNC(fstat64, AC_DEFINE(HAVE_FSTAT64))
1176 AC_CHECK_FUNC(lstat64, AC_DEFINE(HAVE_LSTAT64))
1177 AC_CHECK_FUNC(lseek64, AC_DEFINE(HAVE_LSEEK64))
1178 AC_CHECK_FUNC(truncate64, AC_DEFINE(HAVE_TRUNCATE64))
1179 AC_CHECK_FUNC(ftruncate64, AC_DEFINE(HAVE_FTRUNCATE64))
1181 AC_CHECK_FUNC(strtoll, AC_DEFINE(HAVE_STRTOLL))
1182 AC_CHECK_FUNC(hstrerror, AC_DEFINE(HAVE_HSTRERROR))
1183 AC_CHECK_FUNC(inet_ntop, AC_DEFINE(HAVE_INET_NTOP))
1185 #if test "$ac_cv_func_hstrerror" = "yes"; then
1186 # AC_MSG_CHECKING(if _XOPEN_SOURCE_EXTENDED is helpful)
1187 # AC_CACHE_VAL(ac_cv_xopen_source_extended,
1188 # [AC_TRY_COMPILE([#include <netdb.h>],
1190 # [ac_cv_xopen_source_extended=no],
1191 # [AC_TRY_COMPILE([#define _XOPEN_SOURCE_EXTENDED 1
1192 ## include <netdb.h>],
1194 # [ac_cv_xopen_source_extended=yes],
1195 # [ac_cv_xopen_source_extended=no]
1198 # if test $ac_cv_xopen_source_extended = yes; then
1199 # AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
1201 # AC_MSG_RESULT($ac_cv_xopen_source_extended)
1204 dnl Search for openpty()
1206 AC_CHECK_FUNC(openpty, AC_DEFINE(HAVE_OPENPTY))
1208 AC_CHECK_LIB(bsd, openpty,
1209 [LIBS="-lbsd $LIBS"; AC_DEFINE(HAVE_OPENPTY)])
1211 AC_CHECK_LIB(util, openpty,
1212 [LIBS="-lutil $LIBS"; AC_DEFINE(HAVE_OPENPTY)])
1214 dnl Search for flock()
1215 # with Linux it's in libc, with AIX in libbsd
1216 AC_CHECK_FUNC(flock, AC_DEFINE(HAVE_FLOCK),
1217 AC_CHECK_LIB(bsd, flock, [LIBS="-lbsd $LIBS"]))
1219 dnl Search for setenv()
1220 AC_CHECK_FUNC(setenv, AC_DEFINE(HAVE_SETENV),
1221 AC_CHECK_LIB(isode, setenv, [LIBS="-lisode $LIBS"]))
1223 dnl Search for unsetenv()
1224 AC_CHECK_FUNC(unsetenv, AC_DEFINE(HAVE_UNSETENV))
1230 AC_MSG_CHECKING(if printf has Z modifier)
1231 AC_CACHE_VAL(ac_cv_have_z_modifier,
1237 exit(strcmp(s,"1"));
1239 [ac_cv_have_z_modifier=yes],
1240 [ac_cv_have_z_modifier=no],
1241 [ac_cv_have_z_modifier=no])])
1242 if test $ac_cv_have_z_modifier = yes; then
1243 AC_DEFINE(HAVE_FORMAT_Z)
1245 AC_MSG_RESULT($ac_cv_have_z_modifier)
1248 dnl find the number of bits we must shift a value to match the given mask
1249 dnl (e.g., mask 0x00f0 requires shifting with 4)
1250 ## NOTE: some platforms only need one '\' to escape '"' in string constant
1251 define(AC_SHIFT_OFFSET,[
1252 AC_CACHE_CHECK(shift offset of $1, $2,
1253 [LIBS1="$LIBS"; LIBS="" # avoid libwrap allow_severity undefined
1254 conftestoffset="conftestoffset.out"
1258 #include <termios.h>
1261 unsigned int i,n=$1;
1263 if ((f=fopen("$conftestoffset","w"))==NULL){
1264 fprintf(stderr,"\\"$conftestoffset\\": %s\n",strerror(errno)); exit(-1);
1266 if (n==0) {fprintf(stderr,"$1 is 0 (impossible!)\n"); exit(1);}
1267 i=0; while (!(n&1)) {
1270 fprintf(f, "%u", i);
1272 fprintf(f, "-1"); /* anticipate result of xioinitialize assert */
1277 [$2=`cat $conftestoffset`],
1279 [AC_MSG_RESULT(please determine $1_SHIFT manually)]
1282 AC_DEFINE_UNQUOTED($1_SHIFT, ${$2})
1285 AC_SHIFT_OFFSET(CRDLY, sc_cv_sys_crdly_shift)
1286 AC_SHIFT_OFFSET(TABDLY, sc_cv_sys_tabdly_shift)
1287 AC_SHIFT_OFFSET(CSIZE, sc_cv_sys_csize_shift)
1290 dnl find what physical type (basic C type) is equivalent to the given type.
1291 dnl arg1: include file(s)
1293 dnl arg3: output variable
1294 dnl arg4: cache variable (might be constructed automatically)
1295 dnl output values: 1..short, 2..unsigned short, 3..int, 4..u-int,
1296 dnl 5..long, 6..u-long; others not yet supported
1297 define(AC_BASIC_TYPE,[
1298 AC_CACHE_CHECK(for equivalent simple type of $2, $4,
1299 [CFLAGS1="$CFLAGS"; CFLAGS="-Werror -O0 $CFLAGS1"
1300 AC_TRY_COMPILE([$1],[$2 u; short v; &u==&v;],
1301 [$4="1 /* short */"],
1302 [AC_TRY_COMPILE([$1],[$2 u; unsigned short v; &u==&v;],
1303 [$4="2 /* unsigned short */"],
1304 [AC_TRY_COMPILE([$1],[$2 u; int v; &u==&v;],
1306 [AC_TRY_COMPILE([$1],[$2 u; unsigned int v; &u==&v;],
1307 [$4="4 /* unsigned int */"],
1308 [AC_TRY_COMPILE([$1],[$2 u; long v; &u==&v;],
1309 [$4="5 /* long */"],
1310 [AC_TRY_COMPILE([$1],[$2 u; unsigned long v; &u==&v;],
1311 [$4="6 /* unsigned long */"],
1312 [AC_TRY_COMPILE([$1],[$2 u; long long v; &u==&v;],
1313 [$4="7 /* long long */"],
1314 [AC_TRY_COMPILE([$1],[$2 u; unsigned long long v; &u==&v;],
1315 [$4="8 /* unsigned long long */"],
1316 [$4="0 /* unknown, taking default */"
1317 ]) ]) ]) ]) ]) ]) ]) ])
1318 CFLAGS="$CFLAGS1" ])
1319 AC_DEFINE_UNQUOTED($3, ${$4})
1322 dnl find what physical type (basic C type) describes the given struct or union
1324 dnl arg1: include file(s); must declare the structure type
1325 dnl arg2: struct name (e.g., "struct stat")
1326 dnl arg3: variable or component (e.g., "st_ino")
1327 dnl arg4: output variable, values see AC_BASIC_TYPE
1328 dnl arg5: cache variable (might be constructed automatically)
1329 define(AC_TYPEOF_COMPONENT,[
1330 AC_CACHE_CHECK(for basic type of $2.$3, $5,
1331 [CFLAGS1="$CFLAGS"; CFLAGS="-Werror -O0 $CFLAGS1"
1332 AC_TRY_COMPILE([$1],[$2 u;short v; &u.$3==&v;],
1333 [$5="1 /* short */"],
1334 [AC_TRY_COMPILE([$1],[$2 u; unsigned short v; &u.$3==&v;],
1335 [$5="2 /* unsigned short */"],
1336 [AC_TRY_COMPILE([$1],[$2 u; int v; &u.$3==&v;],
1338 [AC_TRY_COMPILE([$1],[$2 u; unsigned int v; &u.$3==&v;],
1339 [$5="4 /* unsigned int */"],
1340 [AC_TRY_COMPILE([$1],[$2 u; long v; &u.$3==&v;],
1341 [$5="5 /* long */"],
1342 [AC_TRY_COMPILE([$1],[$2 u; unsigned long v; &u.$3==&v;],
1343 [$5="6 /* unsigned long */"],
1344 [AC_TRY_COMPILE([$1],[$2 u; long long v; &u.$3==&v;],
1345 [$5="7 /* long long */"],
1346 [AC_TRY_COMPILE([$1],[$2 u; unsigned long long v; &u.$3==&v;],
1347 [$5="8 /* unsigned long long */"],
1348 [$5="0 /* unknown, taking default */"
1349 ]) ]) ]) ]) ]) ]) ]) ])
1350 CFLAGS="$CFLAGS1" ])
1351 AC_DEFINE_UNQUOTED($4, ${$5})
1354 AC_BASIC_TYPE([#include <stdlib.h>], size_t, HAVE_BASIC_SIZE_T, sc_cv_type_sizet_basic)
1355 AC_BASIC_TYPE([#include <sys/types.h>
1356 #include <sys/stat.h>
1357 #include <unistd.h>], mode_t, HAVE_BASIC_MODE_T, sc_cv_type_modet_basic)
1358 AC_BASIC_TYPE([#include <sys/types.h>
1359 #include <unistd.h>], pid_t, HAVE_BASIC_PID_T, sc_cv_type_pidt_basic)
1360 AC_BASIC_TYPE([#include <sys/types.h>
1361 #include <unistd.h>], uid_t, HAVE_BASIC_UID_T, sc_cv_type_uidt_basic)
1362 AC_BASIC_TYPE([#include <sys/types.h>
1363 #include <unistd.h>], gid_t, HAVE_BASIC_GID_T, sc_cv_type_gidt_basic)
1365 AC_BASIC_TYPE([#include <time.h>], time_t, HAVE_BASIC_TIME_T,
1366 sc_cv_type_timet_basic)
1368 # this is questionable, might fail on some systems
1369 AC_BASIC_TYPE([#include <sys/types.h>
1370 #include <sys/socket.h>
1371 #include <unistd.h>], socklen_t, HAVE_BASIC_SOCKLEN_T,
1372 sc_cv_type_socklent_basic)
1374 AC_BASIC_TYPE([#include <sys/types.h>
1375 #include <unistd.h>], off64_t, HAVE_BASIC_OFF64_T, sc_cv_type_off64_basic)
1377 # oh god, __dev_t in Linux 2.4 is struct{int[2];}, not handled here yet.
1378 AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_dev, HAVE_TYPEOF_ST_DEV, sc_cv_type_stat_stdev_basic)
1379 AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_ino, HAVE_TYPEOF_ST_INO, sc_cv_type_stat_stino_basic)
1380 AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_nlink, HAVE_TYPEOF_ST_NLINK, sc_cv_type_stat_stnlink_basic)
1381 AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_size, HAVE_TYPEOF_ST_SIZE, sc_cv_type_stat_stsize_basic)
1382 AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_blksize, HAVE_TYPEOF_ST_BLKSIZE, sc_cv_type_stat_stblksize_basic)
1383 AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat, st_blocks, HAVE_TYPEOF_ST_BLOCKS, sc_cv_type_stat_stblocks_basic)
1385 if test "$ac_cv_func_stat64" = yes; then
1386 AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat64, st_dev, HAVE_TYPEOF_ST64_DEV, sc_cv_type_stat64_stdev_basic)
1387 AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat64, st_ino, HAVE_TYPEOF_ST64_INO, sc_cv_type_stat64_stino_basic)
1388 AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat64, st_nlink, HAVE_TYPEOF_ST64_NLINK, sc_cv_type_stat64_stnlink_basic)
1389 AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat64, st_size, HAVE_TYPEOF_ST64_SIZE, sc_cv_type_stat64_stsize_basic)
1390 AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat64, st_blksize, HAVE_TYPEOF_ST64_BLKSIZE, sc_cv_type_stat64_stblksize_basic)
1391 AC_TYPEOF_COMPONENT([#include <sys/stat.h>], struct stat64, st_blocks, HAVE_TYPEOF_ST64_BLOCKS, sc_cv_type_stat64_stblocks_basic)
1394 AC_TYPEOF_COMPONENT([#include <sys/time.h>], struct timeval, tv_usec, HAVE_TYPEOF_STRUCT_TIMEVAL_TV_USEC, sc_cv_type_struct_timeval_tv_usec)
1396 AC_TYPEOF_COMPONENT([#include <sys/types.h>
1397 #include <sys/time.h>
1398 #include <sys/resource.h>],
1399 struct rlimit, rlim_max, HAVE_TYPEOF_RLIM_MAX, sc_cv_type_rlimit_rlimmax_basic)
1401 ### snprintf, vsnprintf
1404 AC_MSG_CHECKING(for /dev/ptmx)
1405 if test -c /dev/ptmx; then
1406 AC_DEFINE(HAVE_DEV_PTMX, 1)
1410 AC_MSG_CHECKING(for /dev/ptc)
1411 if test -c /dev/ptc; then
1412 AC_DEFINE(HAVE_DEV_PTC)
1419 AC_MSG_CHECKING(for /proc)
1420 if test -d /proc; then
1421 AC_DEFINE(HAVE_PROC_DIR, 1)
1427 AC_MSG_CHECKING(for /proc/*/fd)
1428 if test -d /proc/$$/fd; then
1429 AC_DEFINE(HAVE_PROC_DIR_FD, 1)
1435 dnl "tcpd" "tcpwrappers"
1436 # on some platforms, raw linking with libwrap fails because allow_severity and
1437 # deny_severity are not explicitely defined. Thus we put the libwrap part to
1439 AC_MSG_CHECKING(whether to include libwrap support)
1440 AC_ARG_ENABLE(libwrap, [ --disable-libwrap disable libwrap support],
1441 [ case "$enableval" in
1442 no) AC_MSG_RESULT(no); WITH_LIBWRAP= ;;
1443 *) AC_MSG_RESULT(yes); WITH_LIBWRAP=1 ;;
1445 [ AC_MSG_RESULT(yes); WITH_LIBWRAP=1 ])
1447 # check if we find the components of libwrap ("tcpd" "tcpwrappers")
1448 if test -n "$WITH_LIBWRAP"; then
1449 AC_MSG_NOTICE(checking for components of libwrap)
1450 # first, we need to find the include file <tcpd.h>
1451 AC_CACHE_VAL(sc_cv_have_tcpd_h,
1452 [AC_TRY_COMPILE([#include <sys/types.h>
1453 #include <tcpd.h>],[;],
1454 [sc_cv_have_tcpd_h=yes; LIBWRAP_ROOT=""],
1455 [sc_cv_have_tcpd_h=no
1456 for D in "/sw" "/usr/local" "/opt/freeware" "/usr/sfw"; do
1459 if test -r "$i"; then
1460 #V_INCL="$V_INCL -I$I"
1461 CPPFLAGS="$CPPFLAGS -I$I"
1462 AC_MSG_NOTICE(found $i)
1463 sc_cv_have_tcpd_h=yes; LIBWRAP_ROOT="$D"
1468 if test "$sc_cv_have_tcpd_h" = "yes"; then
1469 AC_DEFINE(HAVE_TCPD_H)
1471 AC_MSG_NOTICE(checked for tcpd.h... $sc_cv_have_tcpd_h)
1472 fi # end checking for tcpd.h
1473 if test -n "$WITH_LIBWRAP" -a "$sc_cv_have_tcpd_h" = yes; then
1474 # next, we search for the wrap library (libwrap.*)
1475 AC_MSG_CHECKING(for libwrap)
1476 AC_CACHE_VAL(sc_cv_have_libwrap,
1478 if test -n "$LIBWRAP_ROOT"; then
1479 L="$LIBWRAP_ROOT/lib"; LIBS="-L$L -lwrap $LIBS"
1483 AC_TRY_LINK([#include <sys/types.h>
1485 int allow_severity,deny_severity;],[hosts_access(0)],
1486 [sc_cv_have_libwrap='yes'],
1487 [sc_cv_have_libwrap='no'
1488 LIBS="$LIBS -lnsl" # RedHat73
1489 AC_TRY_LINK([#include <sys/types.h>
1491 int allow_severity,deny_severity;],[hosts_access(0)],
1492 [sc_cv_have_libwrap='yes'],
1493 [sc_cv_have_libwrap='no'])
1496 if test "$sc_cv_have_libwrap" != 'yes'; then
1501 if test "$sc_cv_have_libwrap" = 'yes'; then
1502 AC_DEFINE(HAVE_LIBWRAP)
1504 AC_MSG_RESULT($sc_cv_have_libwrap)
1507 if test -n "$WITH_LIBWRAP"; then
1508 if test "$sc_cv_have_tcpd_h" = "yes" -a "$sc_cv_have_libwrap" = "yes"; then
1509 AC_DEFINE(WITH_LIBWRAP)
1511 AC_MSG_WARN([not all components of tcp wrappers found, disabling it]);
1515 # check of hosts_allow_table
1516 if test -n "$WITH_LIBWRAP"; then
1517 AC_MSG_CHECKING(checking for hosts_allow_table)
1518 AC_CACHE_VAL(sc_cv_have_hosts_allow_table,
1519 [AC_TRY_COMPILE([#include <sys/types.h>
1520 #include <tcpd.h>],[hosts_allow_table="";],
1521 [sc_cv_have_hosts_allow_table=yes],
1522 [sc_cv_have_hosts_allow_table=no])])
1523 if test $sc_cv_have_hosts_allow_table = yes; then
1524 AC_DEFINE(HAVE_HOSTS_ALLOW_TABLE)
1526 AC_MSG_RESULT($sc_cv_have_hosts_allow_table)
1527 fi # test -n "$WITH_LIBWRAP"
1530 if test "$GCC" = yes; then
1534 # FIPS support requires compiling with fipsld.
1535 # fipsld requires the FIPSLD_CC variable to be set to the original CC.
1536 # This check must be done after all other checks that require compiling
1537 # so that fipsld is not used by the configure script itself.
1538 if test -n "$WITH_FIPS"; then
1539 if test "$sc_cv_have_openssl_fips_h" = 'yes' -a "$sc_cv_have_libcrypto" = 'yes'; then
1541 if test "${FIPSLD+set}" != set ; then
1544 CC="FIPSLD_CC=$CC $FIPSLD"