1 dnl sxe-sockets.m4 -- socket and network functions
3 AC_DEFUN([SXE_CHECK_SOCKLEN_T], [dnl
5 SXE_CHECK_HEADERS([sys/types.h sys/socket.h])
6 AC_CHECK_TYPES([socklen_t], [], [], [
7 #ifdef HAVE_SYS_TYPES_H
8 # include <sys/types.h>
10 #ifdef HAVE_SYS_SOCKET_H
11 # include <sys/socket.h>
15 AC_MSG_CHECKING([whether `socklen_t' is actually `size_t'])
16 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
17 #ifdef HAVE_SYS_TYPES_H
18 # include <sys/types.h>
20 #ifdef HAVE_SYS_SOCKET_H
21 # include <sys/socket.h>
24 int accept(int, struct sockaddr *, size_t *);
25 ]])], [socklen_t_is_size_t="yes"], [socklen_t_is_size_t="no"])
26 AC_MSG_RESULT([$socklen_t_is_size_t])
28 AC_MSG_CHECKING([whether `socklen_t' is actually `int'])
29 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
30 #ifdef HAVE_SYS_TYPES_H
31 # include <sys/types.h>
33 #ifdef HAVE_SYS_SOCKET_H
34 # include <sys/socket.h>
37 int accept(int, struct sockaddr *, int *);
38 ]])], [socklen_t_is_int="yes"], [socklen_t_is_int="no"])
39 AC_MSG_RESULT([$socklen_t_is_int])
41 AC_MSG_CHECKING([what socklen_t is an alias for])
42 if test "$ac_cv_type_socklen_t" = "yes"; then
43 socklen_t_is_actually="socklen_t"
44 elif test "$socklen_t_is_size_t" = "yes"; then
45 socklen_t_is_actually="size_t"
46 AC_DEFINE([socklen_t], [size_t],
47 [A simple alias for Unix98's socklen_t])
48 elif test "$socklen_t_is_int" = "yes"; then
49 socklen_t_is_actually="int"
50 AC_DEFINE([socklen_t], [int],
51 [A simple alias for Unix98's socklen_t])
53 socklen_t_is_actually="bullcrap"
55 AC_MSG_RESULT([$socklen_t_is_actually])
57 ])dnl SXE_CHECK_SOCKLEN_T
60 AC_DEFUN([_SXE_CHECK_GENERIC_SOCKFUN], [dnl
61 ## arg1 is the function to crawl for
62 pushdef([SOCKFUN], [$1])
64 SXE_CHECK_HEADERS([sys/types.h sys/socket.h])
65 AC_CHECK_FUNCS(SOCKFUN)
66 AC_CHECK_DECLS(SOCKFUN, [], [], [
67 #ifdef HAVE_SYS_TYPES_H
68 # include <sys/types.h>
70 #ifdef HAVE_SYS_SOCKET_H
71 # include <sys/socket.h>
75 SXE_CHECK_LIB_FUNCS([nsl socket net], SOCKFUN)
77 if test "$ac_cv_func_[]SOCKFUN" = "no" -a \
78 "$ac_cv_lib_nsl___[]SOCKFUN" = "yes"; then
79 ## whether we need to add -lnsl to LIBS
80 SOCKET_LIBS="$SOCKET_LIBS -lnsl"
81 ac_sxe_func_[]SOCKFUN="yes"
83 elif test "$ac_cv_func_[]SOCKFUN" = "no" -a \
84 "$ac_cv_lib_socket___[]SOCKFUN" = "yes"; then
85 ## whether we need to add -lsocket to LIBS
86 SOCKET_LIBS="$SOCKET_LIBS -lsocket"
87 ac_sxe_func_[]SOCKFUN="yes"
89 elif test "$ac_cv_func_[]SOCKFUN" = "no" -a \
90 "$ac_cv_lib_net___[]SOCKFUN" = "yes"; then
91 ## whether we need to add -lsocket to LIBS
92 SOCKET_LIBS="$SOCKET_LIBS -lnet"
93 ac_sxe_func_[]SOCKFUN="yes"
95 elif test "$ac_cv_func_[]SOCKFUN" = "yes"; then
96 ## nothing to add to LIBS
97 ac_sxe_func_[]SOCKFUN="yes"
100 ac_sxe_func_[]SOCKFUN="no"
105 dnl At least one system has been identified to require BOTH nsl and socket
106 dnl libs at the same time to link properly.
107 dnl Howbeit, we currently do not provide a check for this very tragedy^Wstrategy
110 ])dnl _SXE_CHECK_GENERIC_SOCKFUN
113 AC_DEFUN([SXE_CHECK_UNIX_DOMAIN_SOCKETS], [dnl
114 ## defines have_unix and HAVE_UNIX
115 have_unix="uncertain"
117 SXE_CHECK_HEADERS([sys/types.h sys/socket.h sys/un.h])
118 AC_CHECK_TYPE([struct sockaddr_un], [], [], [
119 #ifdef HAVE_SYS_TYPES_H
120 # include <sys/types.h>
122 #ifdef HAVE_SYS_SOCKET_H
123 # include <sys/socket.h>
130 AC_CHECK_MEMBER([struct sockaddr_un.sun_len], [], [], [
131 #ifdef HAVE_SYS_TYPES_H
132 # include <sys/types.h>
134 #ifdef HAVE_SYS_SOCKET_H
135 # include <sys/socket.h>
142 ## evaluating the results
143 if test "$ac_cv_type_struct_sockaddr_un" = "yes" -a \
144 "$ac_cv_header_sys_socket_h" = "yes" -a \
145 "$ac_cv_header_sys_un_h" = "yes"; then
152 if test "$ac_cv_member_struct_sockaddr_un_sun_len" = "yes"; then
153 AC_DEFINE([HAVE_SOCKADDR_SUN_LEN], [1],
154 [Legacy shit, use HAVE_STRUCT_SOCKADDR_UN_SUN_LEN!])
156 ])dnl SXE_CHECK_UNIX_DOMAIN_SOCKETS
158 AC_DEFUN([SXE_CHECK_GETHOSTBYNAME], [_SXE_CHECK_GENERIC_SOCKFUN([gethostbyname])])
159 AC_DEFUN([SXE_CHECK_CONNECT], [_SXE_CHECK_GENERIC_SOCKFUN([connect])])
160 AC_DEFUN([SXE_CHECK_ACCEPT], [_SXE_CHECK_GENERIC_SOCKFUN([accept])])
161 AC_DEFUN([SXE_CHECK_SOCKET], [_SXE_CHECK_GENERIC_SOCKFUN([socket])])
162 AC_DEFUN([SXE_CHECK_GETHOSTNAME], [_SXE_CHECK_GENERIC_SOCKFUN([gethostname])])
163 AC_DEFUN([SXE_CHECK_GETNAMEINFO], [_SXE_CHECK_GENERIC_SOCKFUN([getnameinfo])])
164 AC_DEFUN([SXE_CHECK_GETADDRINFO], [_SXE_CHECK_GENERIC_SOCKFUN([getaddrinfo])])
166 AC_DEFUN([SXE_CHECK_SOCKET_IPV4], [dnl
167 SXE_CHECK_HEADERS([sys/types.h sys/socket.h])
168 AC_MSG_CHECKING([for IPv4])
169 AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* is AF_INET available? */
170 #if defined HAVE_SYS_TYPES_H
171 # include <sys/types.h>
173 #if defined HAVE_SYS_SOCKET_H
174 # include <sys/socket.h>
178 if (socket(AF_INET, SOCK_STREAM, 0) < 0)
183 ]])], [have_ipv4=yes], [have_ipv4=no], [have_ipv4=no])
185 AC_MSG_RESULT([$have_ipv4])
186 ])dnl SXE_CHECK_SOCKET_IPV4
188 AC_DEFUN([SXE_CHECK_SOCKET_IPV6], [dnl
189 SXE_CHECK_HEADERS([sys/types.h sys/socket.h])
190 AC_MSG_CHECKING([for IPv6])
191 AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* is AF_INET6 available? */
192 #if defined HAVE_SYS_TYPES_H
193 # include <sys/types.h>
195 #if defined HAVE_SYS_SOCKET_H
196 # include <sys/socket.h>
200 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
205 ]])], [have_ipv6=yes], [have_ipv6=no], [have_ipv6=no])
207 AC_MSG_RESULT([$have_ipv6])
208 ])dnl SXE_CHECK_SOCKET_IPV6
211 dnl CURL_CHECK_NONBLOCKING_SOCKET
212 dnl -------------------------------------------------
213 dnl Check for how to set a socket to non-blocking state. There seems to exist
214 dnl four known different ways, with the one used almost everywhere being POSIX
215 dnl and XPG3, while the other different ways for different systems (old BSD,
216 dnl Windows and Amiga).
218 dnl There are two known platforms (AIX 3.x and SunOS 4.1.x) where the
219 dnl O_NONBLOCK define is found but does not work. This condition is attempted
220 dnl to get caught in this script by using an excessive number of #ifdefs...
222 AC_DEFUN([SXE_CHECK_NONBLOCKING_SOCKET], [dnl
224 SXE_CHECK_NONBLOCKING_SOCKET_O_NONBLOCK([nonblock])
225 SXE_CHECK_NONBLOCKING_SOCKET_FIONBIO([nonblock])
226 SXE_CHECK_NONBLOCKING_SOCKET_IOCTLSOCKET([nonblock])
227 SXE_CHECK_NONBLOCKING_SOCKET_SO_NONBLOCK([nonblock])
229 AC_MSG_CHECKING([for preferred non-blocking sockets style])
230 if test "$sxe_have_nonblocking_socket_O_NONBLOCK" = "yes"; then
231 nonblock="O_NONBLOCK"
232 AC_DEFINE([WITH_NONBLOCKING_SOCKET_O_NONBLOCK], [1],
233 [Whether to use fnctl() with O_NONBLOCK])
234 elif test "$sxe_have_nonblocking_socket_FIONBIO" = "yes"; then
236 AC_DEFINE([WITH_NONBLOCKING_SOCKET_O_NONBLOCK], [1],
237 [Whether to use ioctl() with FIONBIO])
238 elif test "$sxe_have_nonblocking_socket_IoctlSocket" = "yes"; then
239 nonblock="IoctlSocket"
240 AC_DEFINE([WITH_NONBLOCKING_SOCKET_IOCTLSOCKET], [1],
241 [Whether to use IoctlSocket() with FIONBIO])
242 elif test "$sxe_have_nonblocking_socket_SO_NONBLOCK" = "yes"; then
243 nonblock="SO_NONBLOCK"
244 AC_DEFINE([WITH_NONBLOCKING_SOCKET_SO_NONBLOCK], [1],
245 [Whether to use setsockopt() with SO_NONBLOCK])
248 AC_DEFINE([WITH_NONBLOCKING_SOCKET_ZILCH], [1],
249 [Whether not to use a non-blocking socket])
251 AC_MSG_RESULT([$nonblock])
252 ])dnl SXE_CHECK_NONBLOCKING_SOCKET
254 AC_DEFUN([SXE_CHECK_NONBLOCKING_SOCKET_O_NONBLOCK], [dnl
255 ## arg1 - varname to put the socket implementation into
256 pushdef([VARNAME], [$1])
258 SXE_CHECK_HEADERS([sys/types.h unistd.h fcntl.h])
259 AC_CHECK_FUNCS([fcntl])
260 AC_CHECK_DECLS([fcntl], [], [], [
261 #if defined HAVE_SYS_TYPES_H
262 #include <sys/types.h>
264 #if defined HAVE_UNISTD_H
267 #if defined HAVE_FCNTL_H
271 AC_MSG_CHECKING([whether fnctl() with O_NONBLOCK works])
272 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
273 /* headers for O_NONBLOCK test */
274 #if defined HAVE_SYS_TYPES_H
275 #include <sys/types.h>
277 #if defined HAVE_UNISTD_H
280 #if defined HAVE_FCNTL_H
284 /* try to compile O_NONBLOCK */
285 #if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
286 # if defined(__SVR4) || defined(__srv4__)
287 # define PLATFORM_SOLARIS
289 # define PLATFORM_SUNOS4
292 #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX4)
293 # define PLATFORM_AIX_V3
296 #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
297 #error "O_NONBLOCK does not work on this platform"
300 int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK);
302 [sxe_have_nonblocking_socket_O_NONBLOCK="yes"],
303 [sxe_have_nonblocking_socket_O_NONBLOCK="no"])
304 AC_MSG_RESULT([$sxe_have_nonblocking_socket_O_NONBLOCK])
306 _SXE_EVALUATE_NONBLOCKING_SOCKET(VARNAME, [O_NONBLOCK])
308 ])dnl SXE_CHECK_NONBLOCKING_SOCKET_O_NONBLOCK
310 AC_DEFUN([SXE_CHECK_NONBLOCKING_SOCKET_FIONBIO], [dnl
311 ## arg1 - varname to put the socket implementation into
312 pushdef([VARNAME], [$1])
314 SXE_CHECK_HEADERS([unistd.h stropts.h])
315 AC_CHECK_FUNCS([ioctl])
316 AC_CHECK_DECLS([ioctl], [], [], [
317 #if defined HAVE_UNISTD_H
320 #if defined HAVE_STROPTS_H
324 AC_MSG_CHECKING([whether ioctl() with FIONBIO works])
325 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
326 /* headers for FIONBIO test */
327 #if defined HAVE_UNISTD_H
330 #if defined HAVE_STROPTS_H
334 /* FIONBIO source test (old-style unix) */
336 int flags = ioctl(socket, FIONBIO, &flags);
338 [sxe_have_nonblocking_socket_FIONBIO="yes"],
339 [sxe_have_nonblocking_socket_FIONBIO="no"])
340 AC_MSG_RESULT([$sxe_have_nonblocking_socket_FIONBIO])
342 _SXE_EVALUATE_NONBLOCKING_SOCKET(VARNAME, [FIONBIO])
344 ])dnl SXE_CHECK_NONBLOCKING_SOCKET_FIONBIO
346 AC_DEFUN([SXE_CHECK_NONBLOCKING_SOCKET_IOCTLSOCKET], [dnl
347 ## arg1 - varname to put the socket implementation into
348 pushdef([VARNAME], [$1])
350 SXE_CHECK_HEADERS([sys/ioctl.h])
351 AC_CHECK_FUNCS([IoctlSocket])
352 AC_CHECK_DECLS([IoctlSocket], [], [], [
353 #if defined HAVE_SYS_IOCTL_H
354 #include <sys/ioctl.h>
357 AC_MSG_CHECKING([whether IoctlSocket() with FIONBIO works])
358 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
359 /* headers for IoctlSocket test (Amiga?) */
360 #if defined HAVE_SYS_IOCTL_H
361 #include <sys/ioctl.h>
364 /* IoctlSocket source code */
366 int flags = IoctlSocket(socket, FIONBIO, (long)1);
368 [sxe_have_nonblocking_socket_IoctlSocket="yes"],
369 [sxe_have_nonblocking_socket_IoctlSocket="no"])
370 AC_MSG_RESULT([$sxe_have_nonblocking_socket_IoctlSocket])
372 _SXE_EVALUATE_NONBLOCKING_SOCKET(VARNAME, [IoctlSocket])
374 ])dnl SXE_CHECK_NONBLOCKING_SOCKET_IOCTLSOCKET
376 AC_DEFUN([SXE_CHECK_NONBLOCKING_SOCKET_SO_NONBLOCK], [dnl
377 ## arg1 - varname to put the socket implementation into
378 pushdef([VARNAME], [$1])
380 SXE_CHECK_HEADERS([socket.h])
381 AC_CHECK_FUNCS([setsockopt])
382 AC_CHECK_DECLS([setsockopt], [], [], [
383 #if defined HAVE_SOCKET_H
387 AC_MSG_CHECKING([whether setsockopt() with SO_NONBLOCK works])
388 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
389 /* headers for SO_NONBLOCK test (BeOS) */
390 #if defined HAVE_SOCKET_H
394 /* SO_NONBLOCK source code */
397 int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
399 [sxe_have_nonblocking_socket_SO_NONBLOCK="yes"],
400 [sxe_have_nonblocking_socket_SO_NONBLOCK="no"])
401 AC_MSG_RESULT([$sxe_have_nonblocking_socket_SO_NONBLOCK])
403 _SXE_EVALUATE_NONBLOCKING_SOCKET(VARNAME, [SO_NONBLOCK])
405 ])dnl SXE_CHECK_NONBLOCKING_SOCKET_SO_NONBLOCK
407 AC_DEFUN([_SXE_EVALUATE_NONBLOCKING_SOCKET], [dnl
408 pushdef([VARNAME], [$1])
409 pushdef([TSTNAME], [$2])
410 if test "$sxe_have_nonblocking_socket_[]TSTNAME[]" = "yes"; then
411 AC_DEFINE([HAVE_NONBLOCKING_SOCKET]TSTNAME, [1],
412 [use ]TSTNAME[ for non-blocking sockets])
413 if test -n "[]VARNAME[]"; then
414 VARNAME="[]TSTNAME[]"
421 ])dnl _SXE_EVALUATE_NONBLOCKING_SOCKET
424 AC_DEFUN([SXE_CHECK_TCPUDP_SOCKETS], [dnl
425 ## defines have_sockets and have_tcpudp
426 ## and HAVE_SOCKETS and HAVE_TCPUDP
427 have_sockets="uncertain"
428 have_tcpudp="uncertain"
430 SXE_CHECK_HEADERS([netinet/in.h])
431 SXE_CHECK_GETHOSTBYNAME
432 SXE_CHECK_GETHOSTNAME
433 SXE_CHECK_GETNAMEINFO
434 SXE_CHECK_GETADDRINFO
440 SXE_CHECK_SOCKET_IPV4
441 SXE_CHECK_SOCKET_IPV6
442 SXE_CHECK_NONBLOCKING_SOCKET
444 ## evaluating the results
445 if test "$ac_cv_header_netinet_in_h" = "yes" -a \
446 "$ac_cv_header_arpa_inet_h" = "yes" -a \
447 "$ac_cv_header_netdb_h" = "yes"; then
448 if test "$ac_sxe_func_socket" = "yes" -a \
449 "$ac_sxe_func_gethostbyname" = "yes" -a \
450 "$ac_sxe_func_gethostname" = "yes" -a \
451 "$ac_sxe_func_getnameinfo" = "yes" -a \
452 "$ac_sxe_func_getaddrinfo" = "yes"; then
463 ])dnl SXE_CHECK_TCPUDP_SOCKETS
465 AC_DEFUN([SXE_CHECK_SYSVIPC_MESSAGES], [dnl
466 ## defines have_sysvipc and HAVE_SYSVIPC
467 have_sysvipc="uncertain"
469 SXE_CHECK_HEADERS([sys/ipc.h sys/msg.h])
470 AC_CHECK_FUNCS([msgget])
472 ## evaluating the results
473 if test "$ac_cv_func_msgget" = "yes" -a \
474 "$ac_cv_header_sys_ipc_h" = "yes" -o \
475 "$ac_cv_func_msgget" = "yes" -a \
476 "$ac_cv_header_sys_msg_h" = "yes"; then
481 ])dnl SXE_CHECK_SYSVIPC_MESSAGES
483 AC_DEFUN([SXE_CHECK_MULTICAST], [dnl
484 ## defines have_multicast and HAVE_MULTICAST
485 have_multicast="uncertain"
487 AC_CHECK_TYPE([struct ip_mreq], [], [], [
488 #ifdef HAVE_SYS_TYPES_H
489 # include <sys/types.h>
491 #ifdef HAVE_NETINET_IN_H
492 # include <netinet/in.h>
496 ## evaluating the results
499 if test "$ac_cv_type_struct_ip_mreq" = "yes"; then
504 ])dnl SXE_CHECK_MULTICAST
506 AC_DEFUN([SXE_CHECK_SOCKETS], [dnl
507 AC_DEFUN([SXE_CHECK_SOCKETS], [])
509 dnl Check for Internet sockets.
510 SXE_CHECK_HEADERS([sys/types.h sys/socket.h])
513 ## check for Unix98 socklen_t
517 SXE_CHECK_UNIX_DOMAIN_SOCKETS
518 SXE_CHECK_TCPUDP_SOCKETS
519 SXE_CHECK_SYSVIPC_MESSAGES
521 ])dnl SXE_CHECK_SOCKETS
523 dnl This isn't all that clever, it doesn't really properly test if
524 dnl -lbind is needed, just if it is present and defines inet_ntoa().
525 dnl There is also nothing preventing `-lbind' being added to $LDFLAGS
526 dnl _every_ time this macro is called. For the moment, it is only called
527 dnl once, so `-lbind' is only added once (or less) --SY.
530 AC_DEFUN([SXE_CHECK_INET_FUNS], [dnl
531 ## checks for various inet_footobar functions
532 ## if only defined in libbind, add that to LDFLAGS
533 ## defines sxe_cv_feat_inet_funs which can be 'native, 'libbind or 'no
535 ## check the preferred variant first
536 AC_REQUIRE([SXE_CHECK_LIBBIND_INET_FUNS])
537 ## just check for the native crap
538 AC_REQUIRE([SXE_CHECK_NATIVE_INET_FUNS])
540 AC_CACHE_CHECK([which set of inet_*() functions to use],
541 [sxe_cv_feat_inet_funs], [_SXE_CHECK_INET_FUNS])
542 ])dnl SXE_CHECK_INET_FUNS
544 AC_DEFUN([_SXE_CHECK_INET_FUNS], [dnl
545 ## defines sxe_cv_feat_inet_funs, will be 'native, 'libbind or 'no
547 ## check the preferred variant first
548 AC_REQUIRE([SXE_CHECK_LIBBIND_INET_FUNS])
549 ## just check for the native crap
550 AC_REQUIRE([SXE_CHECK_NATIVE_INET_FUNS])
552 if test "$sxe_cv_feat_libbind_inet_funs" = "yes" -a \
553 "$with_libbind" != "no"; then
554 ## if libbind provides them all, just use them
555 sxe_cv_feat_inet_funs="libbind"
556 ## append the thing w/o messages
557 LDFLAGS="${LDFLAGS} ${bind_ldflags} ${bind_libs}"
558 CPPFLAGS="${CPPFLAGS} ${bind_cppflags}"
559 elif test "$sxe_cv_feat_libbind_inet_funs" = "yes" -a \
560 "$sxe_cv_feat_native_inet_funs" = "yes"; then
561 ## user obviously rather dispenses with libbind,
562 ## give them native bind funs
563 sxe_cv_feat_inet_funs="native"
564 elif test "$sxe_cv_feat_native_inet_funs" = "yes"; then
565 ## next hop is using the native inet_*() funs
566 sxe_cv_feat_inet_funs="native"
568 ## go with no inet_*() funs at all
569 sxe_cv_feat_inet_funs=""
570 AC_MSG_RESULT([none])
571 ## I feel we should spew a warning here
573 You seem to have no internet address conversion functions.
574 That is, to be honest, utterly unusual and you will face a lot of
575 inconsistencies in many elisp packages because of that.
577 However, we do not judge your system nor undermine your authority
578 thereof and whence continue the build.
580 In case this is a misdetection consider setting your CPPFLAGS and
581 LDFLAGS, having them point to your libbind installation.
582 In case you don't know what we are talking about or you are on a
583 miserably feature-lacking system, consider
585 and downloading the latest version of bind.])
587 ])dnl SXE_CHECK_INET_FUNS
589 AC_DEFUN([SXE_CHECK_NATIVE_INET_FUNS], [dnl
590 ## defines sxe_cv_feat_native_inet_funs, will be 'yes or 'no
592 ## check for the corresponding headers
593 AC_CHECK_HEADERS([netdb.h arpa/inet.h])
594 AC_CHECK_HEADERS([net/route.h resolv.h])
597 AC_CHECK_FUNCS([inet_ntoa inet_aton])
598 AC_CHECK_FUNCS([inet_ntop inet_pton])
599 ## oops, seems the following two have disappeared all of a sudden
600 dnl AC_CHECK_FUNCS([inet_ntop4 inet_pton4])
602 ## for network/host fiddling also check these
603 AC_CHECK_FUNCS([inet_addr inet_network])
604 AC_CHECK_FUNCS([inet_makeaddr])
605 AC_CHECK_FUNCS([inet_lnaof inet_netof])
608 AC_MSG_CHECKING([whether inet_*() are provided natively])
609 if test "$ac_cv_func_inet_ntoa" = "yes" -a \
610 "$ac_cv_func_inet_aton" = "yes" -a \
611 "$ac_cv_func_inet_ntop" = "yes" -a \
612 "$ac_cv_func_inet_pton" = "yes" -a \
613 "$ac_cv_func_inet_addr" = "yes" -a \
614 "$ac_cv_func_inet_network" = "yes"; then
615 ## in future versions we may require lnaof() as well as netof()
616 ## but at the moment we are fine with the above stuff
617 sxe_cv_feat_native_inet_funs="yes"
619 sxe_cv_feat_native_inet_funs="no"
621 AC_MSG_RESULT([$sxe_cv_feat_native_inet_funs])
622 ])dnl SXE_CHECK_NATIVE_INET_FUNS
624 AC_DEFUN([SXE_CHECK_LIBBIND_INET_FUNS], [dnl
625 ## defines sxe_cv_feat_libbind_inet_funs, will be 'yes or 'no
626 ## key question here is still how our ipv6 support concept looks like
627 ## of course it is an established thing today, but since other big
628 ## players, like isc's bind, socks, etc. can still be configured
629 ## without ipv6, and moreover, their ipv6 design may change any second
630 ## the wisest thing for us (we're just an app raping them) is to have
631 ## a switch --with-ipv6-support or the like
632 ## coherently, all the checks below would have to reflect at least the
633 ## following scenarios
634 ## - user/system knows a fuckall about v6 (and hence doesnt want it)
635 ## - user/system is aware of v6, but user wants SXE to be v4-only
636 ## - user/system is aware of v6 and SXE is meant to support it too
638 AC_ARG_WITH([libbind], AS_HELP_STRING([--with-libbind], [
639 if applicable prefer libbind socket functions over libc's,
640 Default: Autodetect]),
641 [with_libbind="${withval}"], [with_libbind="yes"])
643 ## check for isc's isc-config.sh
644 SXE_SEARCH_CONFIG_PROG([isc-config.sh])
646 ## we should check headers too, no?
647 if test "$have_isc_config_sh" = "no" -o -z "$ISC_CONFIG_SH"; then
652 ## now this is a nice question
653 ## ISC has recently(?) determined it would be better for
654 ## us developers NOT to be able to obtain the installation
656 ## Clap. Clap. Clap. <- This is for you, ISC guys, great work!
658 ## grrrrrr, as for cppflags we just bang isc-config.sh --cflags
659 ## and also isc-config.sh --cflags/bind and moreover, as
660 ## case "$includedir" in
661 ## '${prefix}/include')
662 ## includedir='${prefix}/bind/include'
667 ## libdir='${prefix}/bind/lib'
670 ## this is undocumented, don't abuse it ;)
672 bind_cppflags="${BIND_CPPFLAGS} $(${ISC_CONFIG_SH} --cflags)"
673 ## the next one just if existent
674 if test -d "$(${ISC_CONFIG_SH} --prefix)/bind/include"; then
675 bind_cppflags="${bind_cppflags} \
676 -I$(${ISC_CONFIG_SH} --prefix)/bind/include"
679 ## this is undocumented, don't abuse it ;)
681 bind_ldflags="${BIND_LDFLAGS} $(${ISC_CONFIG_SH} --libs)"
682 ## the next one just if existent
683 if test -d "$(${ISC_CONFIG_SH} --prefix)/bind/lib"; then
684 bind_ldflags="${bind_ldflags} \
685 -L$(${ISC_CONFIG_SH} --prefix)/bind/lib"
687 ## well, we just use "-lbind" now, let's see what the ISC crew
688 ## deems necessary next ... *sigh*
693 CPPFLAGS="${CPPFLAGS} ${bind_cppflags}"
694 AC_CHECK_HEADERS([netdb.h arpa/inet.h])
695 ## normally the next one is quite important, since the isc has its
696 ## routing stuff somewhere else which would otherwise conflict with
697 ## libc's route.h ... however, something's wrong here, and we don't
698 ## know yet what's going on, so chuck it
699 dnl AC_CHECK_HEADERS([net/route.h])
704 LDFLAGS="${LDFLAGS} ${bind_ldflags}"
705 SXE_CHECK_LIB_FUNCS([bind], [inet_ntoa inet_aton])
706 SXE_CHECK_LIB_FUNCS([bind], [inet_ntop inet_pton])
707 ## oops, seems the following two have disappeared all of a sudden
708 dnl SXE_CHECK_LIB_FUNCS([bind], [inet_ntop4 inet_pton4])
709 ## for network/host fiddling also check these
710 SXE_CHECK_LIB_FUNCS([bind], [inet_addr inet_network])
711 SXE_CHECK_LIB_FUNCS([bind], [inet_makeaddr])
712 SXE_CHECK_LIB_FUNCS([bind], [inet_lnaof inet_netof])
716 AC_MSG_CHECKING([whether inet_*() are provided by libbind])
717 if test "$ac_cv_lib_bind___inet_ntoa" = "yes" -a \
718 "$ac_cv_lib_bind___inet_aton" = "yes" -a \
719 "$ac_cv_lib_bind___inet_ntop" = "yes" -a \
720 "$ac_cv_lib_bind___inet_pton" = "yes" -a \
721 "$ac_cv_lib_bind___inet_addr" = "yes" -a \
722 "$ac_cv_lib_bind___inet_network" = "yes"; then
723 ## in future versions we may require lnaof() as well as netof()
724 ## but at the moment we are fine with the above stuff
725 sxe_cv_feat_libbind_inet_funs="yes"
727 sxe_cv_feat_libbind_inet_funs="no"
729 AC_MSG_RESULT([$sxe_cv_feat_libbind_inet_funs])
730 ])dnl SXE_CHECK_LIBBIND_INET_FUNS
732 dnl sxe-sockets.m4 ends here