Re: [PATCH 4/4] Don't link with libsocket in MINGW port

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 4/4] Don't link with libsocket in MINGW port

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:43:13

"Nguyá»
n Thái Ngọc Duy" wrote:
From: Nguyá»
n Thái Ngọc Duy [off-list ref]
There is a check in configure.ac to determine if libc has function
socket(). It is used to link with libsocket on SunOS.

On Windows, libc does not have socket() as well but it is provided
by winsock, not libsocket. So don't link with libsocket if you are
on Windows.
 ifdef NEEDS_SOCKET
+ifndef MINGW
        EXTLIBS += -lsocket
 endif
+endif
This looks wrong. NEEDS_SOCKET is set in the architecture sections of
Makefile where necessary, but the MinGW section doesn't want it and
doesn't set it. If ./configure sets it, then you should fix
configure.ac, not work around in Makefile.

-- Hannes

PS: Appologies for the mangled name - this MUA is from the stone age.

Re: [PATCH 4/4] Don't link with libsocket in MINGW port

From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:43:13

On 5/30/07, Johannes Sixt [off-list ref] wrote:
This looks wrong. NEEDS_SOCKET is set in the architecture sections of
Makefile where necessary, but the MinGW section doesn't want it and
doesn't set it. If ./configure sets it, then you should fix
configure.ac, not work around in Makefile.
I did so because I didn't have SunOS to test so I'd rather not touch
the code detecting NEEDS_SOCKET in configure.ac. How about this patch:
diff --git a/configure.ac b/configure.ac
index 4a12cb0..0516fdb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -173,6 +173,12 @@ test -n "$NEEDS_LIBICONV" && LIBS="$LIBS -liconv"
 AC_CHECK_LIB([c], [socket],
 [NEEDS_SOCKET=],
 [NEEDS_SOCKET=YesPlease])
+if test "$NEEDS_SOCKET" = YesPlease; then # more check
+	AC_CHECK_LIB([socket], [socket],
+	[LIBSOCKET_HAS_SOCKET=],
+	[LIBSOCKET_HAS_SOCKET=1])
+	test -n "$LIBSOCKET_HAS_SOCKET" && NEEDS_SOCKET=
+fi
 AC_SUBST(NEEDS_SOCKET)
 test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
If someone has a SunOS, please test the above patch. Thanks
-- 
Duy
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help