Thread (3 messages) 3 messages, 2 authors, 2020-02-14

Re: Fix inet_ntop and inet_pton on Solaris

From: Jeff King <hidden>
Date: 2020-02-14 06:50:43

On Mon, Feb 03, 2020 at 10:22:46AM -0500, Jeffrey Walton wrote:
inet_ntop and inet_pton were not being detected properly on modern on
Solaris. This patch revisits the the socket gear configuration on
SunOS and brings it up to date for Solaris 11.

According to configure.ac, the three or four functions of interest
include hstrerror, inet_ntop and inet_pton. The libraries of interest
are -lresolv -lsocket -lnsl. The configure tests now look for
inet_ntop and inet_pton in -lsocket -lnsl per the man page. If not
found, the configure tests fall back to existing behavior by searching
in -lresolv. And if not found in -lresolv, then NO_INET_NTOP and
NO_INET_PTON are set.
This makes sense, and the patch looks plausibly correct (which is the
best I can say given my general lack of autoconf knowledge).

I was a little surprised by this hunk:
quoted hunk ↗ jump to hunk
diff --git a/Makefile b/Makefile
index 09f98b777c..7166b19ab4 100644
--- a/Makefile
+++ b/Makefile
@@ -1461,15 +1461,15 @@ ifndef LIBC_CONTAINS_LIBINTL
 	EXTLIBS += -lintl
 endif
 endif
+ifdef NEEDS_RESOLV
+	EXTLIBS += -lresolv
+endif
 ifdef NEEDS_SOCKET
 	EXTLIBS += -lsocket
 endif
 ifdef NEEDS_NSL
 	EXTLIBS += -lnsl
 endif
-ifdef NEEDS_RESOLV
-	EXTLIBS += -lresolv
-endif
But I guess it is trying to mimic the "-lresolv -lsocket -lnsl" order
you mentioned in the Solaris manpage. You should be able to test if
that's necessary by compiling with:

  make NEEDS_RESOLV=Yes NEEDS_SOCKET=Yes NEEDS_NSL=Yes

If so, that ordering switch could probably happen as a separate commit
before the configure.ac change.
quoted hunk ↗ jump to hunk
diff --git a/configure.ac b/configure.ac
index 66aedb9288..b83a0e970d 100644
--- a/configure.ac
+++ b/configure.ac
The rest of it looks OK to me. Do you want to send it as a regular Git
patch with a commit message and your signoff (see SubmittingPatches)?

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help