[1/3] sim: unify toolchain probing logic

Message ID 20210619050936.23617-1-vapier@gentoo.org
State New
Headers show
Series
  • [1/3] sim: unify toolchain probing logic
Related show

Commit Message

Metzger, Markus T via Gdb-patches June 19, 2021, 5:09 a.m.
Move these options up to the common dir so we only test & export
them once across all ports.
---
 sim/aarch64/aclocal.m4         |    1 -
 sim/aarch64/configure          | 1425 +---------------------
 sim/arch-subdir.mk.in          |   23 +
 sim/arm/aclocal.m4             |    1 -
 sim/arm/configure              | 1425 +---------------------
 sim/avr/aclocal.m4             |    1 -
 sim/avr/configure              | 1425 +---------------------
 sim/bfin/aclocal.m4            |    1 -
 sim/bfin/configure             | 1424 +---------------------
 sim/bpf/aclocal.m4             |    1 -
 sim/bpf/configure              | 1425 +---------------------
 sim/common/Make-common.in      |   22 -
 sim/cr16/aclocal.m4            |    1 -
 sim/cr16/configure             | 1425 +---------------------
 sim/cris/aclocal.m4            |    1 -
 sim/cris/configure             | 1425 +---------------------
 sim/d10v/aclocal.m4            |    1 -
 sim/d10v/configure             | 1425 +---------------------
 sim/erc32/aclocal.m4           |    1 -
 sim/erc32/configure            | 2015 ++++++++------------------------
 sim/example-synacor/aclocal.m4 |    1 -
 sim/example-synacor/configure  | 1425 +---------------------
 sim/frv/aclocal.m4             |    1 -
 sim/frv/configure              | 1425 +---------------------
 sim/ft32/aclocal.m4            |    1 -
 sim/ft32/configure             | 1425 +---------------------
 sim/h8300/aclocal.m4           |    1 -
 sim/h8300/configure            | 1425 +---------------------
 sim/iq2000/aclocal.m4          |    1 -
 sim/iq2000/configure           | 1425 +---------------------
 sim/lm32/aclocal.m4            |    1 -
 sim/lm32/configure             | 1425 +---------------------
 sim/m32c/aclocal.m4            |    1 -
 sim/m32c/configure             | 1425 +---------------------
 sim/m32r/aclocal.m4            |    1 -
 sim/m32r/configure             | 1425 +---------------------
 sim/m4/sim_ac_common.m4        |    4 +-
 sim/m68hc11/aclocal.m4         |    1 -
 sim/m68hc11/configure          | 1425 +---------------------
 sim/mcore/aclocal.m4           |    1 -
 sim/mcore/configure            | 1425 +---------------------
 sim/microblaze/aclocal.m4      |    1 -
 sim/microblaze/configure       | 1425 +---------------------
 sim/mips/aclocal.m4            |    1 -
 sim/mips/configure             | 1425 +---------------------
 sim/mn10300/aclocal.m4         |    1 -
 sim/mn10300/configure          | 1425 +---------------------
 sim/moxie/aclocal.m4           |    1 -
 sim/moxie/configure            | 1425 +---------------------
 sim/msp430/aclocal.m4          |    1 -
 sim/msp430/configure           | 1425 +---------------------
 sim/or1k/aclocal.m4            |    1 -
 sim/or1k/configure             | 1425 +---------------------
 sim/ppc/Makefile.in            |   16 -
 sim/ppc/configure              |  261 +----
 sim/ppc/configure.ac           |   25 +-
 sim/pru/aclocal.m4             |    1 -
 sim/pru/configure              | 1425 +---------------------
 sim/riscv/aclocal.m4           |    1 -
 sim/riscv/configure            | 1425 +---------------------
 sim/rl78/aclocal.m4            |    1 -
 sim/rl78/configure             | 1425 +---------------------
 sim/rx/aclocal.m4              |    1 -
 sim/rx/configure               | 1425 +---------------------
 sim/sh/aclocal.m4              |    1 -
 sim/sh/configure               | 1425 +---------------------
 sim/v850/aclocal.m4            |    1 -
 sim/v850/configure             | 1425 +---------------------
 68 files changed, 1916 insertions(+), 43230 deletions(-)

-- 
2.31.1

Patch

diff --git a/sim/arch-subdir.mk.in b/sim/arch-subdir.mk.in
index c6d0884cd19f..7a4250a4e5db 100644
--- a/sim/arch-subdir.mk.in
+++ b/sim/arch-subdir.mk.in
@@ -17,6 +17,29 @@ 
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+host_alias = @host_alias@
+target_alias = @target_alias@
+program_transform_name = @program_transform_name@
+
+EXEEXT = @EXEEXT@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+CC = @CC@
+C_DIALECT = @C_DIALECT@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+CXXFLAGS = @CXXFLAGS@
+LDFLAGS = @LDFLAGS@
+
+AR = @AR@
+AR_FLAGS = rc
+RANLIB = @RANLIB@
+
 zlibdir = @zlibdir@
 @PLUGINS_TRUE@LIBDL = @lt_cv_dlopen_libs@
 COMMON_LIBS = @LIBS@
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index 225847534c85..64c01940a7ff 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -52,9 +52,6 @@  include ../arch-subdir.mk
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 
-host_alias = @host_alias@
-target_alias = @target_alias@
-program_transform_name = @program_transform_name@
 bindir = @bindir@
 
 libdir = @libdir@
