[1/3] sim: unify various library testing logic

Message ID 20210618142754.21722-1-vapier@gentoo.org
State New
Headers show
Series
  • [1/3] sim: unify various library testing logic
Related show

Commit Message

Eli Zaretskii via Gdb-patches June 18, 2021, 2:27 p.m.
Move these options up to the common dir so we only test & export
them once across all ports.
---
 sim/aarch64/configure            | 143 +----------------------
 sim/arch-subdir.mk.in            |   1 +
 sim/arm/configure                | 143 +----------------------
 sim/avr/configure                | 143 +----------------------
 sim/bfin/configure               | 143 +----------------------
 sim/bpf/configure                | 143 +----------------------
 sim/common/Make-common.in        |   2 +-
 sim/config.h.in                  |   9 ++
 sim/configure                    | 181 +++++++++++++++++++++++++++++
 sim/cr16/configure               | 143 +----------------------
 sim/cris/configure               | 143 +----------------------
 sim/d10v/configure               | 143 +----------------------
 sim/erc32/configure              | 143 +----------------------
 sim/example-synacor/configure    | 143 +----------------------
 sim/frv/configure                | 143 +----------------------
 sim/ft32/configure               | 143 +----------------------
 sim/h8300/configure              | 143 +----------------------
 sim/iq2000/configure             | 143 +----------------------
 sim/lm32/configure               | 143 +----------------------
 sim/m32c/configure               | 143 +----------------------
 sim/m32r/configure               | 143 +----------------------
 sim/m4/sim_ac_common.m4          |   4 -
 sim/m4/sim_ac_option_hardware.m4 |   4 -
 sim/m4/sim_ac_platform.m4        |   6 +
 sim/m68hc11/configure            | 143 +----------------------
 sim/mcore/configure              | 143 +----------------------
 sim/microblaze/configure         | 143 +----------------------
 sim/mips/configure               | 189 +------------------------------
 sim/mips/configure.ac            |   2 -
 sim/mn10300/configure            | 143 +----------------------
 sim/moxie/configure              | 143 +----------------------
 sim/msp430/configure             | 143 +----------------------
 sim/or1k/configure               | 143 +----------------------
 sim/pru/configure                | 143 +----------------------
 sim/riscv/configure              | 143 +----------------------
 sim/rl78/configure               | 143 +----------------------
 sim/rx/configure                 | 143 +----------------------
 sim/sh/configure                 | 143 +----------------------
 sim/v850/configure               | 143 +----------------------
 39 files changed, 260 insertions(+), 4428 deletions(-)

-- 
2.31.1

Patch

diff --git a/sim/arch-subdir.mk.in b/sim/arch-subdir.mk.in
index 6f9d4ad3c370..bc51fcaf9778 100644
--- a/sim/arch-subdir.mk.in
+++ b/sim/arch-subdir.mk.in
@@ -17,5 +17,6 @@ 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+COMMON_LIBS = @LIBS@
 WARN_CFLAGS = @WARN_CFLAGS@
 WERROR_CFLAGS = @WERROR_CFLAGS@
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 51e4ca7b5ac7..245da2a0438f 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -249,7 +249,7 @@  BFD_LIB = ../../bfd/libbfd.a
 OPCODES_LIB = ../../opcodes/libopcodes.a
 LIBINTL = @LIBINTL@
 LIBINTL_DEP = @LIBINTL_DEP@
-CONFIG_LIBS = @LIBS@ $(ZLIB)
+CONFIG_LIBS = $(COMMON_LIBS) @LIBS@ $(ZLIB)
 LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB)
 EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \
 	$(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL) $(LIBGNU) $(LIBGNU_EXTRA_LIBS)
diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index 088e0977f4f3..f44e43695703 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -32,10 +32,6 @@  dnl to see if there are intl libraries we should link against.
 ALL_LINGUAS=
 ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
 
-# Check for socket libraries
-AC_CHECK_LIB(socket, bind)
-AC_CHECK_LIB(nsl, gethostbyname)
-
 # BFD conditionally uses zlib, so we must link it in if libbfd does, by
 # using the same condition.
 AM_ZLIB
diff --git a/sim/m4/sim_ac_option_hardware.m4 b/sim/m4/sim_ac_option_hardware.m4
index 22fa993f6a36..477ab2669093 100644
--- a/sim/m4/sim_ac_option_hardware.m4
+++ b/sim/m4/sim_ac_option_hardware.m4
@@ -61,10 +61,6 @@  else
   if test x"$silent" != x"yes"; then
     echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
   fi
-  dnl Some devices require extra libraries.
-  case " $hardware " in
-    *" cfi "*) AC_CHECK_LIB(m, log2);;
-  esac
 fi
 ])
 AC_SUBST(sim_hw_cflags)
diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4
index c505c74e7af4..d2e1d360b4f5 100644
--- a/sim/m4/sim_ac_platform.m4
+++ b/sim/m4/sim_ac_platform.m4
@@ -141,4 +141,10 @@  AC_TYPE_PID_T
 AC_TYPE_SIGNAL
 AC_TYPE_SIZE_T
 AC_TYPE_UID_T
+
+dnl Libraries.
+AC_CHECK_LIB(socket, bind)
+AC_CHECK_LIB(nsl, gethostbyname)
+AC_CHECK_LIB(m, fabs)
+AC_CHECK_LIB(m, log2)
 ])
diff --git a/sim/mips/configure.ac b/sim/mips/configure.ac
index 88f06ee13c91..d7c402063954 100644
--- a/sim/mips/configure.ac
+++ b/sim/mips/configure.ac
@@ -410,6 +410,4 @@  SIM_AC_OPTION_HARDWARE(tx3904cpu tx3904irc tx3904tmr tx3904sio)
 
 AC_PATH_X
 
-AC_CHECK_LIB(m, fabs)
-
 SIM_AC_OUTPUT