1 dnl ######################################################################
2 dnl Common IPv6 detection for NTP configure.ac files
6 [for struct sockaddr_storage],
7 [ntp_cv_sockaddr_storage],
11 #ifdef HAVE_SYS_TYPES_H
12 # include <sys/types.h>
14 #ifdef HAVE_SYS_SOCKET_H
15 # include <sys/socket.h>
17 #ifdef HAVE_NETINET_IN_H
18 # include <netinet/in.h>
22 struct sockaddr_storage n;
25 [ntp_cv_sockaddr_storage=yes],
26 [ntp_cv_sockaddr_storage=no]
29 case "$ntp_cv_sockaddr_storage" in
31 AC_DEFINE([HAVE_STRUCT_SOCKADDR_STORAGE], [1],
32 [Does a system header define struct sockaddr_storage?])
34 [for sockaddr_storage.__ss_family],
35 [ntp_cv_have___ss_family],
39 #ifdef HAVE_SYS_TYPES_H
40 # include <sys/types.h>
42 #ifdef HAVE_SYS_SOCKET_H
43 # include <sys/socket.h>
45 #ifdef HAVE_NETINET_IN_H
46 # include <netinet/in.h>
50 struct sockaddr_storage s;
54 [ntp_cv_have___ss_family=yes],
55 [ntp_cv_have___ss_family=no]
58 case "$ntp_cv_have___ss_family" in
60 AC_DEFINE([HAVE___SS_FAMILY_IN_SS], [1],
61 [Does struct sockaddr_storage have __ss_family?])
64 [HAVE___SS_FAMILY_IN_SS_VERBATIM],
66 /* Handle sockaddr_storage.__ss_family */
67 #ifdef HAVE___SS_FAMILY_IN_SS
68 # define ss_family __ss_family
69 #endif /* HAVE___SS_FAMILY_IN_SS */
80 [isc_cv_have_in_port_t],
84 #include <sys/types.h>
85 #include <netinet/in.h>
92 [isc_cv_have_in_port_t=yes],
93 [isc_cv_have_in_port_t=no]
96 case "$isc_cv_have_in_port_t" in
98 AC_DEFINE([ISC_PLATFORM_NEEDPORTT], [1],
103 [type of socklen arg for getsockname()],
104 [ntp_cv_getsockname_socklen_type],
106 getsockname_socklen_type_found=no
107 for getsockname_arg2 in 'struct sockaddr *' 'void *'; do
108 for ntp_cv_getsockname_socklen_type in 'socklen_t' 'size_t' 'unsigned int' 'int'; do
112 #ifdef HAVE_SYS_TYPES_H
113 # include <sys/types.h>
115 #ifdef HAVE_SYS_SOCKET_H
116 # include <sys/socket.h>
120 getsockname(int, $getsockname_arg2,
121 $ntp_cv_getsockname_socklen_type *);
124 [getsockname_socklen_type_found=yes ; break 2],
129 case "$getsockname_socklen_type_found" in
131 ntp_cv_getsockname_socklen_type='socklen_t'
133 AS_UNSET([getsockname_arg2])
134 AS_UNSET([getsockname_socklen_type_found])
137 AC_DEFINE_UNQUOTED([GETSOCKNAME_SOCKLEN_TYPE],
138 [$ntp_cv_getsockname_socklen_type],
139 [What is getsockname()'s socklen type?])
142 [struct sockaddr for sa_len],
143 [isc_cv_platform_havesalen],
147 #include <sys/types.h>
148 #include <sys/socket.h>
151 extern struct sockaddr *ps;
155 [isc_cv_platform_havesalen=yes],
156 [isc_cv_platform_havesalen=no]
159 case "$isc_cv_platform_havesalen" in
161 AC_DEFINE([ISC_PLATFORM_HAVESALEN], [1],
162 [struct sockaddr has sa_len?])
173 case "$enable_ipv6" in
179 AC_DEFINE([WANT_IPV6], [1], [configure --enable-ipv6])
188 dnl [Bug 1984] ntp/libisc fails to compile on OS X 10.7 (Lion)
191 AC_DEFINE([__APPLE_USE_RFC_3542], [1], [Are we _special_?])
196 [for IPv6 structures],
201 #include <sys/types.h>
202 #include <sys/socket.h>
203 #include <netinet/in.h>
206 struct sockaddr_in6 sin6;
209 [isc_cv_found_ipv6=yes],
210 [isc_cv_found_ipv6=no]
215 # See whether IPv6 support is provided via a Kame add-on.
216 # This is done before other IPv6 linking tests so LIBS is properly set.
218 AC_MSG_CHECKING([for Kame IPv6 support])
225 [use_kame="$withval"],
232 kame_path=/usr/local/v6
235 kame_path="$use_kame"
243 if test -f $kame_path/lib/libinet6.a; then
244 AC_MSG_RESULT([$kame_path/lib/libinet6.a])
245 LIBS="-L$kame_path/lib -linet6 $LIBS"
247 AC_MSG_ERROR([$kame_path/lib/libinet6.a not found.
249 Please choose the proper path with the following command:
251 configure --with-kame=PATH
258 # Whether netinet6/in6.h is needed has to be defined in isc/platform.h.
259 # Including it on Kame-using platforms is very bad, though, because
260 # Kame uses #error against direct inclusion. So include it on only
261 # the platform that is otherwise broken without it -- BSD/OS 4.0 through 4.1.
262 # This is done before the in6_pktinfo check because that's what
263 # netinet6/in6.h is needed for.
267 AC_DEFINE([ISC_PLATFORM_NEEDNETINET6IN6H], [1],
268 [Do we need netinet6/in6.h?])
269 isc_netinet6in6_hack="#include <netinet6/in6.h>"
272 isc_netinet6in6_hack=""
277 # This is similar to the netinet6/in6.h issue.
280 *-sco-sysv*uw*|*-*-sysv*UnixWare*|*-*-sysv*OpenUNIX*)
281 AC_DEFINE([ISC_PLATFORM_FIXIN6ISADDR], [1],
282 [Do we need to fix in6isaddr?])
283 isc_netinetin6_hack="#include <netinet/in6.h>"
286 isc_netinetin6_hack=""
291 case "$isc_cv_found_ipv6" in
293 AC_DEFINE([ISC_PLATFORM_HAVEIPV6], [1], [have IPv6?])
296 [isc_cv_have_in6_pktinfo],
300 #include <sys/types.h>
301 #include <sys/socket.h>
302 #include <netinet/in.h>
304 $isc_netinet6in6_hack
307 struct in6_pktinfo xyzzy;
310 [isc_cv_have_in6_pktinfo=yes],
311 [isc_cv_have_in6_pktinfo=no]
314 case "$isc_cv_have_in6_pktinfo" in
316 AC_DEFINE([ISC_PLATFORM_HAVEIN6PKTINFO], [1],
317 [have struct in6_pktinfo?])
321 # HMS: Use HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID instead?
323 [for sockaddr_in6.sin6_scope_id],
324 [isc_cv_have_sin6_scope_id],
328 #include <sys/types.h>
329 #include <sys/socket.h>
330 #include <netinet/in.h>
332 $isc_netinet6in6_hack
335 struct sockaddr_in6 xyzzy;
336 xyzzy.sin6_scope_id = 0;
339 [isc_cv_have_sin6_scope_id=yes],
340 [isc_cv_have_sin6_scope_id=no]
344 case "$isc_cv_have_sin6_scope_id" in
346 AC_DEFINE([ISC_PLATFORM_HAVESCOPEID], [1], [sin6_scope_id?])
351 # We need this check run even without isc_cv_found_ipv6=yes
355 [isc_cv_in6addr_any_links],
358 LIBS="$LDADD_LIBNTP $LIBS"
361 AC_INCLUDES_DEFAULT [[
362 #include <sys/socket.h>
363 #include <netinet/in.h>
365 $isc_netinet6in6_hack
368 printf("%x", in6addr_any.s6_addr[15]);
371 [isc_cv_in6addr_any_links=yes],
372 [isc_cv_in6addr_any_links=no]
375 AS_UNSET([SAVED_LIBS])
379 case "$isc_cv_in6addr_any_links" in
381 AC_DEFINE([ISC_PLATFORM_NEEDIN6ADDRANY], [1], [missing in6addr_any?])
386 [for struct if_laddrconf],
387 [isc_cv_struct_if_laddrconf],
391 #include <sys/types.h>
395 struct if_laddrconf a;
398 [isc_cv_struct_if_laddrconf=yes],
399 [isc_cv_struct_if_laddrconf=no]
403 case "$isc_cv_struct_if_laddrconf" in
405 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRCONF], [1],
406 [have struct if_laddrconf?])
410 [for struct if_laddrreq],
411 isc_cv_struct_if_laddrreq,
415 #include <sys/types.h>
419 struct if_laddrreq a;
422 [isc_cv_struct_if_laddrreq=yes],
423 [isc_cv_struct_if_laddrreq=no]
427 case "$isc_cv_struct_if_laddrreq" in
429 AC_DEFINE([ISC_PLATFORM_HAVEIF_LADDRREQ], [1],
430 [have struct if_laddrreq?])
434 [for multicast IP support],
445 #ifdef HAVE_NETINET_IN_H
446 # include <netinet/in.h>
451 ipmr.imr_interface.s_addr = 0;
454 [ntp_cv_multicast=yes],
461 case "$ntp_cv_multicast" in
463 AC_DEFINE([MCAST], [1], [Does the target support multicast IP?])
465 [arg type needed for setsockopt() IP*_MULTICAST_LOOP],
466 [ntp_cv_typeof_ip_multicast_loop],
469 *-*-netbsd*|*-*-*linux*)
470 ntp_cv_typeof_ip_multicast_loop=u_int
473 ntp_cv_typeof_ip_multicast_loop=u_char
478 AC_DEFINE_UNQUOTED([TYPEOF_IP_MULTICAST_LOOP],
479 [$ntp_cv_typeof_ip_multicast_loop],
480 [What type to use for setsockopt])
486 [--enable-getifaddrs],
487 [+ Enable the use of getifaddrs() [[yes|no]].]
489 [want_getifaddrs="$enableval"],
490 [want_getifaddrs="yes"]
493 case $want_getifaddrs in
495 AC_MSG_WARN([--enable-getifaddrs=glibc is no longer required])
497 case $want_getifaddrs in
502 LIBS="$LDADD_LIBNTP $LIBS"
503 AC_CHECK_FUNCS([getifaddrs])
505 AS_UNSET([SAVED_LIBS])
510 # Check for if_nametoindex() for IPv6 scoped addresses support
514 AC_SEARCH_LIBS([if_nametoindex], [ipv6])
517 LIBS="$LDADD_LIBNTP $LIBS"
518 AC_CHECK_FUNCS([if_nametoindex])
520 AS_UNSET([SAVED_LIBS])
521 case "$ac_cv_func_if_nametoindex" in
523 AC_DEFINE([ISC_PLATFORM_HAVEIFNAMETOINDEX], [1],
524 [ISC: do we have if_nametoindex()?])
528 dnl ======================================================================