mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-24 11:24:05 +08:00
a20893cf6b
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. 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. * configure: Regenerate. * 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.
41 lines
1.4 KiB
Plaintext
41 lines
1.4 KiB
Plaintext
# ===========================================================================
|
|
# https://www.gnu.org/software/autoconf-archive/ax_lib_socket_nsl.html
|
|
# ===========================================================================
|
|
#
|
|
# SYNOPSIS
|
|
#
|
|
# AX_LIB_SOCKET_NSL
|
|
#
|
|
# DESCRIPTION
|
|
#
|
|
# This macro figures out what libraries are required on this platform to
|
|
# link sockets programs.
|
|
#
|
|
# The common cases are not to need any extra libraries, or to need
|
|
# -lsocket and -lnsl. We need to avoid linking with libnsl unless we need
|
|
# it, though, since on some OSes where it isn't necessary it will totally
|
|
# break networking. Unisys also includes gethostbyname() in libsocket but
|
|
# needs libnsl for socket().
|
|
#
|
|
# LICENSE
|
|
#
|
|
# Copyright (c) 2008 Russ Allbery <rra@stanford.edu>
|
|
# Copyright (c) 2008 Stepan Kasal <kasal@ucw.cz>
|
|
# Copyright (c) 2008 Warren Young <warren@etr-usa.com>
|
|
#
|
|
# Copying and distribution of this file, with or without modification, are
|
|
# permitted in any medium without royalty provided the copyright notice
|
|
# and this notice are preserved. This file is offered as-is, without any
|
|
# warranty.
|
|
|
|
#serial 7
|
|
|
|
AU_ALIAS([LIB_SOCKET_NSL], [AX_LIB_SOCKET_NSL])
|
|
AC_DEFUN([AX_LIB_SOCKET_NSL],
|
|
[
|
|
AC_SEARCH_LIBS([gethostbyname], [nsl])
|
|
AC_SEARCH_LIBS([socket], [socket], [], [
|
|
AC_CHECK_LIB([socket], [socket], [LIBS="-lsocket -lnsl $LIBS"],
|
|
[], [-lnsl])])
|
|
])
|