summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2005-10-01 09:49:09 +0000
committerJim Meyering <jim@meyering.net>2005-10-01 09:49:09 +0000
commit614623a6705865aef6ce4b8f5c3135d0f3d0a9b1 (patch)
tree8d6b7dbefc35ef56a51313f3c46c0159b37d53f7 /m4
parent5c8ecd28312a5e9979bb4789e623cd9db8796ede (diff)
downloadcoreutils-614623a6705865aef6ce4b8f5c3135d0f3d0a9b1.tar.xz
(gl_PREREQ_GETADDRINFO): Use AC_GNU_SOURCE,
GNU declares only getaddrinfo as an (POSIX) extension. Check for sys/types.h, sys/socket.h, and netdb.h too, needed by getaddrinfo.h. Check if getaddrinfo, freeaddrinfo and gai_strerror are declared by the POSIX headers. Check if struct addrinfo is declared.
Diffstat (limited to 'm4')
-rw-r--r--m4/getaddrinfo.m419
1 files changed, 18 insertions, 1 deletions
diff --git a/m4/getaddrinfo.m4 b/m4/getaddrinfo.m4
index 07f7896ee..f95bb1a93 100644
--- a/m4/getaddrinfo.m4
+++ b/m4/getaddrinfo.m4
@@ -18,5 +18,22 @@ AC_DEFUN([gl_PREREQ_GETADDRINFO], [
AC_REQUIRE([gl_C_RESTRICT])
AC_REQUIRE([gl_SOCKET_FAMILIES])
AC_REQUIRE([AC_C_INLINE])
- AC_CHECK_HEADERS_ONCE([netinet/in.h])
+ AC_REQUIRE([AC_GNU_SOURCE])
+ AC_CHECK_HEADERS_ONCE(sys/socket.h netdb.h sys/types.h netinet/in.h)
+ AC_CHECK_DECLS([getaddrinfo, freeaddrinfo, gai_strerror],,,[
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+# include <netdb.h>
+#endif
+])
+ AC_CHECK_TYPES([struct addrinfo],,,[
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+#ifdef HAVE_NETDB_H
+# include <netdb.h>
+#endif
+])
])