public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/3] sim: unify toolchain settings
@ 2021-03-08  3:33 Mike Frysinger
  2021-03-08  3:33 ` [PATCH 2/3] sim: igen: merge build into top level Mike Frysinger
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mike Frysinger @ 2021-03-08  3:33 UTC (permalink / raw)
  To: gdb-patches

The toplevel, common, and igen dirs all have their own code for
setting up toolchain settings.  Unify all of that in a new macro.

*/
	* aclocal.m4, configure: Regenerate.
---
 sim/ChangeLog              |    9 +
 sim/Makefile.am            |    2 +-
 sim/Makefile.in            |    9 +-
 sim/aarch64/aclocal.m4     |    1 +
 sim/aarch64/configure      |  302 +--
 sim/aclocal.m4             |   23 +-
 sim/arm/aclocal.m4         |    1 +
 sim/arm/configure          |  302 +--
 sim/avr/aclocal.m4         |    1 +
 sim/avr/configure          |  302 +--
 sim/bfin/aclocal.m4        |    1 +
 sim/bfin/configure         |  302 +--
 sim/bpf/aclocal.m4         |    1 +
 sim/bpf/configure          |  302 +--
 sim/common/ChangeLog       |    5 +
 sim/common/Make-common.in  |    2 +-
 sim/configure              | 3632 ++++++++++++++++++------------------
 sim/configure.ac           |   27 +-
 sim/cr16/aclocal.m4        |    1 +
 sim/cr16/configure         |  302 +--
 sim/cris/aclocal.m4        |    1 +
 sim/cris/configure         |  302 +--
 sim/d10v/aclocal.m4        |    1 +
 sim/d10v/configure         |  302 +--
 sim/erc32/aclocal.m4       |    1 +
 sim/erc32/configure        |  302 +--
 sim/frv/aclocal.m4         |    1 +
 sim/frv/configure          |  302 +--
 sim/ft32/aclocal.m4        |    1 +
 sim/ft32/configure         |  302 +--
 sim/h8300/aclocal.m4       |    1 +
 sim/h8300/configure        |  302 +--
 sim/igen/ChangeLog         |    7 +
 sim/igen/configure         | 1697 ++++++++++++++---
 sim/igen/configure.ac      |   21 +-
 sim/iq2000/aclocal.m4      |    1 +
 sim/iq2000/configure       |  302 +--
 sim/lm32/aclocal.m4        |    1 +
 sim/lm32/configure         |  302 +--
 sim/m32c/aclocal.m4        |    1 +
 sim/m32c/configure         |  302 +--
 sim/m32r/aclocal.m4        |    1 +
 sim/m32r/configure         |  302 +--
 sim/m4/sim_ac_common.m4    |   51 +-
 sim/m4/sim_ac_toolchain.m4 |   67 +
 sim/m68hc11/aclocal.m4     |    1 +
 sim/m68hc11/configure      |  302 +--
 sim/mcore/aclocal.m4       |    1 +
 sim/mcore/configure        |  302 +--
 sim/microblaze/aclocal.m4  |    1 +
 sim/microblaze/configure   |  302 +--
 sim/mips/aclocal.m4        |    1 +
 sim/mips/configure         |  302 +--
 sim/mn10300/aclocal.m4     |    1 +
 sim/mn10300/configure      |  302 +--
 sim/moxie/aclocal.m4       |    1 +
 sim/moxie/configure        |  302 +--
 sim/msp430/aclocal.m4      |    1 +
 sim/msp430/configure       |  302 +--
 sim/or1k/aclocal.m4        |    1 +
 sim/or1k/configure         |  302 +--
 sim/pru/aclocal.m4         |    1 +
 sim/pru/configure          |  302 +--
 sim/riscv/aclocal.m4       |    1 +
 sim/riscv/configure        |  302 +--
 sim/rl78/aclocal.m4        |    1 +
 sim/rl78/configure         |  302 +--
 sim/rx/aclocal.m4          |    1 +
 sim/rx/configure           |  302 +--
 sim/sh/aclocal.m4          |    1 +
 sim/sh/configure           |  302 +--
 sim/v850/aclocal.m4        |    1 +
 sim/v850/configure         |  302 +--
 73 files changed, 7910 insertions(+), 6732 deletions(-)
 create mode 100644 sim/m4/sim_ac_toolchain.m4

diff --git a/sim/ChangeLog b/sim/ChangeLog
index 6b27cb46a8f7..0b164f33183c 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,12 @@
+2021-03-07  Mike Frysinger  <vapier@gentoo.org>
+
+	* Makefile.am (ACLOCAL_AMFLAGS): Add -Im4.
+	* configure.ac: Replace toolchain calls with SIM_AC_TOOLCHAIN.
+	* m4/sim_ac_common.m4 (SIM_AC_COMMON): Replace calls with
+	SIM_AC_TOOLCHAIN.
+	* m4/sim_ac_toolchain.m4: New file.
+	* aclocal.m4, configure, Makefile.in: Regenerate.
+
 2021-03-07  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure.ac (AC_CONFIG_FILES): Delete testsuite/Makefile.
diff --git a/sim/Makefile.am b/sim/Makefile.am
index c6e2d04f33ae..7efa5220ad46 100644
--- a/sim/Makefile.am
+++ b/sim/Makefile.am
@@ -16,7 +16,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 AUTOMAKE_OPTIONS = dejagnu foreign no-dist subdir-objects
-ACLOCAL_AMFLAGS = -I.. -I../config
+ACLOCAL_AMFLAGS = -Im4 -I.. -I../config
 
 srcroot = $(srcdir)/..
 
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 6b6df9282b05..1b1dd837073f 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-07  Mike Frysinger  <vapier@gentoo.org>
+
+	* Make-common.in (BUILD_CFLAGS): Rename to ...
+	(CFLAGS_FOR_BUILD): ... this.
+
 2021-03-07  Mike Frysinger  <vapier@gentoo.org>
 
 	* Make-common.in (check): Delete body.
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index cf92e94993c5..f73abf920ba5 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -230,7 +230,7 @@ CSEARCH = -I. -I$(srcdir) -I../common -I$(srccom) \
   -I../../opcodes -I$(srcroot)/opcodes \
   @INCINTL@
 ALL_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(CFLAGS)
-BUILD_CFLAGS = -g -O $(CSEARCH)
+CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ $(CSEARCH)
 
 COMMON_DEP_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH)
 
diff --git a/sim/configure.ac b/sim/configure.ac
index 23478521e94c..bbb5c32722dc 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -5,35 +5,10 @@ AC_INIT([sim], [0],
   [https://sourceware.org/bugzilla/enter_bug.cgi?product=gdb&component=sim],
   [], [https://sourceware.org/gdb/wiki/Sim/])
 
-AC_CANONICAL_SYSTEM
+SIM_AC_TOOLCHAIN
 
 AM_INIT_AUTOMAKE
 
-AC_PROG_CC
-AC_PROG_INSTALL
-AC_CHECK_TOOL(AR, ar)
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-
-AC_ARG_PROGRAM
-AC_PROG_CC
-AC_PROG_CPP
-AC_SUBST(CFLAGS)
-AR=${AR-ar}
-AC_SUBST(AR)
-AC_PROG_RANLIB
-
-# Put a plausible default for CC_FOR_BUILD in Makefile.
-if test -z "$CC_FOR_BUILD"; then
-  if test "x$cross_compiling" = "xno"; then
-    CC_FOR_BUILD='$(CC)'
-  else
-    CC_FOR_BUILD=gcc
-  fi
-fi
-AC_SUBST(CC_FOR_BUILD)
-CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-${CFLAGS}}
-AC_SUBST(CFLAGS_FOR_BUILD)
-
 # If a cpu ever has more than one simulator to choose from, use
 # --enable-sim=... to choose.
 AC_ARG_ENABLE(sim,
diff --git a/sim/igen/ChangeLog b/sim/igen/ChangeLog
index 0eeda65cb4e9..308076194ec7 100644
--- a/sim/igen/ChangeLog
+++ b/sim/igen/ChangeLog
@@ -1,3 +1,10 @@
+2021-03-07  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac: Call SIM_AC_TOOLCHAIN and AC_CONFIG_FILES.
+	(AC_PROG_INSTALL, AC_PROG_CC, AC_CANONICAL_SYSTEM, CC_FOR_BUILD,
+	CFLAGS_FOR_BUILD): Delete.
+	* configure: Regenerate.
+
 2021-03-07  Mike Frysinger  <vapier@gentoo.org>
 
 	* gen.c (main): Delete options arg to INIT_OPTIONS.
diff --git a/sim/igen/configure.ac b/sim/igen/configure.ac
index 807e1d596939..ff11814072ed 100644
--- a/sim/igen/configure.ac
+++ b/sim/igen/configure.ac
@@ -2,23 +2,8 @@ dnl Process this file with autoconf to produce a configure script.
 AC_INIT(table.h)
 AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 
-AC_PROG_INSTALL
-AC_PROG_CC
-
+SIM_AC_TOOLCHAIN
 SIM_AC_OPTION_WARNINGS
 
-# Put a plausible default for CC_FOR_BUILD in Makefile.
-if test "x$cross_compiling" = "xno" -a "x$host" != "xi386-windows"; then
-  CC_FOR_BUILD='$(CC)'
-  CFLAGS_FOR_BUILD='$(CFLAGS)'
-else
-  CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
-  CFLAGS_FOR_BUILD=${CFLAGS_FOR_BUILD-"-g"}
-fi
-
-AC_CANONICAL_SYSTEM
-
-AC_SUBST(CC_FOR_BUILD)
-AC_SUBST(CFLAGS_FOR_BUILD)
-
-AC_OUTPUT(Makefile)
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index f67c7f8be937..8cb45a8b72a6 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -20,56 +20,9 @@ dnl It is intended to be invoked last.
 dnl
 dnl See README-HACKING for more details.
 AC_DEFUN([SIM_AC_COMMON],
-[
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([AC_PROG_CPP])
+[dnl
+SIM_AC_TOOLCHAIN
 AC_CONFIG_HEADERS([config.h:config.in])
-AC_CANONICAL_SYSTEM
-AC_USE_SYSTEM_EXTENSIONS
-AC_C_BIGENDIAN
-AC_ARG_PROGRAM
-AC_PROG_INSTALL
-
-dnl Setup toolchain settings for build-time tools..
-if test "x$cross_compiling" = "xno"; then
-  : "${CC_FOR_BUILD:=\$(CC)}"
-  : "${CFLAGS_FOR_BUILD:=\$(CFLAGS)}"
-else
-  : "${CC_FOR_BUILD:=gcc}"
-  : "${CFLAGS_FOR_BUILD:=-g -O}"
-fi
-AC_SUBST(CC_FOR_BUILD)
-AC_SUBST(CFLAGS_FOR_BUILD)
-
-AC_SUBST(CFLAGS)
-AC_CHECK_TOOL(AR, ar)
-AC_PROG_RANLIB
-
-# Require C11 or newer.  Autoconf-2.70 provides ac_cv_prog_cc_c11 when using
-# AC_PROG_CC, but we're still using Autoconf-2.69, and the newest it understands
-# is C99.  So handle it ourselves.
-m4_version_prereq([2.70], [AC_MSG_ERROR([clean this up!])], [:])
-C_DIALECT=
-AC_MSG_CHECKING([whether C11 is supported by default])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
-# error "C11 support not found"
-#endif
-])], [AC_MSG_RESULT([yes])], [
-  AC_MSG_RESULT([no])
-  AC_MSG_CHECKING([for -std=c11 support])
-  ac_save_CC="$CC"
-  CC="$CC -std=c11"
-  AC_COMPILE_IFELSE([AC_LANG_SOURCE([
-#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
-# error "C11 support not found"
-#endif
-])], [
-  AC_MSG_RESULT([yes])
-  CC="$ac_save_CC"
-  C_DIALECT="-std=c11"
-], [AC_MSG_ERROR([C11 is required])])])
-AC_SUBST(C_DIALECT)
 
 # Some of the common include files depend on bfd.h, and bfd.h checks
 # that config.h is included first by testing that the PACKAGE macro
diff --git a/sim/m4/sim_ac_toolchain.m4 b/sim/m4/sim_ac_toolchain.m4
new file mode 100644
index 000000000000..56ff52fe3e09
--- /dev/null
+++ b/sim/m4/sim_ac_toolchain.m4
@@ -0,0 +1,67 @@
+dnl   Copyright (C) 1997-2021 Free Software Foundation, Inc.
+dnl
+dnl This program is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU General Public License as published by
+dnl the Free Software Foundation; either version 3 of the License, or
+dnl (at your option) any later version.
+dnl
+dnl This program is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+dnl GNU General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU General Public License
+dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
+dnl
+dnl Setup the toolchain variables.
+AC_DEFUN([SIM_AC_TOOLCHAIN],
+[dnl
+AC_CANONICAL_SYSTEM
+AC_USE_SYSTEM_EXTENSIONS
+AC_REQUIRE([AC_PROG_CC])
+AC_REQUIRE([AC_PROG_CPP])
+AC_C_BIGENDIAN
+AC_ARG_PROGRAM
+AC_PROG_INSTALL
+
+dnl Setup toolchain settings for build-time tools..
+if test "x$cross_compiling" = "xno"; then
+  : "${CC_FOR_BUILD:=\$(CC)}"
+  : "${CFLAGS_FOR_BUILD:=\$(CFLAGS)}"
+else
+  : "${CC_FOR_BUILD:=gcc}"
+  : "${CFLAGS_FOR_BUILD:=-g -O}"
+fi
+AC_SUBST(CC_FOR_BUILD)
+AC_SUBST(CFLAGS_FOR_BUILD)
+
+AC_SUBST(CFLAGS)
+AC_CHECK_TOOL(AR, ar)
+AC_PROG_RANLIB
+
+# Require C11 or newer.  Autoconf-2.70 provides ac_cv_prog_cc_c11 when using
+# AC_PROG_CC, but we're still using Autoconf-2.69, and the newest it understands
+# is C99.  So handle it ourselves.
+m4_version_prereq([2.70], [AC_MSG_ERROR([clean this up!])], [:])
+C_DIALECT=
+AC_MSG_CHECKING([whether C11 is supported by default])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
+# error "C11 support not found"
+#endif
+])], [AC_MSG_RESULT([yes])], [
+  AC_MSG_RESULT([no])
+  AC_MSG_CHECKING([for -std=c11 support])
+  ac_save_CC="$CC"
+  CC="$CC -std=c11"
+  AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L
+# error "C11 support not found"
+#endif
+])], [
+  AC_MSG_RESULT([yes])
+  CC="$ac_save_CC"
+  C_DIALECT="-std=c11"
+], [AC_MSG_ERROR([C11 is required])])])
+AC_SUBST(C_DIALECT)
+])
-- 
2.30.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-14  2:09 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-08  3:33 [PATCH 1/3] sim: unify toolchain settings Mike Frysinger
2021-03-08  3:33 ` [PATCH 2/3] sim: igen: merge build into top level Mike Frysinger
2021-03-08  3:33 ` [PATCH 3/3] sim: add preliminary support for --enable-targets Mike Frysinger
2021-03-13 17:24 ` [PATCH v2 1/3] sim: unify toolchain settings Mike Frysinger
2021-03-13 17:24   ` [PATCH v2 2/3] sim: igen: merge build into top level Mike Frysinger
2021-03-13 17:24   ` [PATCH v2 3/3] sim: add preliminary support for --enable-targets Mike Frysinger
2021-03-14  2:09   ` [PATCH] sim: testsuite: integrate common tests into build Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).