summaryrefslogtreecommitdiff
path: root/m4/inet_ntop.m4
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2009-11-15 20:16:40 +0100
committerLudovic Courtès <ludo@gnu.org>2009-11-16 09:23:46 +0100
commit8912421cf3829a4fd65877fd1255125c191f6f89 (patch)
tree6b89fecf0738a1f80792bbe7453730f7882f1d54 /m4/inet_ntop.m4
parent3fe87cf7aff396d7bd993aa009f48eb8afd6c1cd (diff)
downloadguile-8912421cf3829a4fd65877fd1255125c191f6f89.tar.gz
Use Gnulib's `inet_ntop' and `inet_pton' modules.
* m4/gnulib-cache.m4: Add `inet_ntop' and `inet_pton'. * configure.ac: Don't check for `inet_ntop' and `inet_pton'. * libguile/socket.c (scm_inet_pton, scm_inet_ntop): Compile regardless of `HAVE_INET_PTON' and `HAVE_INET_NTOP' respectively. * libguile/filesys.c: Use <stdlib.h> instead of <canonicalize.h>.
Diffstat (limited to 'm4/inet_ntop.m4')
-rw-r--r--m4/inet_ntop.m437
1 files changed, 37 insertions, 0 deletions
diff --git a/m4/inet_ntop.m4 b/m4/inet_ntop.m4
new file mode 100644
index 000000000..2bbdca108
--- /dev/null
+++ b/m4/inet_ntop.m4
@@ -0,0 +1,37 @@
+# inet_ntop.m4 serial 9
+dnl Copyright (C) 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_INET_NTOP],
+[
+ dnl Persuade Solaris <arpa/inet.h> to declare inet_ntop.
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ gl_REPLACE_ARPA_INET_H
+
+ dnl The AC_SEARCH_LIBS call is a hack to persuade the Solaris 8 linker to
+ dnl find inet_ntop.
+ dnl
+ dnl It is the responsibility of gl_INET_NTOP's caller to arrange for
+ dnl -lnsl if it is needed. Normally -lnsl is not needed on Solaris 8,
+ dnl since inet_ntop is needed only by getaddrinfo, and getaddrinfo
+ dnl isn't built on Solaris 8.
+ gl_save_LIBS=$LIBS
+ AC_SEARCH_LIBS([inet_ntop], [nsl], [],
+ [AC_REPLACE_FUNCS([inet_ntop])])
+ LIBS=$gl_save_LIBS
+
+ gl_PREREQ_INET_NTOP
+])
+
+# Prerequisites of lib/inet_ntop.c.
+AC_DEFUN([gl_PREREQ_INET_NTOP], [
+ AC_CHECK_DECLS([inet_ntop],,,[#include <arpa/inet.h>])
+ if test $ac_cv_have_decl_inet_ntop = no; then
+ HAVE_DECL_INET_NTOP=0
+ fi
+ AC_REQUIRE([gl_SOCKET_FAMILIES])
+ AC_REQUIRE([AC_C_RESTRICT])
+])