diff --git a/configure b/configure index 3ea2be40dd79b879b68e9512dfcda5ff21802485..9467473a0cf52fde7c280f20d24a4a74ada7281f 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.332 . +# From configure.in Revision: 1.333 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53. # @@ -13206,6 +13206,156 @@ _ACEOF ;; esac +# +# Check for if_nametoindex() for IPv6 scoped addresses support +# +echo "$as_me:$LINENO: checking for if_nametoindex" >&5 +echo $ECHO_N "checking for if_nametoindex... $ECHO_C" >&6 +if test "${ac_cv_func_if_nametoindex+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char if_nametoindex (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char if_nametoindex (); +char (*f) (); + +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_if_nametoindex) || defined (__stub___if_nametoindex) +choke me +#else +f = if_nametoindex; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_if_nametoindex=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_if_nametoindex=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_if_nametoindex" >&5 +echo "${ECHO_T}$ac_cv_func_if_nametoindex" >&6 +if test $ac_cv_func_if_nametoindex = yes; then + ac_cv_have_if_nametoindex=yes +else + ac_cv_have_if_nametoindex=no +fi + +case $ac_cv_have_if_nametoindex in +no) + case "$host" in + *-hp-hpux*) + echo "$as_me:$LINENO: checking for if_nametoindex in -lipv6" >&5 +echo $ECHO_N "checking for if_nametoindex in -lipv6... $ECHO_C" >&6 +if test "${ac_cv_lib_ipv6_if_nametoindex+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lipv6 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line $LINENO "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char if_nametoindex (); +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +int +main () +{ +if_nametoindex (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ipv6_if_nametoindex=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_ipv6_if_nametoindex=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ipv6_if_nametoindex" >&5 +echo "${ECHO_T}$ac_cv_lib_ipv6_if_nametoindex" >&6 +if test $ac_cv_lib_ipv6_if_nametoindex = yes; then + ac_cv_have_if_nametoindex=yes + LIBS="-lipv6 $LIBS" +fi + + ;; + esac +esac +case $ac_cv_have_if_nametoindex in +yes) + ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1" + ;; +*) + ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX" + ;; +esac + + # # The following sections deal with tools used for formatting # the documentation. They are all optional, unless you are @@ -14360,6 +14510,7 @@ s,@ISC_PLATFORM_RLIMITTYPE@,$ISC_PLATFORM_RLIMITTYPE,;t t s,@ISC_PLATFORM_USEDECLSPEC@,$ISC_PLATFORM_USEDECLSPEC,;t t s,@LWRES_PLATFORM_USEDECLSPEC@,$LWRES_PLATFORM_USEDECLSPEC,;t t s,@ISC_PLATFORM_BRACEPTHREADONCEINIT@,$ISC_PLATFORM_BRACEPTHREADONCEINIT,;t t +s,@ISC_PLATFORM_HAVEIFNAMETOINDEX@,$ISC_PLATFORM_HAVEIFNAMETOINDEX,;t t s,@OPENJADE@,$OPENJADE,;t t s,@JADETEX@,$JADETEX,;t t s,@PDFJADETEX@,$PDFJADETEX,;t t diff --git a/configure.in b/configure.in index 58e153d28dae68ac6cd8975450a2713c86c716f6..917953a4953d1e476585da19eede84ec6ced8ca3 100644 --- a/configure.in +++ b/configure.in @@ -18,7 +18,7 @@ AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl esyscmd([sed "s/^/# /" COPYRIGHT])dnl AC_DIVERT_POP()dnl -AC_REVISION($Revision: 1.332 $) +AC_REVISION($Revision: 1.333 $) AC_INIT(lib/dns/name.c) AC_PREREQ(2.13) @@ -1690,6 +1690,31 @@ case "$hack_shutup_stdargcast" in ;; esac +# +# Check for if_nametoindex() for IPv6 scoped addresses support +# +AC_CHECK_FUNC(if_nametoindex, ac_cv_have_if_nametoindex=yes, + ac_cv_have_if_nametoindex=no) +case $ac_cv_have_if_nametoindex in +no) + case "$host" in + *-hp-hpux*) + AC_CHECK_LIB(ipv6, if_nametoindex, + ac_cv_have_if_nametoindex=yes + LIBS="-lipv6 $LIBS",) + ;; + esac +esac +case $ac_cv_have_if_nametoindex in +yes) + ISC_PLATFORM_HAVEIFNAMETOINDEX="#define ISC_PLATFORM_HAVEIFNAMETOINDEX 1" + ;; +*) + ISC_PLATFORM_HAVEIFNAMETOINDEX="#undef ISC_PLATFORM_HAVEIFNAMETOINDEX" + ;; +esac +AC_SUBST(ISC_PLATFORM_HAVEIFNAMETOINDEX) + # # The following sections deal with tools used for formatting # the documentation. They are all optional, unless you are diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index bdf619b6202b23c93b683fe7ca5f07d99f0900a2..cfaa3c1b53c5ff61a68b0da388884d63f627019e 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: platform.h.in,v 1.29 2002/10/24 03:52:34 marka Exp $ */ +/* $Id: platform.h.in,v 1.30 2002/11/26 03:50:07 marka Exp $ */ #ifndef ISC_PLATFORM_H #define ISC_PLATFORM_H 1 @@ -180,6 +180,11 @@ */ @ISC_PLATFORM_USEDECLSPEC@ +/* + * Define if the system supports if_nametoindex. + */ +@ISC_PLATFORM_HAVEIFNAMETOINDEX@ + #ifndef ISC_PLATFORM_USEDECLSPEC #define LIBISC_EXTERNAL_DATA #define LIBDNS_EXTERNAL_DATA diff --git a/lib/isc/netscope.c b/lib/isc/netscope.c index edd9b97d3219b542a65f702953dcf1a3ad269468..df97706e687b1729db899f1a37256fec62cf5fe3 100644 --- a/lib/isc/netscope.c +++ b/lib/isc/netscope.c @@ -17,7 +17,7 @@ #if defined(LIBC_SCCS) && !defined(lint) static char rcsid[] = - "$Id: netscope.c,v 1.3 2002/10/28 02:23:53 marka Exp $"; + "$Id: netscope.c,v 1.4 2002/11/26 03:50:07 marka Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -47,10 +47,12 @@ isc_netscope_pton(int af, char *scopename, char *addr, isc_uint32_t *zoneid) { * interface names as link names, assuming one to one mapping between * interfaces and links. */ +#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX if (IN6_IS_ADDR_LINKLOCAL(in6) && (ifid = if_nametoindex((const char *)scopename)) != 0) zone = (isc_uint32_t)ifid; else { +#endif llz = isc_string_touint64(scopename, &ep, 10); if (ep == scopename) return (ISC_R_FAILURE); @@ -59,7 +61,9 @@ isc_netscope_pton(int af, char *scopename, char *addr, isc_uint32_t *zoneid) { zone = (isc_uint32_t)(llz & 0xffffffffUL); if (zone != llz) return (ISC_R_FAILURE); +#ifdef ISC_PLATFORM_HAVEIFNAMETOINDEX } +#endif *zoneid = zone; return (ISC_R_SUCCESS);