[PATCH] build: libcody: Link with -lsocket -lnsl if necessary [PR98316]

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Thu Dec 17 12:21:13 GMT 2020


With the introduction of C++20 modules and libcody, cc1plus and
cc1objplus gained a dependency on the socket functions.  Before those
were merged into libc in Solaris 11.4, one needed to link with -lsocket -lnsl
on Solaris, so that merge broke the Solaris 11.3 build.

While we already have 4 different checks for those libraries in the
tree, I decided to import autoconf-archive's AX_LIB_SOCKET_NSL macro
instead.  At the same time, the patch only links libcody and the
networking libs where needed (cc1plus, cc1objplus).

Bootstrapped without regressions on i386-pc-solaris2.11 (Solaris 11.3
and 11.4), sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.

Ok for master?


As I'd mentioned, there are 4 checks for -lsocket -lnsl already:

  gotools/configure.ac
  libcc1/configure.ac
  libgo/configure.ac
  libphobos/m4/druntime/libraries.m4

While it seems sensible to replace those as well, I don't belive this is
exactly stage 3 material.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2020-12-16  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	c++tools:
	PR c++/98316
	* configure.ac: Include ../config/ax_lib_socket_nsl.m4.
	(NETLIBS): Determine using AX_LIB_SOCKET_NSL.
	* Makefile.in (NETLIBS): Define.
	(g++-mapper-server$(exeext)): Add $(NETLIBS).

	gcc/objcp:
	PR c++/98316
	* Make-lang.in (cc1objplus$(exeext)): Add $(CODYLIB), $(NETLIBS).

	gcc/cp:
	PR c++/98316
	* Make-lang.in (cc1plus$(exeext)): Add $(CODYLIB), $(NETLIBS).

	gcc:
	PR c++/98316
	* configure.ac (NETLIBS): Determine using AX_LIB_SOCKET_NSL.
	* aclocal.m4, configure: Regenerate.
	* Makefile.in (NETLIBS): Define.
	(BACKEND): Remove $(CODYLIB).

	config:
	PR c++/98316
	* ax_lib_socket_nsl.m4: Import from autoconf-archive.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol2-libcody-lsocket.patch
Type: text/x-patch
Size: 5469 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201217/59040626/attachment.bin>


More information about the Gcc-patches mailing list