INN commit: trunk (4 files)

INN Commit Russ_Allbery at isc.org
Sat Jan 31 19:04:59 UTC 2009


    Date: Saturday, January 31, 2009 @ 11:04:59
  Author: iulius
Revision: 8310

Make use of the AI_ADDRCONFIG flag conditional (some systems
like BSD/OS do not support it properly).

Added:
  trunk/m4/getaddrinfo.m4
Modified:
  trunk/MANIFEST
  trunk/configure.ac
  trunk/include/portable/socket.h

---------------------------+
 MANIFEST                  |    1 +
 configure.ac              |    2 ++
 include/portable/socket.h |    7 +++++++
 m4/getaddrinfo.m4         |   41 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 51 insertions(+)

Modified: MANIFEST
===================================================================
--- MANIFEST	2009-01-31 12:40:53 UTC (rev 8309)
+++ MANIFEST	2009-01-31 19:04:59 UTC (rev 8310)
@@ -564,6 +564,7 @@
 m4/cc-c-o.m4                          Autoconf macro for -c -o compiler support
 m4/cc-flags.m4                        Autoconf macro for compiler flags
 m4/compress.m4                        Autoconf macro for compress detection
+m4/getaddrinfo.m4                     Autoconf macro to check getaddrinfo support
 m4/inet-ntoa.m4                       Autoconf macro to check inet_ntoa
 m4/int32.m4                           Autoconf macro for int32_t
 m4/iov-max.m4                         Autoconf macro for IOV_MAX

Modified: configure.ac
===================================================================
--- configure.ac	2009-01-31 12:40:53 UTC (rev 8309)
+++ configure.ac	2009-01-31 19:04:59 UTC (rev 8310)
@@ -37,6 +37,7 @@
 m4_include([m4/cc-c-o.m4])
 m4_include([m4/cc-flags.m4])
 m4_include([m4/compress.m4])
+m4_include([m4/getaddrinfo.m4])
 m4_include([m4/inet-ntoa.m4])
 m4_include([m4/int32.m4])
 m4_include([m4/iov-max.m4])
@@ -471,6 +472,7 @@
 dnl Checks for library functions.
 AC_FUNC_ALLOCA
 AC_FUNC_MEMCMP
+INN_FUNC_GETADDRINFO_ADDRCONFIG
 INN_FUNC_INET_NTOA
 INN_FUNC_SNPRINTF
 

Modified: include/portable/socket.h
===================================================================
--- include/portable/socket.h	2009-01-31 12:40:53 UTC (rev 8309)
+++ include/portable/socket.h	2009-01-31 19:04:59 UTC (rev 8310)
@@ -131,6 +131,13 @@
 # define NETDB_INTERNAL -1
 #endif
 
+/* AI_ADDRCONFIG results in an error from getaddrinfo on BSD/OS and
+   possibly other platforms.  If configure determined it didn't work,
+   pretend it doesn't exist. */
+#if !defined(HAVE_GETADDRINFO_ADDRCONFIG) && defined(AI_ADDRCONFIG)
+# undef AI_ADDRCONFIG
+#endif
+
 /* POSIX requires AI_ADDRCONFIG and AI_NUMERICSERV, but some implementations
    don't have them yet.  It's only used in a bitwise OR of flags, so defining
    them to 0 makes them harmlessly go away. */

Added: m4/getaddrinfo.m4
===================================================================
--- m4/getaddrinfo.m4	                        (rev 0)
+++ m4/getaddrinfo.m4	2009-01-31 19:04:59 UTC (rev 8310)
@@ -0,0 +1,41 @@
+dnl getaddrinfo.m4 -- Check for working getaddrinfo flags.
+dnl $Id$
+dnl
+dnl Check whether the AI_ADDRCONFIG flag is present and working
+dnl with getaddrinfo.
+dnl Provides INN_FUNC_GETADDRINFO_ADDRCONFIG and defines
+dnl HAVE_GETADDRINFO_ADDRCONFIG if AI_ADDRCONFIG works.
+
+dnl Source used by INN_FUNC_GETADDRINFO_ADDRCONFIG.
+define([_INN_FUNC_GETADDRINFO_ADDRCONFIG_SOURCE],
+[#include <netdb.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#if STDC_HEADERS || HAVE_STRING_H
+# include <string.h>
+#endif
+
+int
+main(int argc, char **argv) {
+    struct addrinfo hints;
+    struct addrinfo *ai;
+
+    memset(&hints, 0, sizeof(hints));
+    hints.ai_family = AF_UNSPEC;
+    hints.ai_socktype = SOCK_STREAM;
+    hints.ai_flags = AI_ADDRCONFIG;
+    return getaddrinfo("localhost", NULL, &hints, &ai) != 0;
+}])
+
+
+dnl The public macro.
+AC_DEFUN([INN_FUNC_GETADDRINFO_ADDRCONFIG],
+[AC_CACHE_CHECK(for working AI_ADDRCONFIG, inn_cv_func_getaddrinfo_addrconfig_works,
+[AC_TRY_RUN(_INN_FUNC_GETADDRINFO_ADDRCONFIG_SOURCE(),
+    [inn_cv_func_getaddrinfo_addrconfig_works=yes],
+    [inn_cv_func_getaddrinfo_addrconfig_works=no],
+    [inn_cv_func_getaddrinfo_addrconfig_works=no])])
+if test "$inn_cv_func_getaddrinfo_addrconfig_works" = yes ; then
+    AC_DEFINE([HAVE_GETADDRINFO_ADDRCONFIG], 1,
+        [Define if your system has a working AI_ADDRCONFIG flag with getaddrinfo.])
+fi])


Property changes on: trunk/m4/getaddrinfo.m4
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native




More information about the inn-committers mailing list