[4/7] sim: split debug/stdio/trace/profile options into dedicated m4 files

Message ID 20210607053355.9965-4-vapier@gentoo.org
State New
Headers show
Series
  • [1/7] sim: unify platform function & header tests
Related show

Commit Message

Mike Frysinger via Gdb-patches June 7, 2021, 5:33 a.m.
This follows existing organizational structure with one configure option
per m4 file, and will make it easier to move to the common configure dir.
---
 sim/bfin/aclocal.m4             |   4 ++
 sim/m4/sim_ac_common.m4         | 101 ++------------------------------
 sim/m4/sim_ac_option_debug.m4   |  35 +++++++++++
 sim/m4/sim_ac_option_profile.m4 |  48 +++++++++++++++
 sim/m4/sim_ac_option_stdio.m4   |  32 ++++++++++
 sim/m4/sim_ac_option_trace.m4   |  46 +++++++++++++++
 6 files changed, 171 insertions(+), 95 deletions(-)
 create mode 100644 sim/m4/sim_ac_option_debug.m4
 create mode 100644 sim/m4/sim_ac_option_profile.m4
 create mode 100644 sim/m4/sim_ac_option_stdio.m4
 create mode 100644 sim/m4/sim_ac_option_trace.m4

-- 
2.31.1

Patch

diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index 7bad1486c5cc..353855707ad7 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -66,102 +66,13 @@  dnl --enable-maintainer-mode.
 AM_MAINTAINER_MODE
 
 
-dnl --enable-sim-debug is for developers of the simulator
-dnl the allowable values are work-in-progress
-AC_MSG_CHECKING([for sim debug setting])
-sim_debug="0"
-AC_ARG_ENABLE(sim-debug,
-[AS_HELP_STRING([--enable-sim-debug=opts],
-		[Enable debugging flags (for developers of the sim itself)])],
-[case "${enableval}" in
-  yes) sim_debug="7";;
-  no)  sim_debug="0";;
-  *)   sim_debug="($enableval)";;
-esac])dnl
-if test "$sim_debug" != "0"; then
-  AC_DEFINE_UNQUOTED([DEBUG], [$sim_debug], [Sim debug setting])
-fi
-AC_DEFINE_UNQUOTED([WITH_DEBUG], [$sim_debug], [Sim debug setting])
-AC_MSG_RESULT($sim_debug)
-
-
-dnl --enable-sim-stdio is for users of the simulator
-dnl It determines if IO from the program is routed through STDIO (buffered)
-AC_MSG_CHECKING([for sim stdio debug behavior])
-sim_stdio="0"
-AC_ARG_ENABLE(sim-stdio,
-[AS_HELP_STRING([--enable-sim-stdio],
-		[Specify whether to use stdio for console input/output])],
-[case "${enableval}" in
-  yes)	sim_stdio="DO_USE_STDIO";;
-  no)	sim_stdio="DONT_USE_STDIO";;
-  *)	AC_MSG_ERROR([Unknown value $enableval passed to --enable-sim-stdio]);;
-esac])dnl
-AC_DEFINE_UNQUOTED([WITH_STDIO], [$sim_stdio], [How to route I/O])
-AC_MSG_RESULT($sim_stdio)
-
-
-dnl --enable-sim-trace is for users of the simulator
-dnl The argument is either a bitmask of things to enable [exactly what is
-dnl up to the simulator], or is a comma separated list of names of tracing
-dnl elements to enable.  The latter is only supported on simulators that
-dnl use WITH_TRACE.  Default to all tracing but internal debug.
-AC_MSG_CHECKING([for sim trace settings])
-sim_trace="~TRACE_debug"
-AC_ARG_ENABLE(sim-trace,
-[AS_HELP_STRING([--enable-sim-trace=opts],
-		[Enable tracing of simulated programs])],
-[case "${enableval}" in
-  yes)	sim_trace="-1";;
-  no)	sim_trace="0";;
-  [[-0-9]]*)
-	sim_trace="'(${enableval})'";;
-  [[[:lower:]]]*)
-	sim_trace=""
-	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
-	  if test x"$sim_trace" = x; then
-	    sim_trace="(TRACE_$x"
-	  else
-	    sim_trace="${sim_trace}|TRACE_$x"
-	  fi
-	done
-	sim_trace="$sim_trace)" ;;
-esac])dnl
-AC_DEFINE_UNQUOTED([WITH_TRACE], [$sim_trace], [Sim trace settings])
-AC_MSG_RESULT($sim_trace)
-
-
-dnl --enable-sim-profile
-dnl The argument is either a bitmask of things to enable [exactly what is
-dnl up to the simulator], or is a comma separated list of names of profiling
-dnl elements to enable.  The latter is only supported on simulators that
-dnl use WITH_PROFILE.
-AC_MSG_CHECKING([for sim profile settings])
-profile="1"
-sim_profile="-1"
-AC_ARG_ENABLE(sim-profile,
-[AS_HELP_STRING([--enable-sim-profile=opts], [Enable profiling flags])],
-[case "${enableval}" in
-  yes)	profile="1" sim_profile="-1";;
-  no)	profile="0" sim_profile="0";;
-  [[-0-9]]*)
-	profile="(${enableval})" sim_profile="(${enableval})";;
-  [[a-z]]*)
-    profile="1"
-	sim_profile=""
-	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
-	  if test x"$sim_profile" = x; then
-	    sim_profile="(PROFILE_$x"
-	  else
-	    sim_profile="${sim_profile}|PROFILE_$x"
-	  fi
-	done
-	sim_profile="$sim_profile)" ;;
-esac])dnl
-AC_DEFINE_UNQUOTED([PROFILE], [$profile], [Sim profile settings])
-AC_DEFINE_UNQUOTED([WITH_PROFILE], [$sim_profile], [Sim profile settings])
-AC_MSG_RESULT($sim_profile)
+SIM_AC_OPTION_DEBUG
 