@@ -70,22 +67,8 @@  includedir = @includedir@
 # This can be referenced by the gettext configuration code.
 top_builddir = ..
 
-EXEEXT = @EXEEXT@
 SHELL = @SHELL@
 
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-CC = @CC@
-C_DIALECT = @C_DIALECT@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@
-CXXFLAGS = @CXXFLAGS@
-LDFLAGS = @LDFLAGS@
-
 SIM_BITSIZE = @sim_bitsize@
 SIM_DEFAULT_MODEL = @sim_default_model@
 SIM_FLOAT = @sim_float@
@@ -98,11 +81,6 @@  SIM_SCACHE = @sim_scache@
 SIM_WARN_CFLAGS = $(WARN_CFLAGS)
 SIM_WERROR_CFLAGS = $(WERROR_CFLAGS)
 
-AR = @AR@
-AR_FLAGS = rc
-RANLIB = @RANLIB@
-MAKEINFO = makeinfo
-
 # Dependency tracking information.
 DEPMODE = @CCDEPMODE@
 DEPDIR = @DEPDIR@
diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index b04d1c69150f..b9a5595ac20e 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -21,9 +21,9 @@  dnl
 dnl See README-HACKING for more details.
 AC_DEFUN([SIM_AC_COMMON],
 [dnl
-SIM_AC_TOOLCHAIN
-
 # Dependency checking.
+AC_REQUIRE([AC_PROG_CC])
+AC_REQUIRE([AC_PROG_INSTALL])
 ZW_CREATE_DEPDIR
 ZW_PROG_COMPILER_DEPENDENCIES([CC])
 
diff --git a/sim/ppc/Makefile.in b/sim/ppc/Makefile.in
index a45d4aa02868..e6e746d40015 100644
--- a/sim/ppc/Makefile.in
+++ b/sim/ppc/Makefile.in
@@ -31,9 +31,6 @@  include ../arch-subdir.mk
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 
-host_alias = @host_alias@
-target_alias = @target_alias@
-program_transform_name = @program_transform_name@
 bindir = @bindir@
 libdir = @libdir@
 tooldir = $(libdir)/$(target_alias)
@@ -56,22 +53,10 @@  includedir = @includedir@
 # This can be referenced by the gettext configuration code.
 top_builddir = ..
 
-EXEEXT = @EXEEXT@
 SHELL = /bin/sh
 
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-AR = @AR@
-AR_FLAGS = rc
-CC = @CC@
-CFLAGS = @CFLAGS@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
 BISON = bison
 MAKEINFO = makeinfo
-RANLIB = @RANLIB@
 
 INLINE_CFLAGS = @sim_inline@
 SMP_CFLAGS = @sim_smp@
@@ -104,7 +89,6 @@  STD_CFLAGS	= $(CFLAGS) $(WERROR_CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARN
 NOWARN_CFLAGS	= $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(INCLUDES) $(SIM_FPU_CFLAGS)
 BUILD_CFLAGS	= $(CFLAGS_FOR_BUILD) $(INCLUDES) $(WARNING_CFLAGS)
 
-LDFLAGS_FOR_BUILD	=
 LIBS = $(COMMON_LIBS) @LIBS@
 
 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS)
diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
index 605bdf9f2fb8..8efee5042072 100644
--- a/sim/ppc/configure.ac
+++ b/sim/ppc/configure.ac
@@ -5,14 +5,6 @@  AC_CONFIG_MACRO_DIRS([../.. ../../config])
 AC_PROG_INSTALL
 AC_PROG_CC
 
-# Put a plausible default for CC_FOR_BUILD in Makefile.
-if test "x$cross_compiling" = "xno"; then
-  CC_FOR_BUILD='$(CC)'
-else
-  CC_FOR_BUILD=gcc
-fi
-CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
-
 dnl We don't use gettext, but bfd does.  So we do the appropriate checks
 dnl to see if there are intl libraries we should link against.
 ALL_LINGUAS=
@@ -503,9 +495,6 @@  if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
 fi],[sim_xor_endian=""])dnl
 
 
-AC_CANONICAL_SYSTEM
-AC_ARG_PROGRAM
-
 case ${host} in
   *mingw32*)
     AC_DEFINE(USE_WIN32API, 1,
@@ -679,7 +668,13 @@  else
   *) realsrcdir=../${srcdir};;
   esac
   saved_CFLAGS="${CFLAGS}"
-  CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD}" \
+  # Put a plausible default for CC_FOR_BUILD in Makefile.
+  if test "x$cross_compiling" = "xno"; then
+    CC_FOR_BUILD='$(CC)'
+  else
+    CC_FOR_BUILD=gcc
+  fi
+  CC="${CC_FOR_BUILD}" CFLAGS="${CFLAGS_FOR_BUILD-${CFLAGS}}" \
   LDFLAGS="${LDFLAGS_FOR_BUILD}" \
   ${realsrcdir}/configure \
     --enable-languages=${enable_languages-all} \
@@ -690,12 +685,6 @@  else
   rm -rf $tempdir
 fi
 
-AC_SUBST(CC_FOR_BUILD)
-AC_SUBST(CFLAGS_FOR_BUILD)
-AC_SUBST(CFLAGS)
-AR=${AR-ar}
-AC_SUBST(AR)
-AC_PROG_RANLIB
 AC_SUBST(sim_warnings)
 AC_SUBST(sim_line_nr)
 AC_SUBST(sim_config)