+SIM_AC_OPTION_STDIO
+
+SIM_AC_OPTION_TRACE
+
+SIM_AC_OPTION_PROFILE
 
 SIM_AC_OPTION_INLINE
 
diff --git a/sim/m4/sim_ac_option_debug.m4 b/sim/m4/sim_ac_option_debug.m4
new file mode 100644
index 000000000000..41faef927fce
--- /dev/null
+++ b/sim/m4/sim_ac_option_debug.m4
@@ -0,0 +1,35 @@ 
+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 --enable-sim-debug is for developers of the simulator
+dnl the allowable values are work-in-progress
+AC_DEFUN([SIM_AC_OPTION_DEBUG],
+[dnl
+AC_MSG_CHECKING([for sim debug setting])
+sim_debug="0"
+AC_ARG_ENABLE(sim-debug,
+[AS_HELP_STRING([--enable-sim-debug=opts],
+		[Enable debugging flags (for developers of the sim itself)])],
+[case "${enableval}" in
+  yes) sim_debug="7";;
+  no)  sim_debug="0";;
+  *)   sim_debug="($enableval)";;
+esac])dnl
+if test "$sim_debug" != "0"; then
+  AC_DEFINE_UNQUOTED([DEBUG], [$sim_debug], [Sim debug setting])
+fi
+AC_DEFINE_UNQUOTED([WITH_DEBUG], [$sim_debug], [Sim debug setting])
+AC_MSG_RESULT($sim_debug)
+])
diff --git a/sim/m4/sim_ac_option_profile.m4 b/sim/m4/sim_ac_option_profile.m4
new file mode 100644
index 000000000000..07f8d958eefc
--- /dev/null
+++ b/sim/m4/sim_ac_option_profile.m4
@@ -0,0 +1,48 @@ 
+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 --enable-sim-profile
+dnl The argument is either a bitmask of things to enable [exactly what is
+dnl up to the simulator], or is a comma separated list of names of profiling
+dnl elements to enable.  The latter is only supported on simulators that
+dnl use WITH_PROFILE.
+AC_DEFUN([SIM_AC_OPTION_PROFILE],
+[dnl
+AC_MSG_CHECKING([for sim profile settings])
+profile="1"
+sim_profile="-1"
+AC_ARG_ENABLE(sim-profile,
+[AS_HELP_STRING([--enable-sim-profile=opts], [Enable profiling flags])],
+[case "${enableval}" in
+  yes)	profile="1" sim_profile="-1";;
+  no)	profile="0" sim_profile="0";;
+  [[-0-9]]*)
+	profile="(${enableval})" sim_profile="(${enableval})";;
+  [[a-z]]*)
+    profile="1"
+	sim_profile=""
+	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+	  if test x"$sim_profile" = x; then
+	    sim_profile="(PROFILE_$x"
+	  else
+	    sim_profile="${sim_profile}|PROFILE_$x"
+	  fi
+	done
+	sim_profile="$sim_profile)" ;;
+esac])dnl
+AC_DEFINE_UNQUOTED([PROFILE], [$profile], [Sim profile settings])
+AC_DEFINE_UNQUOTED([WITH_PROFILE], [$sim_profile], [Sim profile settings])
+AC_MSG_RESULT($sim_profile)
+])
diff --git a/sim/m4/sim_ac_option_stdio.m4 b/sim/m4/sim_ac_option_stdio.m4
new file mode 100644
index 000000000000..f4ae3081ee7b
--- /dev/null
+++ b/sim/m4/sim_ac_option_stdio.m4
@@ -0,0 +1,32 @@ 
+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 --enable-sim-stdio is for users of the simulator
+dnl It determines if IO from the program is routed through STDIO (buffered)
+AC_DEFUN([SIM_AC_OPTION_STDIO],
+[dnl
+AC_MSG_CHECKING([for sim stdio debug behavior])
+sim_stdio="0"
+AC_ARG_ENABLE(sim-stdio,
+[AS_HELP_STRING([--enable-sim-stdio],
+		[Specify whether to use stdio for console input/output])],
+[case "${enableval}" in
+  yes)	sim_stdio="DO_USE_STDIO";;
+  no)	sim_stdio="DONT_USE_STDIO";;
+  *)	AC_MSG_ERROR([Unknown value $enableval passed to --enable-sim-stdio]);;
+esac])dnl
+AC_DEFINE_UNQUOTED([WITH_STDIO], [$sim_stdio], [How to route I/O])
+AC_MSG_RESULT($sim_stdio)
+])
diff --git a/sim/m4/sim_ac_option_trace.m4 b/sim/m4/sim_ac_option_trace.m4
new file mode 100644
index 000000000000..d7dfead45a81
--- /dev/null
+++ b/sim/m4/sim_ac_option_trace.m4
@@ -0,0 +1,46 @@ 
+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 --enable-sim-trace is for users of the simulator
+dnl The argument is either a bitmask of things to enable [exactly what is
+dnl up to the simulator], or is a comma separated list of names of tracing
+dnl elements to enable.  The latter is only supported on simulators that
+dnl use WITH_TRACE.  Default to all tracing but internal debug.
+AC_DEFUN([SIM_AC_OPTION_TRACE],
+[dnl
+AC_MSG_CHECKING([for sim trace settings])
+sim_trace="~TRACE_debug"
+AC_ARG_ENABLE(sim-trace,
+[AS_HELP_STRING([--enable-sim-trace=opts],
+		[Enable tracing of simulated programs])],
+[case "${enableval}" in
+  yes)	sim_trace="-1";;
+  no)	sim_trace="0";;
+  [[-0-9]]*)
+	sim_trace="'(${enableval})'";;
+  [[[:lower:]]]*)
+	sim_trace=""
+	for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
+	  if test x"$sim_trace" = x; then
+	    sim_trace="(TRACE_$x"
+	  else
+	    sim_trace="${sim_trace}|TRACE_$x"
+	  fi
+	done
+	sim_trace="$sim_trace)" ;;
+esac])dnl
+AC_DEFINE_UNQUOTED([WITH_TRACE], [$sim_trace], [Sim trace settings])
+AC_MSG_RESULT($sim_trace)
+])