public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/7] sim: unify platform function & header tests
@ 2021-06-07  5:33 Mike Frysinger
  2021-06-07  5:33 ` [PATCH 2/7] sim: unify assert build settings Mike Frysinger
                   ` (6 more replies)
  0 siblings, 7 replies; 12+ messages in thread
From: Mike Frysinger @ 2021-06-07  5:33 UTC (permalink / raw)
  To: gdb-patches

Move the various platform tests up a level to avoid duplication
across the ports.  When building multiple versions, this speeds
things up a bit.

For now we move the obvious stuff up a level, but we don't turn
own the config.h entirely just yet -- we still have some tests
related to libraries that need consideration.
---
 sim/Makefile.in               |   39 +-
 sim/aarch64/config.in         |   93 ---
 sim/aarch64/configure         |  461 +-------------
 sim/aclocal.m4                |    1 +
 sim/arm/config.in             |   93 ---
 sim/arm/configure             |  461 +-------------
 sim/avr/config.in             |   93 ---
 sim/avr/configure             |  461 +-------------
 sim/bfin/config.in            |  132 ----
 sim/bfin/configure            |  503 +--------------
 sim/bfin/configure.ac         |   10 -
 sim/bpf/config.in             |   93 ---
 sim/bpf/configure             |  461 +-------------
 sim/common/defs.h             |   14 +-
 sim/config.h.in               |  285 +++++++++
 sim/configure                 | 1076 +++++++++++++++++++++++++++++----
 sim/configure.ac              |    3 +
 sim/cr16/config.in            |   93 ---
 sim/cr16/configure            |  461 +-------------
 sim/cris/config.in            |  102 ----
 sim/cris/configure            |  473 +--------------
 sim/cris/configure.ac         |    7 -
 sim/d10v/config.in            |   93 ---
 sim/d10v/configure            |  461 +-------------
 sim/erc32/config.in           |   93 ---
 sim/erc32/configure           |  461 +-------------
 sim/example-synacor/config.in |   93 ---
 sim/example-synacor/configure |  461 +-------------
 sim/frv/config.in             |   93 ---
 sim/frv/configure             |  461 +-------------
 sim/ft32/config.in            |   93 ---
 sim/ft32/configure            |  461 +-------------
 sim/h8300/config.in           |   96 ---
 sim/h8300/configure           |  466 +-------------
 sim/h8300/configure.ac        |    2 -
 sim/iq2000/config.in          |   93 ---
 sim/iq2000/configure          |  461 +-------------
 sim/lm32/config.in            |   93 ---
 sim/lm32/configure            |  461 +-------------
 sim/m32c/config.in            |  108 ----
 sim/m32c/configure            |  478 +--------------
 sim/m32c/configure.ac         |    8 -
 sim/m32r/config.in            |   93 ---
 sim/m32r/configure            |  461 +-------------
 sim/m4/sim_ac_common.m4       |   44 --
 sim/m4/sim_ac_platform.m4     |   94 +++
 sim/m68hc11/config.in         |   93 ---
 sim/m68hc11/configure         |  461 +-------------
 sim/mcore/config.in           |   93 ---
 sim/mcore/configure           |  461 +-------------
 sim/microblaze/config.in      |   93 ---
 sim/microblaze/configure      |  461 +-------------
 sim/mips/config.in            |  102 ----
 sim/mips/configure            |  473 +--------------
 sim/mips/configure.ac         |    1 -
 sim/mn10300/config.in         |   93 ---
 sim/mn10300/configure         |  461 +-------------
 sim/moxie/config.in           |   93 ---
 sim/moxie/configure           |  461 +-------------
 sim/msp430/config.in          |   93 ---
 sim/msp430/configure          |  461 +-------------
 sim/or1k/config.in            |   93 ---
 sim/or1k/configure            |  461 +-------------
 sim/pru/config.in             |   93 ---
 sim/pru/configure             |  461 +-------------
 sim/riscv/config.in           |   93 ---
 sim/riscv/configure           |  461 +-------------
 sim/rl78/config.in            |   93 ---
 sim/rl78/configure            |  461 +-------------
 sim/rx/config.in              |   93 ---
 sim/rx/configure              |  461 +-------------
 sim/sh/config.in              |   93 ---
 sim/sh/configure              |  461 +-------------
 sim/v850/config.in            |  114 ----
 sim/v850/configure            |  485 +--------------
 sim/v850/configure.ac         |    3 -
 76 files changed, 1431 insertions(+), 17538 deletions(-)
 create mode 100644 sim/config.h.in
 create mode 100644 sim/m4/sim_ac_platform.m4

diff --git a/sim/bfin/configure.ac b/sim/bfin/configure.ac
index 8fef4d47d00c..18e82fae66b9 100644
--- a/sim/bfin/configure.ac
+++ b/sim/bfin/configure.ac
@@ -42,16 +42,6 @@ SIM_AC_OPTION_HARDWARE(\
 	eth_phy \
 )
 
-AC_CHECK_FUNCS_ONCE([getuid getgid geteuid getegid setuid setgid kill pread])
-AC_CHECK_HEADERS_ONCE(m4_flatten([
-	linux/if_tun.h
-	linux/mii.h
-	linux/types.h
-	net/if.h
-	sys/ioctl.h
-	sys/mman.h
-]))
-
 PKG_PROG_PKG_CONFIG
 PKG_CHECK_MODULES(SDL, sdl, [
 	AC_CHECK_LIB(dl, dlopen, [
diff --git a/sim/common/defs.h b/sim/common/defs.h
index 957e36d3c93c..4b5da7bfa369 100644
--- a/sim/common/defs.h
+++ b/sim/common/defs.h
@@ -34,9 +34,21 @@
 #undef PACKAGE_URL
 #undef PACKAGE_VERSION
 
-/* Include sim's various configure tests.  */
+/* Include arch-specific sim's various configure tests.  */
 #include "config.h"
 
+/* Reset macros that our config.h will provide.  */
+#undef PACKAGE
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_URL
+#undef PACKAGE_VERSION
+
+/* Include common sim's various configure tests.  */
+#include "../config.h"
+
 #endif
 
 #endif
diff --git a/sim/config.h.in b/sim/config.h.in
new file mode 100644
index 000000000000..64291f9252dc
diff --git a/sim/configure.ac b/sim/configure.ac
index 8faef9dcb83b..0ff49b0b678e 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -5,7 +5,10 @@ AC_INIT([sim], [0],
   [https://sourceware.org/bugzilla/enter_bug.cgi?product=gdb&component=sim],
   [], [https://sourceware.org/gdb/wiki/Sim/])
 
+AC_CONFIG_HEADERS([config.h])
+
 SIM_AC_TOOLCHAIN
+SIM_AC_PLATFORM
 
 AM_MAINTAINER_MODE
 AM_INIT_AUTOMAKE
diff --git a/sim/cris/configure.ac b/sim/cris/configure.ac
index f8aa533a063c..b5eaea7b8adf 100644
--- a/sim/cris/configure.ac
+++ b/sim/cris/configure.ac
@@ -4,13 +4,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 
 SIM_AC_COMMON
 
-# For dv-rv and rvdummy.
-AC_CHECK_HEADERS_ONCE(m4_flatten([
-  sys/param.h
-  sys/select.h
-  sys/socket.h
-]))
-
 SIM_AC_OPTION_ENDIAN(LITTLE)
 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
diff --git a/sim/h8300/configure.ac b/sim/h8300/configure.ac
index dc24462742dc..43250f817416 100644
--- a/sim/h8300/configure.ac
+++ b/sim/h8300/configure.ac
@@ -7,6 +7,4 @@ SIM_AC_COMMON
 SIM_AC_OPTION_ENDIAN(BIG)
 SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 
-AC_CHECK_HEADERS_ONCE(sys/param.h)
-
 SIM_AC_OUTPUT
diff --git a/sim/m32c/configure.ac b/sim/m32c/configure.ac
index de1587eaac11..4f2c0ace70bb 100644
--- a/sim/m32c/configure.ac
+++ b/sim/m32c/configure.ac
@@ -23,12 +23,4 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 
 SIM_AC_COMMON
 
-AC_CHECK_HEADERS_ONCE(m4_flatten([
-  termios.h
-  netinet/in.h
-  netinet/tcp.h
-  sys/select.h
-  sys/socket.h
-]))
-
 SIM_AC_OUTPUT
diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index aa10a6502722..8ff2e2c7c5a5 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -40,47 +40,6 @@ dnl to see if there are intl libraries we should link against.
 ALL_LINGUAS=
 ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
 
-# Check for common headers.
-# NB: You can assume C11 headers exist.
-AC_CHECK_HEADERS_ONCE(m4_flatten([
-  dlfcn.h
-  fcntl.h
-  fpu_control.h
-  unistd.h
-  sys/mman.h
-  sys/resource.h
-  sys/stat.h
-]))
-AC_CHECK_FUNCS_ONCE(m4_flatten([
-  __setfpucw
-  ftruncate
-  getrusage
-  lstat
-  mmap
-  munmap
-  posix_fallocate
-  sigaction
-  strsignal
-  time
-  truncate
-]))
-AC_CHECK_MEMBERS([[struct stat.st_dev], [struct stat.st_ino],
-[struct stat.st_mode], [struct stat.st_nlink], [struct stat.st_uid],
-[struct stat.st_gid], [struct stat.st_rdev], [struct stat.st_size],
-[struct stat.st_blksize], [struct stat.st_blocks], [struct stat.st_atime],
-[struct stat.st_mtime], [struct stat.st_ctime]], [], [],
-[[#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif]])
-AC_CHECK_TYPES([__int128])
-AC_CHECK_TYPES(socklen_t, [], [],
-[#include <sys/types.h>
-#include <sys/socket.h>
-])
-
 # Check for socket libraries
 AC_CHECK_LIB(socket, bind)
 AC_CHECK_LIB(nsl, gethostbyname)
@@ -213,9 +172,6 @@ ACX_BUGURL([https://www.gnu.org/software/gdb/bugs/])
 AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
 AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
 
-dnl Types used by common code
-AC_TYPE_SIGNAL
-
 dnl Detect exe extension
 AC_EXEEXT
 ]) dnl End of SIM_AC_COMMON
diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4
new file mode 100644
index 000000000000..9487c66cc82c
--- /dev/null
+++ b/sim/m4/sim_ac_platform.m4
@@ -0,0 +1,94 @@
+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 Check for various platform settings.
+AC_DEFUN([SIM_AC_PLATFORM],
+[dnl
+dnl Check for common headers.
+dnl NB: You can assume C11 headers exist.
+AC_CHECK_HEADERS_ONCE(m4_flatten([
+  dlfcn.h
+  fcntl.h
+  fpu_control.h
+  termios.h
+  unistd.h
+  utime.h
+  linux/if_tun.h
+  linux/mii.h
+  linux/types.h
+  net/if.h
+  netinet/in.h
+  netinet/tcp.h
+  sys/ioctl.h
+  sys/mman.h
+  sys/param.h
+  sys/resource.h
+  sys/select.h
+  sys/socket.h
+  sys/stat.h
+]))
+
+AC_CHECK_FUNCS_ONCE(m4_flatten([
+  __setfpucw
+  aint
+  anint
+  chmod
+  chown
+  execv
+  execve
+  fork
+  ftruncate
+  geteuid
+  getegid
+  getgid
+  getrusage
+  getuid
+  kill
+  lstat
+  mmap
+  munmap
+  posix_fallocate
+  pread
+  setuid
+  setgid
+  sigaction
+  sqrt
+  strsignal
+  time
+  truncate
+  utime
+]))
+
+AC_CHECK_MEMBERS([[struct stat.st_dev], [struct stat.st_ino],
+[struct stat.st_mode], [struct stat.st_nlink], [struct stat.st_uid],
+[struct stat.st_gid], [struct stat.st_rdev], [struct stat.st_size],
+[struct stat.st_blksize], [struct stat.st_blocks], [struct stat.st_atime],
+[struct stat.st_mtime], [struct stat.st_ctime]], [], [],
+[[#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif]])
+
+AC_CHECK_TYPES([__int128])
+AC_CHECK_TYPES(socklen_t, [], [],
+[#include <sys/types.h>
+#include <sys/socket.h>
+])
+
+dnl Types used by common code
+AC_TYPE_SIGNAL
+])
diff --git a/sim/mips/configure.ac b/sim/mips/configure.ac
index fee3816b57af..f4e67376c12e 100644
--- a/sim/mips/configure.ac
+++ b/sim/mips/configure.ac
@@ -432,6 +432,5 @@ SIM_AC_OPTION_HARDWARE(tx3904cpu tx3904irc tx3904tmr tx3904sio)
 AC_PATH_X
 
 AC_CHECK_LIB(m, fabs)
-AC_CHECK_FUNCS(aint anint sqrt)
 
 SIM_AC_OUTPUT
diff --git a/sim/v850/configure.ac b/sim/v850/configure.ac
index f2edf1f7c480..9a7c1ec3df4b 100644
--- a/sim/v850/configure.ac
+++ b/sim/v850/configure.ac
@@ -9,7 +9,4 @@ SIM_AC_OPTION_ALIGNMENT(,NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_RESERVED_BITS
 SIM_AC_OPTION_BITSIZE(32,31)
 
-AC_CHECK_FUNCS_ONCE(chmod utime fork execve execv chown)
-AC_CHECK_HEADERS_ONCE(utime.h)
-
 SIM_AC_OUTPUT
-- 
2.31.1


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

* [PATCH 2/7] sim: unify assert build settings
  2021-06-07  5:33 [PATCH 1/7] sim: unify platform function & header tests Mike Frysinger
@ 2021-06-07  5:33 ` Mike Frysinger
  2021-06-07  5:33 ` [PATCH 3/7] sim: unify environment " Mike Frysinger
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Mike Frysinger @ 2021-06-07  5:33 UTC (permalink / raw)
  To: gdb-patches

Move the --sim-enable-assert option up to the common dir so we only
test & export it once across all ports.
---
 sim/Makefile.in                |  1 +
 sim/aarch64/aclocal.m4         |  1 -
 sim/aarch64/config.in          |  3 ---
 sim/aarch64/configure          | 26 ++------------------------
 sim/aclocal.m4                 |  1 +
 sim/arm/aclocal.m4             |  1 -
 sim/arm/config.in              |  3 ---
 sim/arm/configure              | 26 ++------------------------
 sim/avr/aclocal.m4             |  1 -
 sim/avr/config.in              |  3 ---
 sim/avr/configure              | 26 ++------------------------
 sim/bfin/aclocal.m4            |  1 -
 sim/bfin/config.in             |  3 ---
 sim/bfin/configure             | 26 ++------------------------
 sim/bpf/aclocal.m4             |  1 -
 sim/bpf/config.in              |  3 ---
 sim/bpf/configure              | 26 ++------------------------
 sim/config.h.in                |  3 +++
 sim/configure                  | 23 +++++++++++++++++++++++
 sim/configure.ac               |  2 ++
 sim/cr16/aclocal.m4            |  1 -
 sim/cr16/config.in             |  3 ---
 sim/cr16/configure             | 26 ++------------------------
 sim/cris/aclocal.m4            |  1 -
 sim/cris/config.in             |  3 ---
 sim/cris/configure             | 26 ++------------------------
 sim/d10v/aclocal.m4            |  1 -
 sim/d10v/config.in             |  3 ---
 sim/d10v/configure             | 26 ++------------------------
 sim/erc32/aclocal.m4           |  1 -
 sim/erc32/config.in            |  3 ---
 sim/erc32/configure            | 26 ++------------------------
 sim/example-synacor/aclocal.m4 |  1 -
 sim/example-synacor/config.in  |  3 ---
 sim/example-synacor/configure  | 26 ++------------------------
 sim/frv/aclocal.m4             |  1 -
 sim/frv/config.in              |  3 ---
 sim/frv/configure              | 26 ++------------------------
 sim/ft32/aclocal.m4            |  1 -
 sim/ft32/config.in             |  3 ---
 sim/ft32/configure             | 26 ++------------------------
 sim/h8300/aclocal.m4           |  1 -
 sim/h8300/config.in            |  3 ---
 sim/h8300/configure            | 26 ++------------------------
 sim/iq2000/aclocal.m4          |  1 -
 sim/iq2000/config.in           |  3 ---
 sim/iq2000/configure           | 26 ++------------------------
 sim/lm32/aclocal.m4            |  1 -
 sim/lm32/config.in             |  3 ---
 sim/lm32/configure             | 26 ++------------------------
 sim/m32c/aclocal.m4            |  1 -
 sim/m32c/config.in             |  3 ---
 sim/m32c/configure             | 26 ++------------------------
 sim/m32r/aclocal.m4            |  1 -
 sim/m32r/config.in             |  3 ---
 sim/m32r/configure             | 26 ++------------------------
 sim/m4/sim_ac_common.m4        |  1 -
 sim/m68hc11/aclocal.m4         |  1 -
 sim/m68hc11/config.in          |  3 ---
 sim/m68hc11/configure          | 26 ++------------------------
 sim/mcore/aclocal.m4           |  1 -
 sim/mcore/config.in            |  3 ---
 sim/mcore/configure            | 26 ++------------------------
 sim/microblaze/aclocal.m4      |  1 -
 sim/microblaze/config.in       |  3 ---
 sim/microblaze/configure       | 26 ++------------------------
 sim/mips/aclocal.m4            |  1 -
 sim/mips/config.in             |  3 ---
 sim/mips/configure             | 26 ++------------------------
 sim/mn10300/aclocal.m4         |  1 -
 sim/mn10300/config.in          |  3 ---
 sim/mn10300/configure          | 26 ++------------------------
 sim/moxie/aclocal.m4           |  1 -
 sim/moxie/config.in            |  3 ---
 sim/moxie/configure            | 26 ++------------------------
 sim/msp430/aclocal.m4          |  1 -
 sim/msp430/config.in           |  3 ---
 sim/msp430/configure           | 26 ++------------------------
 sim/or1k/aclocal.m4            |  1 -
 sim/or1k/config.in             |  3 ---
 sim/or1k/configure             | 26 ++------------------------
 sim/pru/aclocal.m4             |  1 -
 sim/pru/config.in              |  3 ---
 sim/pru/configure              | 26 ++------------------------
 sim/riscv/aclocal.m4           |  1 -
 sim/riscv/config.in            |  3 ---
 sim/riscv/configure            | 26 ++------------------------
 sim/rl78/aclocal.m4            |  1 -
 sim/rl78/config.in             |  3 ---
 sim/rl78/configure             | 26 ++------------------------
 sim/rx/aclocal.m4              |  1 -
 sim/rx/config.in               |  3 ---
 sim/rx/configure               | 26 ++------------------------
 sim/sh/aclocal.m4              |  1 -
 sim/sh/config.in               |  3 ---
 sim/sh/configure               | 26 ++------------------------
 sim/v850/aclocal.m4            |  1 -
 sim/v850/config.in             |  3 ---
 sim/v850/configure             | 26 ++------------------------
 99 files changed, 92 insertions(+), 869 deletions(-)

diff --git a/sim/configure.ac b/sim/configure.ac
index 0ff49b0b678e..700e04d6a602 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -99,5 +99,7 @@ if test "${enable_sim}" != no; then
 fi
 AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
 
+SIM_AC_OPTION_ASSERT
+
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index 8ff2e2c7c5a5..1df56e4baed2 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -163,7 +163,6 @@ AC_DEFINE_UNQUOTED([WITH_PROFILE], [$sim_profile], [Sim profile settings])
 AC_MSG_RESULT($sim_profile)
 
 
-SIM_AC_OPTION_ASSERT
 SIM_AC_OPTION_ENVIRONMENT
 SIM_AC_OPTION_INLINE
 
-- 
2.31.1


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

* [PATCH 3/7] sim: unify environment build settings
  2021-06-07  5:33 [PATCH 1/7] sim: unify platform function & header tests Mike Frysinger
  2021-06-07  5:33 ` [PATCH 2/7] sim: unify assert build settings Mike Frysinger
@ 2021-06-07  5:33 ` Mike Frysinger
  2021-06-12 17:17   ` [PATCH/committed] sim: ppc: unify env settings too Mike Frysinger
  2021-06-07  5:33 ` [PATCH 4/7] sim: split debug/stdio/trace/profile options into dedicated m4 files Mike Frysinger
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Mike Frysinger @ 2021-06-07  5:33 UTC (permalink / raw)
  To: gdb-patches

Move the --sim-enable-environment option up to the common dir so we
only test & export it once across all ports.
---
 sim/Makefile.in                |  1 +
 sim/aarch64/aclocal.m4         |  1 -
 sim/aarch64/config.in          |  3 ---
 sim/aarch64/configure          | 30 ++----------------------------
 sim/aclocal.m4                 |  1 +
 sim/arm/aclocal.m4             |  1 -
 sim/arm/config.in              |  3 ---
 sim/arm/configure              | 30 ++----------------------------
 sim/avr/aclocal.m4             |  1 -
 sim/avr/config.in              |  3 ---
 sim/avr/configure              | 30 ++----------------------------
 sim/bfin/aclocal.m4            |  1 -
 sim/bfin/config.in             |  3 ---
 sim/bfin/configure             | 30 ++----------------------------
 sim/bpf/aclocal.m4             |  1 -
 sim/bpf/config.in              |  3 ---
 sim/bpf/configure              | 30 ++----------------------------
 sim/config.h.in                |  3 +++
 sim/configure                  | 26 ++++++++++++++++++++++++++
 sim/configure.ac               |  1 +
 sim/cr16/aclocal.m4            |  1 -
 sim/cr16/config.in             |  3 ---
 sim/cr16/configure             | 30 ++----------------------------
 sim/cris/aclocal.m4            |  1 -
 sim/cris/config.in             |  3 ---
 sim/cris/configure             | 30 ++----------------------------
 sim/d10v/aclocal.m4            |  1 -
 sim/d10v/config.in             |  3 ---
 sim/d10v/configure             | 30 ++----------------------------
 sim/erc32/aclocal.m4           |  1 -
 sim/erc32/config.in            |  3 ---
 sim/erc32/configure            | 30 ++----------------------------
 sim/example-synacor/aclocal.m4 |  1 -
 sim/example-synacor/config.in  |  3 ---
 sim/example-synacor/configure  | 30 ++----------------------------
 sim/frv/aclocal.m4             |  1 -
 sim/frv/config.in              |  3 ---
 sim/frv/configure              | 30 ++----------------------------
 sim/ft32/aclocal.m4            |  1 -
 sim/ft32/config.in             |  3 ---
 sim/ft32/configure             | 30 ++----------------------------
 sim/h8300/aclocal.m4           |  1 -
 sim/h8300/config.in            |  3 ---
 sim/h8300/configure            | 30 ++----------------------------
 sim/iq2000/aclocal.m4          |  1 -
 sim/iq2000/config.in           |  3 ---
 sim/iq2000/configure           | 30 ++----------------------------
 sim/lm32/aclocal.m4            |  1 -
 sim/lm32/config.in             |  3 ---
 sim/lm32/configure             | 30 ++----------------------------
 sim/m32c/aclocal.m4            |  1 -
 sim/m32c/config.in             |  3 ---
 sim/m32c/configure             | 30 ++----------------------------
 sim/m32r/aclocal.m4            |  1 -
 sim/m32r/config.in             |  3 ---
 sim/m32r/configure             | 30 ++----------------------------
 sim/m4/sim_ac_common.m4        |  1 -
 sim/m68hc11/aclocal.m4         |  1 -
 sim/m68hc11/config.in          |  3 ---
 sim/m68hc11/configure          | 30 ++----------------------------
 sim/mcore/aclocal.m4           |  1 -
 sim/mcore/config.in            |  3 ---
 sim/mcore/configure            | 30 ++----------------------------
 sim/microblaze/aclocal.m4      |  1 -
 sim/microblaze/config.in       |  3 ---
 sim/microblaze/configure       | 30 ++----------------------------
 sim/mips/aclocal.m4            |  1 -
 sim/mips/config.in             |  3 ---
 sim/mips/configure             | 30 ++----------------------------
 sim/mn10300/aclocal.m4         |  1 -
 sim/mn10300/config.in          |  3 ---
 sim/mn10300/configure          | 30 ++----------------------------
 sim/moxie/aclocal.m4           |  1 -
 sim/moxie/config.in            |  3 ---
 sim/moxie/configure            | 30 ++----------------------------
 sim/msp430/aclocal.m4          |  1 -
 sim/msp430/config.in           |  3 ---
 sim/msp430/configure           | 30 ++----------------------------
 sim/or1k/aclocal.m4            |  1 -
 sim/or1k/config.in             |  3 ---
 sim/or1k/configure             | 30 ++----------------------------
 sim/pru/aclocal.m4             |  1 -
 sim/pru/config.in              |  3 ---
 sim/pru/configure              | 30 ++----------------------------
 sim/riscv/aclocal.m4           |  1 -
 sim/riscv/config.in            |  3 ---
 sim/riscv/configure            | 30 ++----------------------------
 sim/rl78/aclocal.m4            |  1 -
 sim/rl78/config.in             |  3 ---
 sim/rl78/configure             | 30 ++----------------------------
 sim/rx/aclocal.m4              |  1 -
 sim/rx/config.in               |  3 ---
 sim/rx/configure               | 30 ++----------------------------
 sim/sh/aclocal.m4              |  1 -
 sim/sh/config.in               |  3 ---
 sim/sh/configure               | 30 ++----------------------------
 sim/v850/aclocal.m4            |  1 -
 sim/v850/config.in             |  3 ---
 sim/v850/configure             | 30 ++----------------------------
 99 files changed, 94 insertions(+), 993 deletions(-)

diff --git a/sim/configure.ac b/sim/configure.ac
index 700e04d6a602..ecf12b57a19b 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -100,6 +100,7 @@ fi
 AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
 
 SIM_AC_OPTION_ASSERT
+SIM_AC_OPTION_ENVIRONMENT
 
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index 1df56e4baed2..7bad1486c5cc 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -163,7 +163,6 @@ AC_DEFINE_UNQUOTED([WITH_PROFILE], [$sim_profile], [Sim profile settings])
 AC_MSG_RESULT($sim_profile)
 
 
-SIM_AC_OPTION_ENVIRONMENT
 SIM_AC_OPTION_INLINE
 
 ACX_PKGVERSION([SIM])
-- 
2.31.1


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

* [PATCH 4/7] sim: split debug/stdio/trace/profile options into dedicated m4 files
  2021-06-07  5:33 [PATCH 1/7] sim: unify platform function & header tests Mike Frysinger
  2021-06-07  5:33 ` [PATCH 2/7] sim: unify assert build settings Mike Frysinger
  2021-06-07  5:33 ` [PATCH 3/7] sim: unify environment " Mike Frysinger
@ 2021-06-07  5:33 ` Mike Frysinger
  2021-06-07  5:33 ` [PATCH 5/7] sim: unify debug/stdio/trace/profile build settings Mike Frysinger
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 12+ messages in thread
From: Mike Frysinger @ 2021-06-07  5:33 UTC (permalink / raw)
  To: gdb-patches

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

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)
+])
-- 
2.31.1


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

* [PATCH 5/7] sim: unify debug/stdio/trace/profile build settings
  2021-06-07  5:33 [PATCH 1/7] sim: unify platform function & header tests Mike Frysinger
                   ` (2 preceding siblings ...)
  2021-06-07  5:33 ` [PATCH 4/7] sim: split debug/stdio/trace/profile options into dedicated m4 files Mike Frysinger
@ 2021-06-07  5:33 ` Mike Frysinger
  2021-06-13  0:09   ` [PATCH 5/7 v2] " Mike Frysinger
  2021-06-07  5:33 ` [PATCH 6/7] sim: unify bug & package settings Mike Frysinger
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 12+ messages in thread
From: Mike Frysinger @ 2021-06-07  5:33 UTC (permalink / raw)
  To: gdb-patches

Move these options up to the common dir so we only test & export
them once across all ports.
---
 sim/Makefile.in               |   4 +
 sim/aarch64/config.in         |  18 -----
 sim/aarch64/configure         | 134 +---------------------------------
 sim/aclocal.m4                |   4 +
 sim/arm/config.in             |  18 -----
 sim/arm/configure             | 134 +---------------------------------
 sim/avr/config.in             |  18 -----
 sim/avr/configure             | 134 +---------------------------------
 sim/bfin/aclocal.m4           |   4 -
 sim/bfin/config.in            |  18 -----
 sim/bfin/configure            | 134 +---------------------------------
 sim/bpf/config.in             |  18 -----
 sim/bpf/configure             | 134 +---------------------------------
 sim/config.h.in               |  18 +++++
 sim/configure                 | 123 +++++++++++++++++++++++++++++++
 sim/configure.ac              |   6 ++
 sim/cr16/config.in            |  18 -----
 sim/cr16/configure            | 134 +---------------------------------
 sim/cris/config.in            |  18 -----
 sim/cris/configure            | 134 +---------------------------------
 sim/d10v/config.in            |  18 -----
 sim/d10v/configure            | 134 +---------------------------------
 sim/erc32/config.in           |  18 -----
 sim/erc32/configure           | 134 +---------------------------------
 sim/example-synacor/config.in |  18 -----
 sim/example-synacor/configure | 134 +---------------------------------
 sim/frv/config.in             |  18 -----
 sim/frv/configure             | 134 +---------------------------------
 sim/ft32/config.in            |  18 -----
 sim/ft32/configure            | 134 +---------------------------------
 sim/h8300/config.in           |  18 -----
 sim/h8300/configure           | 134 +---------------------------------
 sim/iq2000/config.in          |  18 -----
 sim/iq2000/configure          | 134 +---------------------------------
 sim/lm32/config.in            |  18 -----
 sim/lm32/configure            | 134 +---------------------------------
 sim/m32c/config.in            |  18 -----
 sim/m32c/configure            | 134 +---------------------------------
 sim/m32r/config.in            |  18 -----
 sim/m32r/configure            | 134 +---------------------------------
 sim/m4/sim_ac_common.m4       |  16 ----
 sim/m68hc11/config.in         |  18 -----
 sim/m68hc11/configure         | 134 +---------------------------------
 sim/mcore/config.in           |  18 -----
 sim/mcore/configure           | 134 +---------------------------------
 sim/microblaze/config.in      |  18 -----
 sim/microblaze/configure      | 134 +---------------------------------
 sim/mips/config.in            |  18 -----
 sim/mips/configure            | 134 +---------------------------------
 sim/mn10300/config.in         |  18 -----
 sim/mn10300/configure         | 134 +---------------------------------
 sim/moxie/config.in           |  18 -----
 sim/moxie/configure           | 134 +---------------------------------
 sim/msp430/config.in          |  18 -----
 sim/msp430/configure          | 134 +---------------------------------
 sim/or1k/config.in            |  18 -----
 sim/or1k/configure            | 134 +---------------------------------
 sim/pru/config.in             |  18 -----
 sim/pru/configure             | 134 +---------------------------------
 sim/riscv/config.in           |  18 -----
 sim/riscv/configure           | 134 +---------------------------------
 sim/rl78/config.in            |  18 -----
 sim/rl78/configure            | 134 +---------------------------------
 sim/rx/config.in              |  18 -----
 sim/rx/configure              | 134 +---------------------------------
 sim/sh/config.in              |  18 -----
 sim/sh/configure              | 134 +---------------------------------
 sim/v850/config.in            |  18 -----
 sim/v850/configure            | 134 +---------------------------------
 69 files changed, 217 insertions(+), 4670 deletions(-)

diff --git a/sim/configure.ac b/sim/configure.ac
index ecf12b57a19b..d8c6f2d4feb4 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -99,8 +99,14 @@ if test "${enable_sim}" != no; then
 fi
 AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
 
+dnl Standard (and optional) simulator options.
+dnl Eventually all simulators will support these.
 SIM_AC_OPTION_ASSERT
+SIM_AC_OPTION_DEBUG
 SIM_AC_OPTION_ENVIRONMENT
+SIM_AC_OPTION_PROFILE
+SIM_AC_OPTION_STDIO
+SIM_AC_OPTION_TRACE
 
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index 353855707ad7..0f687dc7bc58 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -54,26 +54,10 @@ AM_CONDITIONAL(PLUGINS, test "$plugins" = yes)
 LT_INIT([dlopen])
 AC_SUBST(lt_cv_dlopen_libs)
 
-dnl Standard (and optional) simulator options.
-dnl Eventually all simulators will support these.
-dnl Do not add any here that cannot be supported by all simulators.
-dnl Do not add similar but different options to a particular simulator,
-dnl all shall eventually behave the same way.
-
-
 dnl We don't use automake, but we still want to support
 dnl --enable-maintainer-mode.
 AM_MAINTAINER_MODE
 
-
-SIM_AC_OPTION_DEBUG
-
-SIM_AC_OPTION_STDIO
-
-SIM_AC_OPTION_TRACE
-
-SIM_AC_OPTION_PROFILE
-
 SIM_AC_OPTION_INLINE
 
 ACX_PKGVERSION([SIM])
-- 
2.31.1


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

* [PATCH 6/7] sim: unify bug & package settings
  2021-06-07  5:33 [PATCH 1/7] sim: unify platform function & header tests Mike Frysinger
                   ` (3 preceding siblings ...)
  2021-06-07  5:33 ` [PATCH 5/7] sim: unify debug/stdio/trace/profile build settings Mike Frysinger
@ 2021-06-07  5:33 ` Mike Frysinger
  2021-06-13  0:25   ` [PATCH 6/7 v2] " Mike Frysinger
  2021-06-07  5:33 ` [PATCH 7/7] sim: overhaul alignment settings management Mike Frysinger
  2021-06-12 18:40 ` [PATCH/committed] sim: ppc: unify header & function & type tests too Mike Frysinger
  6 siblings, 1 reply; 12+ messages in thread
From: Mike Frysinger @ 2021-06-07  5:33 UTC (permalink / raw)
  To: gdb-patches

Move these options up to the common dir so we only test & export
them once across all ports.  The AC_INIT macro does a lot of the
heavy lifting already which allows further simplification.
---
 sim/Makefile.in                |  6 ++-
 sim/aarch64/aclocal.m4         |  1 -
 sim/aarch64/config.in          |  9 ----
 sim/aarch64/configure          | 79 +---------------------------------
 sim/aclocal.m4                 |  1 +
 sim/arm/aclocal.m4             |  1 -
 sim/arm/config.in              |  9 ----
 sim/arm/configure              | 79 +---------------------------------
 sim/avr/aclocal.m4             |  1 -
 sim/avr/config.in              |  9 ----
 sim/avr/configure              | 79 +---------------------------------
 sim/bfin/aclocal.m4            |  1 -
 sim/bfin/config.in             |  9 ----
 sim/bfin/configure             | 79 +---------------------------------
 sim/bpf/aclocal.m4             |  1 -
 sim/bpf/config.in              |  9 ----
 sim/bpf/configure              | 79 +---------------------------------
 sim/config.h.in                |  6 +++
 sim/configure                  | 67 ++++++++++++++++++++++++++++
 sim/configure.ac               |  7 +++
 sim/cr16/aclocal.m4            |  1 -
 sim/cr16/config.in             |  9 ----
 sim/cr16/configure             | 79 +---------------------------------
 sim/cris/aclocal.m4            |  1 -
 sim/cris/config.in             |  9 ----
 sim/cris/configure             | 79 +---------------------------------
 sim/d10v/aclocal.m4            |  1 -
 sim/d10v/config.in             |  9 ----
 sim/d10v/configure             | 79 +---------------------------------
 sim/erc32/aclocal.m4           |  1 -
 sim/erc32/config.in            |  9 ----
 sim/erc32/configure            | 79 +---------------------------------
 sim/example-synacor/aclocal.m4 |  1 -
 sim/example-synacor/config.in  |  9 ----
 sim/example-synacor/configure  | 79 +---------------------------------
 sim/frv/aclocal.m4             |  1 -
 sim/frv/config.in              |  9 ----
 sim/frv/configure              | 79 +---------------------------------
 sim/ft32/aclocal.m4            |  1 -
 sim/ft32/config.in             |  9 ----
 sim/ft32/configure             | 79 +---------------------------------
 sim/h8300/aclocal.m4           |  1 -
 sim/h8300/config.in            |  9 ----
 sim/h8300/configure            | 79 +---------------------------------
 sim/iq2000/aclocal.m4          |  1 -
 sim/iq2000/config.in           |  9 ----
 sim/iq2000/configure           | 79 +---------------------------------
 sim/lm32/aclocal.m4            |  1 -
 sim/lm32/config.in             |  9 ----
 sim/lm32/configure             | 79 +---------------------------------
 sim/m32c/aclocal.m4            |  1 -
 sim/m32c/config.in             |  9 ----
 sim/m32c/configure             | 79 +---------------------------------
 sim/m32r/aclocal.m4            |  1 -
 sim/m32r/config.in             |  9 ----
 sim/m32r/configure             | 79 +---------------------------------
 sim/m4/sim_ac_common.m4        | 12 ------
 sim/m68hc11/aclocal.m4         |  1 -
 sim/m68hc11/config.in          |  9 ----
 sim/m68hc11/configure          | 79 +---------------------------------
 sim/mcore/aclocal.m4           |  1 -
 sim/mcore/config.in            |  9 ----
 sim/mcore/configure            | 79 +---------------------------------
 sim/microblaze/aclocal.m4      |  1 -
 sim/microblaze/config.in       |  9 ----
 sim/microblaze/configure       | 79 +---------------------------------
 sim/mips/aclocal.m4            |  1 -
 sim/mips/config.in             |  9 ----
 sim/mips/configure             | 79 +---------------------------------
 sim/mn10300/aclocal.m4         |  1 -
 sim/mn10300/config.in          |  9 ----
 sim/mn10300/configure          | 79 +---------------------------------
 sim/moxie/aclocal.m4           |  1 -
 sim/moxie/config.in            |  9 ----
 sim/moxie/configure            | 79 +---------------------------------
 sim/msp430/aclocal.m4          |  1 -
 sim/msp430/config.in           |  9 ----
 sim/msp430/configure           | 79 +---------------------------------
 sim/or1k/aclocal.m4            |  1 -
 sim/or1k/config.in             |  9 ----
 sim/or1k/configure             | 79 +---------------------------------
 sim/pru/aclocal.m4             |  1 -
 sim/pru/config.in              |  9 ----
 sim/pru/configure              | 79 +---------------------------------
 sim/riscv/aclocal.m4           |  1 -
 sim/riscv/config.in            |  9 ----
 sim/riscv/configure            | 79 +---------------------------------
 sim/rl78/aclocal.m4            |  1 -
 sim/rl78/config.in             |  9 ----
 sim/rl78/configure             | 79 +---------------------------------
 sim/rx/aclocal.m4              |  1 -
 sim/rx/config.in               |  9 ----
 sim/rx/configure               | 79 +---------------------------------
 sim/sh/aclocal.m4              |  1 -
 sim/sh/config.in               |  9 ----
 sim/sh/configure               | 79 +---------------------------------
 sim/v850/aclocal.m4            |  1 -
 sim/v850/config.in             |  9 ----
 sim/v850/configure             | 79 +---------------------------------
 99 files changed, 148 insertions(+), 2710 deletions(-)

diff --git a/sim/configure.ac b/sim/configure.ac
index d8c6f2d4feb4..8022a11bc91a 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -5,6 +5,13 @@ AC_INIT([sim], [0],
   [https://sourceware.org/bugzilla/enter_bug.cgi?product=gdb&component=sim],
   [], [https://sourceware.org/gdb/wiki/Sim/])
 
+dnl Probably should unify PKGVERSION with PACKAGE_* settings from AC_INIT.
+ACX_PKGVERSION([SIM])
+AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
+dnl PACKAGE_BUGREPORT is provided by AC_INIT.
+ACX_BUGURL([$PACKAGE_BUGREPORT])
+AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
+
 AC_CONFIG_HEADERS([config.h])
 
 SIM_AC_TOOLCHAIN
diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index 0f687dc7bc58..e8385c2e7c1c 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -24,13 +24,6 @@ AC_DEFUN([SIM_AC_COMMON],
 SIM_AC_TOOLCHAIN
 AC_CONFIG_HEADERS([config.h:config.in])
 
-# 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
-# is defined.
-PACKAGE=sim
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
-AC_SUBST(PACKAGE)
-
 # Dependency checking.
 ZW_CREATE_DEPDIR
 ZW_PROG_COMPILER_DEPENDENCIES([CC])
@@ -60,11 +53,6 @@ AM_MAINTAINER_MODE
 
 SIM_AC_OPTION_INLINE
 
-ACX_PKGVERSION([SIM])
-ACX_BUGURL([https://www.gnu.org/software/gdb/bugs/])
-AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
-AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
-
 dnl Detect exe extension
 AC_EXEEXT
 ]) dnl End of SIM_AC_COMMON
-- 
2.31.1


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

* [PATCH 7/7] sim: overhaul alignment settings management
  2021-06-07  5:33 [PATCH 1/7] sim: unify platform function & header tests Mike Frysinger
                   ` (4 preceding siblings ...)
  2021-06-07  5:33 ` [PATCH 6/7] sim: unify bug & package settings Mike Frysinger
@ 2021-06-07  5:33 ` Mike Frysinger
  2021-06-13  1:19   ` [PATCH 7/7 v2] " Mike Frysinger
  2021-06-12 18:40 ` [PATCH/committed] sim: ppc: unify header & function & type tests too Mike Frysinger
  6 siblings, 1 reply; 12+ messages in thread
From: Mike Frysinger @ 2021-06-07  5:33 UTC (permalink / raw)
  To: gdb-patches

Currently, the sim-config module will abort if alignment settings
haven't been specified by the port's configure.ac.  This is a bit
weird when we've allowed SIM_AC_OPTION_ALIGNMENT to seem like it's
optional to use.  Thus everyone invokes it.

There are 4 alignment settings, but really only 2 matters: strict
and nonstrict.  The "mixed" setting is just the default ("unset"),
and "forced" isn't used directly by anyone (it's available as a
runtime option for some ports).

The m4 macro has 2 args: the "wire" settings (which represents the
hardwired port behavior), and the default settings (which are used
if nothing else is specified).  If none are specified, then the
build won't work (see above as if SIM_AC_OPTION_ALIGNMENT wasn't
called).  If default settings are provided, then that is used, but
we allow the user to override at runtime.  Otherwise, the "wire"
settings are used and user runtime options to change are ignored.

Most ports specify a default, or set the "wire" to nonstrict.  A
few set "wire" to strict, but it's not clear that's necessary as
it doesn't make the code behavior, by default, any different.  It
might make things a little faster, but we should provide the user
the choice of the compromises to make: force a specific mode at
compile time for faster runtime, or allow the choice at runtime.
More likely it seems like an oversight when these ports were
initially created, and/or copied & pasted from existing ports.

With all that backstory, let's get to what this commit does.

First kill off the idea of a compile-time default alignment and
set it to nonstrict in the common code.  For any ports that want
strict alignment by default, that code is moved to sim_open while
initializing the sim.  That means WITH_DEFAULT_ALIGNMENT can be
completely removed.

Moving the default alignment to the runtime also allows removal
of setting the "wire" settings at configure time.  Which allows
removing of all arguments to SIM_AC_OPTION_ALIGNMENT and moving
that call to common code.

The macro logic can be reworked to not pass WITH_ALIGNMENT as -D
CPPFLAG and instead move it to config.h.

All of these taken together mean we can hoist the macro up to the
top level and share it among all sims so behavior is consistent
among all the ports.
---
 sim/Makefile.in                   |  1 +
 sim/aarch64/aclocal.m4            |  1 -
 sim/aarch64/configure             | 62 ++-----------------------------
 sim/aarch64/configure.ac          |  5 ---
 sim/aarch64/interp.c              |  5 +++
 sim/aclocal.m4                    |  1 +
 sim/arm/aclocal.m4                |  1 -
 sim/arm/configure                 | 58 ++---------------------------
 sim/arm/configure.ac              |  1 -
 sim/arm/wrapper.c                 |  3 ++
 sim/avr/aclocal.m4                |  1 -
 sim/avr/configure                 | 58 ++---------------------------
 sim/avr/configure.ac              |  1 -
 sim/avr/interp.c                  |  3 ++
 sim/bfin/aclocal.m4               |  1 -
 sim/bfin/configure                | 58 ++---------------------------
 sim/bfin/configure.ac             |  1 -
 sim/bfin/interp.c                 |  3 ++
 sim/bpf/aclocal.m4                |  1 -
 sim/bpf/configure                 | 58 ++---------------------------
 sim/bpf/configure.ac              |  1 -
 sim/common/Make-common.in         |  2 -
 sim/common/sim-config.c           |  8 +---
 sim/common/sim-config.h           | 11 +-----
 sim/config.h.in                   |  3 ++
 sim/configure                     | 24 ++++++++++++
 sim/configure.ac                  |  1 +
 sim/cr16/aclocal.m4               |  1 -
 sim/cr16/configure                | 58 ++---------------------------
 sim/cr16/configure.ac             |  1 -
 sim/cris/aclocal.m4               |  1 -
 sim/cris/configure                | 58 ++---------------------------
 sim/cris/configure.ac             |  1 -
 sim/d10v/aclocal.m4               |  1 -
 sim/d10v/configure                | 58 ++---------------------------
 sim/d10v/configure.ac             |  1 -
 sim/d10v/interp.c                 |  3 ++
 sim/example-synacor/aclocal.m4    |  1 -
 sim/example-synacor/configure     | 58 ++---------------------------
 sim/example-synacor/configure.ac  |  1 -
 sim/example-synacor/interp.c      |  3 ++
 sim/frv/aclocal.m4                |  1 -
 sim/frv/configure                 | 58 ++---------------------------
 sim/frv/configure.ac              |  1 -
 sim/frv/sim-if.c                  |  3 ++
 sim/ft32/aclocal.m4               |  1 -
 sim/ft32/configure                | 58 ++---------------------------
 sim/ft32/configure.ac             |  1 -
 sim/ft32/interp.c                 |  3 ++
 sim/h8300/aclocal.m4              |  1 -
 sim/h8300/configure               | 58 ++---------------------------
 sim/h8300/configure.ac            |  1 -
 sim/iq2000/aclocal.m4             |  1 -
 sim/iq2000/configure              | 58 ++---------------------------
 sim/iq2000/configure.ac           |  1 -
 sim/iq2000/sim-if.c               |  3 ++
 sim/lm32/aclocal.m4               |  1 -
 sim/lm32/configure                | 58 ++---------------------------
 sim/lm32/configure.ac             |  1 -
 sim/lm32/sim-if.c                 |  3 ++
 sim/m32r/aclocal.m4               |  1 -
 sim/m32r/configure                | 58 ++---------------------------
 sim/m32r/configure.ac             |  1 -
 sim/m32r/sim-if.c                 |  3 ++
 sim/m4/sim_ac_option_alignment.m4 | 53 +++++---------------------
 sim/m68hc11/aclocal.m4            |  1 -
 sim/m68hc11/configure             | 58 ++---------------------------
 sim/m68hc11/configure.ac          |  1 -
 sim/mcore/aclocal.m4              |  1 -
 sim/mcore/configure               | 58 ++---------------------------
 sim/mcore/configure.ac            |  1 -
 sim/microblaze/aclocal.m4         |  1 -
 sim/microblaze/configure          | 58 ++---------------------------
 sim/microblaze/configure.ac       |  1 -
 sim/mips/aclocal.m4               |  1 -
 sim/mips/configure                | 58 ++---------------------------
 sim/mips/configure.ac             |  1 -
 sim/mn10300/aclocal.m4            |  1 -
 sim/mn10300/configure             | 58 ++---------------------------
 sim/mn10300/configure.ac          |  1 -
 sim/moxie/aclocal.m4              |  1 -
 sim/moxie/configure               | 58 ++---------------------------
 sim/moxie/configure.ac            |  1 -
 sim/msp430/aclocal.m4             |  1 -
 sim/msp430/configure              | 58 ++---------------------------
 sim/msp430/configure.ac           |  1 -
 sim/or1k/aclocal.m4               |  1 -
 sim/or1k/configure                | 58 ++---------------------------
 sim/or1k/configure.ac             |  1 -
 sim/pru/aclocal.m4                |  1 -
 sim/pru/configure                 | 58 ++---------------------------
 sim/pru/configure.ac              |  1 -
 sim/pru/interp.c                  |  3 ++
 sim/riscv/aclocal.m4              |  1 -
 sim/riscv/configure               | 58 ++---------------------------
 sim/riscv/configure.ac            |  1 -
 sim/sh/aclocal.m4                 |  1 -
 sim/sh/configure                  | 58 ++---------------------------
 sim/sh/configure.ac               |  1 -
 sim/sh/interp.c                   |  3 ++
 sim/v850/aclocal.m4               |  1 -
 sim/v850/configure                | 58 ++---------------------------
 sim/v850/configure.ac             |  1 -
 103 files changed, 193 insertions(+), 1580 deletions(-)

diff --git a/sim/aarch64/configure.ac b/sim/aarch64/configure.ac
index 1c212dc2c955..381682fb5f09 100644
--- a/sim/aarch64/configure.ac
+++ b/sim/aarch64/configure.ac
@@ -25,11 +25,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
-## We use NONSTRICT_ALIGNMENT as the default because AArch64 only
-## enforces 4-byte alignment, even for 8-byte reads/writes.  The
-## common core does not support this, so we opt for non-strict
-## alignment instead.
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT,NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/aarch64/interp.c b/sim/aarch64/interp.c
index fd35f4fa683d..18c2fc0eacbd 100644
--- a/sim/aarch64/interp.c
+++ b/sim/aarch64/interp.c
@@ -330,6 +330,11 @@ sim_open (SIM_OPEN_KIND                  kind,
 
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* We use NONSTRICT_ALIGNMENT as the default because AArch64 only enforces
+     4-byte alignment, even for 8-byte reads/writes.  The common core does not
+     support this, so we opt for non-strict alignment instead.  */
+  current_alignment = NONSTRICT_ALIGNMENT;
+
   /* Perform the initialization steps one by one.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK
       || sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK
diff --git a/sim/arm/configure.ac b/sim/arm/configure.ac
index 88fac82e7b4c..7638b6d8e11b 100644
--- a/sim/arm/configure.ac
+++ b/sim/arm/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index a1147e402cc0..e697d55a6b5e 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -801,6 +801,9 @@ sim_open (SIM_OPEN_KIND kind,
   SIM_DESC sd = sim_state_alloc (kind, cb);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/avr/configure.ac b/sim/avr/configure.ac
index 92046a1762dd..9d6e1e6ded71 100644
--- a/sim/avr/configure.ac
+++ b/sim/avr/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/avr/interp.c b/sim/avr/interp.c
index d456c39390a7..1626fadaa973 100644
--- a/sim/avr/interp.c
+++ b/sim/avr/interp.c
@@ -1684,6 +1684,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
   SIM_DESC sd = sim_state_alloc_extra (kind, cb, sizeof (struct avr_sim_state));
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/bfin/configure.ac b/sim/bfin/configure.ac
index 18e82fae66b9..e2d53bcc7ca9 100644
--- a/sim/bfin/configure.ac
+++ b/sim/bfin/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_DEFAULT_MODEL(bf537)
 SIM_AC_OPTION_WARNINGS
 SIM_AC_OPTION_HARDWARE(\
diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index 34357201934c..2e9696f8bfe1 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -720,6 +720,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
   SIM_DESC sd = sim_state_alloc_extra (kind, callback,
 				       sizeof (struct bfin_board_data));
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/bpf/configure.ac b/sim/bpf/configure.ac
index a0f8576fc392..4e00c1316090 100644
--- a/sim/bpf/configure.ac
+++ b/sim/bpf/configure.ac
@@ -6,7 +6,6 @@ SIM_AC_COMMON
 
 SIM_AC_OPTION_BITSIZE([64])
 SIM_AC_OPTION_ENDIAN([], [LITTLE])
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL([bpf-def])
 SIM_AC_OPTION_WARNINGS(no)
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index b17b2e0f4530..f82c12968ff3 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -82,7 +82,6 @@ CPPFLAGS = @CPPFLAGS@
 CXXFLAGS = @CXXFLAGS@
 LDFLAGS = @LDFLAGS@
 
-SIM_ALIGNMENT = @sim_alignment@
 SIM_BITSIZE = @sim_bitsize@
 SIM_DEFAULT_MODEL = @sim_default_model@
 SIM_ENDIAN = @sim_endian@
@@ -221,7 +220,6 @@ CGEN_INCLUDE_DEPS = \
 CONFIG_CFLAGS = \
 	@DEFS@ \
 	$(SIM_DEFAULT_MODEL) \
-	$(SIM_ALIGNMENT) \
 	$(SIM_BITSIZE) \
 	$(SIM_ENDIAN) \
 	$(SIM_FLOAT) \
diff --git a/sim/common/sim-config.c b/sim/common/sim-config.c
index df99d6a957fd..c9005f449fe6 100644
--- a/sim/common/sim-config.c
+++ b/sim/common/sim-config.c
@@ -253,8 +253,9 @@ sim_config (SIM_DESC sd)
 #endif
   if (current_alignment == 0)
     current_alignment = WITH_ALIGNMENT;
+  /* If the port hasn't specified an alignment, default to not enforcing.  */
   if (current_alignment == 0)
-    current_alignment = WITH_DEFAULT_ALIGNMENT;
+    current_alignment = NONSTRICT_ALIGNMENT;
 
   /* verify the alignment */
   if (CURRENT_ALIGNMENT == 0)
@@ -331,11 +332,6 @@ sim_config_print (SIM_DESC sd)
   sim_io_printf (sd, "WITH_ALIGNMENT = %s\n",
 		 config_alignment_to_a (WITH_ALIGNMENT));
 
-#if defined (WITH_DEFAULT_ALIGNMENT)
-  sim_io_printf (sd, "WITH_DEFAULT_ALIGNMENT = %s\n",
-		 config_alignment_to_a (WITH_DEFAULT_ALIGNMENT));
-#endif
-
 #if defined (WITH_XOR_ENDIAN)
   sim_io_printf (sd, "WITH_XOR_ENDIAN = %d\n", WITH_XOR_ENDIAN);
 #endif
diff --git a/sim/common/sim-config.h b/sim/common/sim-config.h
index 6ab8d1a97eca..2b6ed3d0b7d4 100644
--- a/sim/common/sim-config.h
+++ b/sim/common/sim-config.h
@@ -195,11 +195,11 @@ extern char *simulator_sysroot;
 
 /* Alignment:
 
-   A processor architecture may or may not handle miss aligned
+   A processor architecture may or may not handle misaligned
    transfers.
 
    As alternatives: both little and big endian modes take an exception
-   (STRICT_ALIGNMENT); big and little endian models handle mis aligned
+   (STRICT_ALIGNMENT); big and little endian models handle misaligned
    transfers (NONSTRICT_ALIGNMENT); or the address is forced into
    alignment using a mask (FORCED_ALIGNMENT).
 
@@ -220,13 +220,6 @@ extern enum sim_alignments current_alignment;
 #define WITH_ALIGNMENT 0
 #endif
 
-#if !defined (WITH_DEFAULT_ALIGNMENT)
-#define WITH_DEFAULT_ALIGNMENT 0 /* fatal */
-#endif
-
-
-
-
 #define CURRENT_ALIGNMENT (WITH_ALIGNMENT \
 			   ? WITH_ALIGNMENT \
 			   : current_alignment)
diff --git a/sim/configure.ac b/sim/configure.ac
index 8022a11bc91a..e7f3f535ef59 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -108,6 +108,7 @@ AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
 
 dnl Standard (and optional) simulator options.
 dnl Eventually all simulators will support these.
+SIM_AC_OPTION_ALIGNMENT
 SIM_AC_OPTION_ASSERT
 SIM_AC_OPTION_DEBUG
 SIM_AC_OPTION_ENVIRONMENT
diff --git a/sim/cr16/configure.ac b/sim/cr16/configure.ac
index f4dc9c1314db..8cd4d23a479b 100644
--- a/sim/cr16/configure.ac
+++ b/sim/cr16/configure.ac
@@ -5,6 +5,5 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 
 SIM_AC_OUTPUT
diff --git a/sim/cris/configure.ac b/sim/cris/configure.ac
index b5eaea7b8adf..cc5bb4922f18 100644
--- a/sim/cris/configure.ac
+++ b/sim/cris/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_HARDWARE(rv cris cris_900000xx)
diff --git a/sim/d10v/configure.ac b/sim/d10v/configure.ac
index 811452094557..ec8a87e7d397 100644
--- a/sim/d10v/configure.ac
+++ b/sim/d10v/configure.ac
@@ -5,6 +5,5 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 
 SIM_AC_OUTPUT
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index b587cc18654f..c0cdc034700d 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -755,6 +755,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
   SIM_DESC sd = sim_state_alloc (kind, cb);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/example-synacor/configure.ac b/sim/example-synacor/configure.ac
index 13b311197e36..8cd4d23a479b 100644
--- a/sim/example-synacor/configure.ac
+++ b/sim/example-synacor/configure.ac
@@ -5,6 +5,5 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 
 SIM_AC_OUTPUT
diff --git a/sim/example-synacor/interp.c b/sim/example-synacor/interp.c
index eaf8f1fdf975..784c9cbc5755 100644
--- a/sim/example-synacor/interp.c
+++ b/sim/example-synacor/interp.c
@@ -82,6 +82,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
   int i;
   SIM_DESC sd = sim_state_alloc (kind, callback);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/frv/configure.ac b/sim/frv/configure.ac
index e5bbdbfba228..fcc2e8836bb7 100644
--- a/sim/frv/configure.ac
+++ b/sim/frv/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(fr500)
 SIM_AC_OPTION_WARNINGS(no)
diff --git a/sim/frv/sim-if.c b/sim/frv/sim-if.c
index c5fd93f0b310..2afec9ac78b6 100644
--- a/sim/frv/sim-if.c
+++ b/sim/frv/sim-if.c
@@ -54,6 +54,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, bfd *abfd,
   unsigned long elf_flags = 0;
   SIM_DESC sd = sim_state_alloc (kind, callback);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/ft32/configure.ac b/sim/ft32/configure.ac
index 658a0a459d01..9d6e1e6ded71 100644
--- a/sim/ft32/configure.ac
+++ b/sim/ft32/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/ft32/interp.c b/sim/ft32/interp.c
index 5fc9ea246583..8a44a472f605 100644
--- a/sim/ft32/interp.c
+++ b/sim/ft32/interp.c
@@ -808,6 +808,9 @@ sim_open (SIM_OPEN_KIND kind,
   size_t i;
   SIM_DESC sd = sim_state_alloc (kind, cb);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/h8300/configure.ac b/sim/h8300/configure.ac
index 43250f817416..7e2a166307ed 100644
--- a/sim/h8300/configure.ac
+++ b/sim/h8300/configure.ac
@@ -5,6 +5,5 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 
 SIM_AC_OUTPUT
diff --git a/sim/iq2000/configure.ac b/sim/iq2000/configure.ac
index 623fa192d74b..c61c9480d5e5 100644
--- a/sim/iq2000/configure.ac
+++ b/sim/iq2000/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(iq2000)
 SIM_AC_OPTION_WARNINGS(no)
diff --git a/sim/iq2000/sim-if.c b/sim/iq2000/sim-if.c
index b363eb04a218..61b4b48d5e83 100644
--- a/sim/iq2000/sim-if.c
+++ b/sim/iq2000/sim-if.c
@@ -60,6 +60,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
   int i;
   SIM_DESC sd = sim_state_alloc (kind, callback);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/lm32/configure.ac b/sim/lm32/configure.ac
index 63548874a114..4a2037468dee 100644
--- a/sim/lm32/configure.ac
+++ b/sim/lm32/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(lm32)
 SIM_AC_OPTION_WARNINGS(no)
diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c
index 1cccf626b670..74b605706e74 100644
--- a/sim/lm32/sim-if.c
+++ b/sim/lm32/sim-if.c
@@ -91,6 +91,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
   int i;
   unsigned long base, limit;
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/m32r/configure.ac b/sim/m32r/configure.ac
index 8ab55bc155a8..a5cea83849e7 100644
--- a/sim/m32r/configure.ac
+++ b/sim/m32r/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(m32r/d)
 SIM_AC_OPTION_WARNINGS(no)
diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c
index a6d8c486168c..355a52d9bc66 100644
--- a/sim/m32r/sim-if.c
+++ b/sim/m32r/sim-if.c
@@ -54,6 +54,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
   char c;
   int i;
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/m4/sim_ac_option_alignment.m4 b/sim/m4/sim_ac_option_alignment.m4
index dcfa47984a63..409fbfc1a432 100644
--- a/sim/m4/sim_ac_option_alignment.m4
+++ b/sim/m4/sim_ac_option_alignment.m4
@@ -15,52 +15,19 @@ dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
 dnl
 dnl Specify the alignment restrictions of the target architecture.
 dnl Without this option all possible alignment restrictions are accommodated.
-dnl arg[1] is hardwired target alignment
-dnl arg[2] is default target alignment
 AC_DEFUN([SIM_AC_OPTION_ALIGNMENT],
-wire_alignment="[$1]"
-default_alignment="[$2]"
-[
+[dnl
+AC_MSG_CHECKING([whether to force sim alignment])
+sim_alignment=
 AC_ARG_ENABLE(sim-alignment,
 [AS_HELP_STRING([--enable-sim-alignment=align],
 		[Specify strict, nonstrict or forced alignment of memory accesses])],
 [case "${enableval}" in
-  strict | STRICT)       sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
-  nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
-  forced | FORCED)       sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
-  yes) if test x"$wire_alignment" != x; then
-	 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
-       else
-         if test x"$default_alignment" != x; then
-           sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
-         else
-	   echo "No hard-wired alignment for target $target" 1>&6
-	   sim_alignment="-DWITH_ALIGNMENT=0"
-         fi
-       fi;;
-  no)  if test x"$default_alignment" != x; then
-	 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
-       else
-         if test x"$wire_alignment" != x; then
-	   sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
-         else
-           echo "No default alignment for target $target" 1>&6
-           sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
-         fi
-       fi;;
-  *)   AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
-  echo "Setting alignment flags = $sim_alignment" 6>&1
-fi],
-[if test x"$default_alignment" != x; then
-  sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
-else
-  if test x"$wire_alignment" != x; then
-    sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
-  else
-    sim_alignment=
-  fi
-fi])dnl
+  yes | strict | STRICT)      sim_alignment="STRICT_ALIGNMENT";;
+  no | nonstrict | NONSTRICT) sim_alignment="NONSTRICT_ALIGNMENT";;
+  forced | FORCED)            sim_alignment="FORCED_ALIGNMENT";;
+  *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment");;
+esac])dnl
+AC_DEFINE_UNQUOTED([WITH_ALIGNMENT], [${sim_alignment:-0}], [Sim alignment settings])
+AC_MSG_RESULT([${sim_alignment:-no}])
 ])dnl
-AC_SUBST(sim_alignment)
diff --git a/sim/m68hc11/configure.ac b/sim/m68hc11/configure.ac
index 57e13e207bdd..b2685040f61e 100644
--- a/sim/m68hc11/configure.ac
+++ b/sim/m68hc11/configure.ac
@@ -6,7 +6,6 @@ SIM_AC_COMMON
 
 dnl Options available in this module
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_HARDWARE(\
   m68hc11 m68hc11sio m68hc11eepr m68hc11tim m68hc11spi nvram)
 
diff --git a/sim/mcore/configure.ac b/sim/mcore/configure.ac
index 811452094557..ec8a87e7d397 100644
--- a/sim/mcore/configure.ac
+++ b/sim/mcore/configure.ac
@@ -5,6 +5,5 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 
 SIM_AC_OUTPUT
diff --git a/sim/microblaze/configure.ac b/sim/microblaze/configure.ac
index 88fac82e7b4c..7638b6d8e11b 100644
--- a/sim/microblaze/configure.ac
+++ b/sim/microblaze/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/mips/configure.ac b/sim/mips/configure.ac
index f4e67376c12e..f0b26b4f0acb 100644
--- a/sim/mips/configure.ac
+++ b/sim/mips/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 dnl Options available in this module
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_RESERVED_BITS(1)
 
diff --git a/sim/mn10300/configure.ac b/sim/mn10300/configure.ac
index 55aec73be500..b09159d7d47f 100644
--- a/sim/mn10300/configure.ac
+++ b/sim/mn10300/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_RESERVED_BITS
 SIM_AC_OPTION_BITSIZE(32,31)
diff --git a/sim/moxie/configure.ac b/sim/moxie/configure.ac
index fb5a91eacf8f..75a6f37ed265 100644
--- a/sim/moxie/configure.ac
+++ b/sim/moxie/configure.ac
@@ -7,6 +7,5 @@ SIM_AC_COMMON
 AC_CHECK_TOOL(DTC, dtc)
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 
 SIM_AC_OUTPUT
diff --git a/sim/msp430/configure.ac b/sim/msp430/configure.ac
index 0277d7f497e3..19839d11822a 100644
--- a/sim/msp430/configure.ac
+++ b/sim/msp430/configure.ac
@@ -24,7 +24,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/or1k/configure.ac b/sim/or1k/configure.ac
index 32fb0d49b95d..e09fee1ac13d 100644
--- a/sim/or1k/configure.ac
+++ b/sim/or1k/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_BITSIZE([32], [31], [32])
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL([or1200])
diff --git a/sim/pru/configure.ac b/sim/pru/configure.ac
index a4db77beec2f..79dab8b24039 100644
--- a/sim/pru/configure.ac
+++ b/sim/pru/configure.ac
@@ -24,7 +24,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/pru/interp.c b/sim/pru/interp.c
index 58ac333c1e6c..38269df44ce7 100644
--- a/sim/pru/interp.c
+++ b/sim/pru/interp.c
@@ -745,6 +745,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
   SIM_DESC sd = sim_state_alloc (kind, cb);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/riscv/configure.ac b/sim/riscv/configure.ac
index e5a07bbc46b0..3d678acb47be 100644
--- a/sim/riscv/configure.ac
+++ b/sim/riscv/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 # Select the default model for the target.
diff --git a/sim/sh/configure.ac b/sim/sh/configure.ac
index 4417ba4e561e..dd975d3259e6 100644
--- a/sim/sh/configure.ac
+++ b/sim/sh/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS(no)
 
 SIM_AC_OUTPUT
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index 87fb863887f7..264e9b1de465 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -2358,6 +2358,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
   SIM_DESC sd = sim_state_alloc (kind, cb);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/v850/configure.ac b/sim/v850/configure.ac
index 9a7c1ec3df4b..6d586f194fd0 100644
--- a/sim/v850/configure.ac
+++ b/sim/v850/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(,NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_RESERVED_BITS
 SIM_AC_OPTION_BITSIZE(32,31)
 
-- 
2.31.1


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

* [PATCH/committed] sim: ppc: unify env settings too
  2021-06-07  5:33 ` [PATCH 3/7] sim: unify environment " Mike Frysinger
@ 2021-06-12 17:17   ` Mike Frysinger
  0 siblings, 0 replies; 12+ messages in thread
From: Mike Frysinger @ 2021-06-12 17:17 UTC (permalink / raw)
  To: gdb-patches

The ppc port doesn't share a lot of the common logic, but there are
a few bits that bleed across.  Have it use the common configure for
environment settings too to avoid duplicate define errors after the
recent unification with the other ports.
---
 sim/ppc/ChangeLog    |  7 +++++++
 sim/ppc/config.in    |  3 ---
 sim/ppc/configure    | 26 +-------------------------
 sim/ppc/configure.ac | 17 +----------------
 sim/ppc/defs.h       | 14 +++++++++++++-
 sim/ppc/std-config.h |  1 +
 6 files changed, 23 insertions(+), 45 deletions(-)

diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index 9289b8ed2a72..fe7e7777d5bc 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,10 @@
+2021-06-12  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac: Delete sim-env configure option.
+	* defs.h: Include ../config.h.  Undefine PACKAGE* defines.
+	* std-config.h (ALL_ENVIRONMENT): Define.
+	* config.in, configure: Regenerate.
+
 2021-06-09  Mike Frysinger  <vapier@gentoo.org>
 
 	* basics.h (NULL): Delete.
diff --git a/sim/ppc/config.in b/sim/ppc/config.in
index 1a256d939009..b7530f0081a8 100644
--- a/sim/ppc/config.in
+++ b/sim/ppc/config.in
@@ -325,9 +325,6 @@
 /* Sim assert settings */
 #undef WITH_ASSERT
 
-/* Sim default environment */
-#undef WITH_ENVIRONMENT
-
 /* How to route I/O */
 #undef WITH_STDIO
 
diff --git a/sim/ppc/configure b/sim/ppc/configure
index 1c2cfda37ed8..4781393e69e1 100755
--- a/sim/ppc/configure
+++ b/sim/ppc/configure
@@ -753,7 +753,6 @@ enable_sim_decode_mechanism
 enable_sim_default_model
 enable_sim_duplicate
 enable_sim_endian
-enable_sim_env
 enable_sim_filter
 enable_sim_float
 enable_sim_hardware
@@ -1416,7 +1415,6 @@ Optional Features:
   --enable-sim-default-model=which	Specify default PowerPC to model.
   --enable-sim-duplicate		Expand (duplicate) semantic functions.
   --enable-sim-endian=endian		Specify target byte endian orientation.
-  --enable-sim-env=env			Specify target environment (operating, virtual, user).
   --enable-sim-filter=rule		Specify filter rules.
   --enable-sim-float			Specify whether the target has hard, soft, altivec or e500 floating point.
   --enable-sim-hardware=list		Specify the hardware to be included in the build.
@@ -3536,28 +3534,6 @@ else
 fi
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking default sim environment setting" >&5
-$as_echo_n "checking default sim environment setting... " >&6; }
-sim_env="0"
-# Check whether --enable-sim-env was given.
-if test "${enable_sim_env+set}" = set; then :
-  enableval=$enable_sim_env; case "${enableval}" in
-  operating | os | oea)	sim_env="OPERATING_ENVIRONMENT";;
-  virtual | vea)	sim_env="VIRTUAL_ENVIRONMENT";;
-  user | uea)		sim_env="USER_ENVIRONMENT";;
-  no)			sim_env="0";;
-  *)			as_fn_error $? "Unknown value $enableval passed to --enable-sim-env" "$LINENO" 5;;
-esac
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define WITH_ENVIRONMENT $sim_env
-_ACEOF
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $sim_env" >&5
-$as_echo "$sim_env" >&6; }
-
-
 # Check whether --enable-sim-filter was given.
 if test "${enable_sim_filter+set}" = set; then :
   enableval=$enable_sim_filter; case "${enableval}" in
@@ -4596,7 +4572,7 @@ if test "${enable_sim_monitor+set}" = set; then :
   no)		sim_monitor="-DWITH_MON=0";;
   instruction)	sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
   memory)	sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
-  *)		as_fn_error $? "\"Unknown value $enableval passed to --enable-sim-mon\"" "$LINENO" 5; sim_env="";;
+  *)		as_fn_error $? "\"Unknown value $enableval passed to --enable-sim-mon\"" "$LINENO" 5;;
 esac
 if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then
   echo "Setting monitor flags = $sim_monitor" 6>&1
diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
index 9bd0ab734eb0..8ff54d90658b 100644
--- a/sim/ppc/configure.ac
+++ b/sim/ppc/configure.ac
@@ -137,21 +137,6 @@ if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
 fi],[sim_endian=""])dnl
 
 
-AC_MSG_CHECKING([default sim environment setting])
-sim_env="0"
-AC_ARG_ENABLE(sim-env,
-[  --enable-sim-env=env			Specify target environment (operating, virtual, user).],
-[case "${enableval}" in
-  operating | os | oea)	sim_env="OPERATING_ENVIRONMENT";;
-  virtual | vea)	sim_env="VIRTUAL_ENVIRONMENT";;
-  user | uea)		sim_env="USER_ENVIRONMENT";;
-  no)			sim_env="0";;
-  *)			AC_MSG_ERROR([Unknown value $enableval passed to --enable-sim-env]);;
-esac])dnl
-AC_DEFINE_UNQUOTED([WITH_ENVIRONMENT], [$sim_env], [Sim default environment])
-AC_MSG_RESULT($sim_env)
-
-
 AC_ARG_ENABLE(sim-filter,
 [  --enable-sim-filter=rule		Specify filter rules.],
 [case "${enableval}" in
@@ -457,7 +442,7 @@ AC_ARG_ENABLE(sim-monitor,
   no)		sim_monitor="-DWITH_MON=0";;
   instruction)	sim_monitor="-DWITH_MON=MONITOR_INSTRUCTION_ISSUE";;
   memory)	sim_monitor="-DWITH_MON=MONITOR_LOAD_STORE_UNIT";;
-  *)		AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon"); sim_env="";;
+  *)		AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-mon");;
 esac
 if test x"$silent" != x"yes" && test x"$sim_monitor" != x""; then
   echo "Setting monitor flags = $sim_monitor" 6>&1
diff --git a/sim/ppc/defs.h b/sim/ppc/defs.h
index 66e76d26dbad..9a89844adb70 100644
--- a/sim/ppc/defs.h
+++ b/sim/ppc/defs.h
@@ -20,7 +20,19 @@
 #ifndef DEFS_H
 #define DEFS_H
 
-/* Include sim's various configure tests.  */
+/* Include arch-specific sim's various configure tests.  */
 #include "config.h"
 
+/* Reset macros that our config.h will provide.  */
+#undef PACKAGE
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_URL
+#undef PACKAGE_VERSION
+
+/* Include common sim's various configure tests.  */
+#include "../config.h"
+
 #endif
diff --git a/sim/ppc/std-config.h b/sim/ppc/std-config.h
index 7e6b8c2cf757..6cf7f27fe558 100644
--- a/sim/ppc/std-config.h
+++ b/sim/ppc/std-config.h
@@ -107,6 +107,7 @@ extern int current_target_byte_order;
    CURRENT_ENVIRONMENT specifies which of vea or oea is required for
    the current runtime. */
 
+#define ALL_ENVIRONMENT			0
 #define USER_ENVIRONMENT		1
 #define VIRTUAL_ENVIRONMENT		2
 #define OPERATING_ENVIRONMENT		3
-- 
2.31.1


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

* [PATCH/committed] sim: ppc: unify header & function & type tests too
  2021-06-07  5:33 [PATCH 1/7] sim: unify platform function & header tests Mike Frysinger
                   ` (5 preceding siblings ...)
  2021-06-07  5:33 ` [PATCH 7/7] sim: overhaul alignment settings management Mike Frysinger
@ 2021-06-12 18:40 ` Mike Frysinger
  6 siblings, 0 replies; 12+ messages in thread
From: Mike Frysinger @ 2021-06-12 18:40 UTC (permalink / raw)
  To: gdb-patches

Since ppc now shares a config.h with the top-level, move all of its
relevant settings up a level.  The ppc port tests a lot more funcs,
but that's because its syscall emulation is a lot more complete.
We'll probably utilize some of these in the common code too.
---
 sim/ChangeLog             |   6 +
 sim/config.h.in           | 188 ++++++++-
 sim/configure             | 652 ++++++++++++++++++++++++++++++-
 sim/m4/sim_ac_platform.m4 |  58 ++-
 sim/ppc/ChangeLog         |   6 +
 sim/ppc/config.in         | 259 -------------
 sim/ppc/configure         | 797 +-------------------------------------
 sim/ppc/configure.ac      |  17 -
 8 files changed, 902 insertions(+), 1081 deletions(-)

diff --git a/sim/ChangeLog b/sim/ChangeLog
index e832e131c8a5..908b50b044f9 100644
--- a/sim/ChangeLog
+++ b/sim/ChangeLog
@@ -1,3 +1,9 @@
+2021-06-12  Mike Frysinger  <vapier@gentoo.org>
+
+	* m4/sim_ac_platform.m4: Check more headers, funcs, structs, and
+	types.
+	* config.h.in, configure: Regenerate.
+
 2021-06-12  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure.ac: Call SIM_AC_OPTION_ENVIRONMENT.
diff --git a/sim/config.h.in b/sim/config.h.in
index 5fd8c8dafb52..4ca8fc690a47 100644
--- a/sim/config.h.in
+++ b/sim/config.h.in
@@ -3,24 +3,63 @@
 /* Define if building universal (internal helper macro) */
 #undef AC_APPLE_UNIVERSAL_BUILD
 
+/* Define to the type of elements in the array set by `getgroups'. Usually
+   this is either `int' or `gid_t'. */
+#undef GETGROUPS_T
+
+/* Define to 1 if you have the `access' function. */
+#undef HAVE_ACCESS
+
 /* Define to 1 if you have the `aint' function. */
 #undef HAVE_AINT
 
 /* Define to 1 if you have the `anint' function. */
 #undef HAVE_ANINT
 
+/* Define to 1 if you have the `cfgetispeed' function. */
+#undef HAVE_CFGETISPEED
+
+/* Define to 1 if you have the `cfgetospeed' function. */
+#undef HAVE_CFGETOSPEED
+
+/* Define to 1 if you have the `cfsetispeed' function. */
+#undef HAVE_CFSETISPEED
+
+/* Define to 1 if you have the `cfsetospeed' function. */
+#undef HAVE_CFSETOSPEED
+
+/* Define to 1 if you have the `chdir' function. */
+#undef HAVE_CHDIR
+
 /* Define to 1 if you have the `chmod' function. */
 #undef HAVE_CHMOD
 
+/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
+   */
+#undef HAVE_DECL_TZNAME
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_DIRENT_H
+
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define to 1 if you have the `dup' function. */
+#undef HAVE_DUP
+
+/* Define to 1 if you have the `dup2' function. */
+#undef HAVE_DUP2
+
 /* Define to 1 if you have the `execv' function. */
 #undef HAVE_EXECV
 
 /* Define to 1 if you have the `execve' function. */
 #undef HAVE_EXECVE
 
+/* Define to 1 if you have the `fcntl' function. */
+#undef HAVE_FCNTL
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -30,9 +69,18 @@
 /* Define to 1 if you have the <fpu_control.h> header file. */
 #undef HAVE_FPU_CONTROL_H
 
+/* Define to 1 if you have the `fstat' function. */
+#undef HAVE_FSTAT
+
+/* Define to 1 if you have the `fstatfs' function. */
+#undef HAVE_FSTATFS
+
 /* Define to 1 if you have the `ftruncate' function. */
 #undef HAVE_FTRUNCATE
 
+/* Define to 1 if you have the `getdirentries' function. */
+#undef HAVE_GETDIRENTRIES
+
 /* Define to 1 if you have the `getegid' function. */
 #undef HAVE_GETEGID
 
@@ -42,18 +90,33 @@
 /* Define to 1 if you have the `getgid' function. */
 #undef HAVE_GETGID
 
+/* Define to 1 if you have the `getpid' function. */
+#undef HAVE_GETPID
+
+/* Define to 1 if you have the `getppid' function. */
+#undef HAVE_GETPPID
+
 /* Define to 1 if you have the `getrusage' function. */
 #undef HAVE_GETRUSAGE
 
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
 /* Define to 1 if you have the `getuid' function. */
 #undef HAVE_GETUID
 
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `ioctl' function. */
+#undef HAVE_IOCTL
+
 /* Define to 1 if you have the `kill' function. */
 #undef HAVE_KILL
 
+/* Define to 1 if you have the `link' function. */
+#undef HAVE_LINK
+
 /* Define to 1 if you have the <linux/if_tun.h> header file. */
 #undef HAVE_LINUX_IF_TUN_H
 
@@ -63,8 +126,8 @@
 /* Define to 1 if you have the <linux/types.h> header file. */
 #undef HAVE_LINUX_TYPES_H
 
-/* Define to 1 if you have the `lstat' function. */
-#undef HAVE_LSTAT
+/* Define to 1 if you have the `lseek' function. */
+#undef HAVE_LSEEK
 
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
@@ -75,6 +138,9 @@
 /* Define to 1 if you have the `munmap' function. */
 #undef HAVE_MUNMAP
 
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
+
 /* Define to 1 if you have the <netinet/in.h> header file. */
 #undef HAVE_NETINET_IN_H
 
@@ -84,27 +150,45 @@
 /* Define to 1 if you have the <net/if.h> header file. */
 #undef HAVE_NET_IF_H
 
+/* Define to 1 if you have the `pipe' function. */
+#undef HAVE_PIPE
+
 /* Define to 1 if you have the `posix_fallocate' function. */
 #undef HAVE_POSIX_FALLOCATE
 
 /* Define to 1 if you have the `pread' function. */
 #undef HAVE_PREAD
 
+/* Define to 1 if you have the `rmdir' function. */
+#undef HAVE_RMDIR
+
 /* Define to 1 if you have the `setgid' function. */
 #undef HAVE_SETGID
 
+/* Define to 1 if you have the `setregid' function. */
+#undef HAVE_SETREGID
+
+/* Define to 1 if you have the `setreuid' function. */
+#undef HAVE_SETREUID
+
 /* Define to 1 if you have the `setuid' function. */
 #undef HAVE_SETUID
 
 /* Define to 1 if you have the `sigaction' function. */
 #undef HAVE_SIGACTION
 
+/* Define to 1 if you have the `sigprocmask' function. */
+#undef HAVE_SIGPROCMASK
+
 /* Define to 1 if the system has the type `socklen_t'. */
 #undef HAVE_SOCKLEN_T
 
 /* Define to 1 if you have the `sqrt' function. */
 #undef HAVE_SQRT
 
+/* Define to 1 if you have the `stat' function. */
+#undef HAVE_STAT
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
@@ -159,12 +243,41 @@
 /* Define to 1 if `st_uid' is a member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_UID
 
+/* Define to 1 if `tm_zone' is a member of `struct tm'. */
+#undef HAVE_STRUCT_TM_TM_ZONE
+
+/* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use
+   `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */
+#undef HAVE_ST_BLKSIZE
+
+/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use
+   `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */
+#undef HAVE_ST_BLOCKS
+
+/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
+   `HAVE_STRUCT_STAT_ST_RDEV' instead. */
+#undef HAVE_ST_RDEV
+
+/* Define to 1 if you have the `symlink' function. */
+#undef HAVE_SYMLINK
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_SYS_DIR_H
+
 /* Define to 1 if you have the <sys/ioctl.h> header file. */
 #undef HAVE_SYS_IOCTL_H
 
 /* Define to 1 if you have the <sys/mman.h> header file. */
 #undef HAVE_SYS_MMAN_H
 
+/* Define to 1 if you have the <sys/mount.h> header file. */
+#undef HAVE_SYS_MOUNT_H
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_SYS_NDIR_H
+
 /* Define to 1 if you have the <sys/param.h> header file. */
 #undef HAVE_SYS_PARAM_H
 
@@ -177,24 +290,74 @@
 /* Define to 1 if you have the <sys/socket.h> header file. */
 #undef HAVE_SYS_SOCKET_H
 
+/* Define to 1 if you have the <sys/statfs.h> header file. */
+#undef HAVE_SYS_STATFS_H
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
+/* Define to 1 if you have the <sys/termios.h> header file. */
+#undef HAVE_SYS_TERMIOS_H
+
+/* Define to 1 if you have the <sys/termio.h> header file. */
+#undef HAVE_SYS_TERMIO_H
+
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the <sys/vfs.h> header file. */
+#undef HAVE_SYS_VFS_H
+
+/* Define to 1 if you have the `tcdrain' function. */
+#undef HAVE_TCDRAIN
+
+/* Define to 1 if you have the `tcflow' function. */
+#undef HAVE_TCFLOW
+
+/* Define to 1 if you have the `tcflush' function. */
+#undef HAVE_TCFLUSH
+
+/* Define to 1 if you have the `tcgetattr' function. */
+#undef HAVE_TCGETATTR
+
+/* Define to 1 if you have the `tcgetpgrp' function. */
+#undef HAVE_TCGETPGRP
+
+/* Define to 1 if you have the `tcsendbreak' function. */
+#undef HAVE_TCSENDBREAK
+
+/* Define to 1 if you have the `tcsetattr' function. */
+#undef HAVE_TCSETATTR
+
+/* Define to 1 if you have the `tcsetpgrp' function. */
+#undef HAVE_TCSETPGRP
+
 /* Define to 1 if you have the <termios.h> header file. */
 #undef HAVE_TERMIOS_H
 
 /* Define to 1 if you have the `time' function. */
 #undef HAVE_TIME
 
+/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
+   `HAVE_STRUCT_TM_TM_ZONE' instead. */
+#undef HAVE_TM_ZONE
+
 /* Define to 1 if you have the `truncate' function. */
 #undef HAVE_TRUNCATE
 
+/* Define to 1 if you don't have `tm_zone' but do have the external array
+   `tzname'. */
+#undef HAVE_TZNAME
+
+/* Define to 1 if you have the `umask' function. */
+#undef HAVE_UMASK
+
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
+/* Define to 1 if you have the `unlink' function. */
+#undef HAVE_UNLINK
+
 /* Define to 1 if you have the `utime' function. */
 #undef HAVE_UTIME
 
@@ -234,6 +397,9 @@
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
+#undef TM_IN_SYS_TIME
+
 /* Enable extensions on AIX 3, Interix.  */
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
@@ -286,3 +452,21 @@
 
 /* Define to 1 if you need to in order for `stat' and other things to work. */
 #undef _POSIX_SOURCE
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef gid_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef mode_t
+
+/* Define to `long int' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#undef uid_t
diff --git a/sim/configure b/sim/configure
index 0b9a118b8777..aac219bd0960 100755
--- a/sim/configure
+++ b/sim/configure
@@ -628,7 +628,6 @@ enable_option_checking=no
 ac_subst_vars='am__EXEEXT_FALSE
 am__EXEEXT_TRUE
 LTLIBOBJS
-LIBOBJS
 SIM_ENABLE_IGEN_FALSE
 SIM_ENABLE_IGEN_TRUE
 subdirs
@@ -670,6 +669,7 @@ am__isrc
 MAINT
 MAINTAINER_MODE_FALSE
 MAINTAINER_MODE_TRUE
+LIBOBJS
 C_DIALECT
 RANLIB
 AR
@@ -1929,6 +1929,52 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_member
 
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  as_decl_name=`echo $2|sed 's/ *(.*//'`
+  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+  (void) $as_decl_use;
+#else
+  (void) $as_decl_name;
+#endif
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
+
 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
 # -------------------------------------------
 # Tests whether TYPE exists after having included INCLUDES, setting cache
@@ -2280,37 +2326,77 @@ as_fn_append ac_header_list " netinet/in.h"
 as_fn_append ac_header_list " netinet/tcp.h"
 as_fn_append ac_header_list " sys/ioctl.h"
 as_fn_append ac_header_list " sys/mman.h"
+as_fn_append ac_header_list " sys/mount.h"
 as_fn_append ac_header_list " sys/param.h"
 as_fn_append ac_header_list " sys/resource.h"
 as_fn_append ac_header_list " sys/select.h"
 as_fn_append ac_header_list " sys/socket.h"
 as_fn_append ac_header_list " sys/stat.h"
+as_fn_append ac_header_list " sys/statfs.h"
+as_fn_append ac_header_list " sys/termio.h"
+as_fn_append ac_header_list " sys/termios.h"
+as_fn_append ac_header_list " sys/types.h"
+as_fn_append ac_header_list " sys/vfs.h"
 as_fn_append ac_func_list " __setfpucw"
+as_fn_append ac_func_list " access"
 as_fn_append ac_func_list " aint"
 as_fn_append ac_func_list " anint"
+as_fn_append ac_func_list " cfgetispeed"
+as_fn_append ac_func_list " cfgetospeed"
+as_fn_append ac_func_list " cfsetispeed"
+as_fn_append ac_func_list " cfsetospeed"
+as_fn_append ac_func_list " chdir"
 as_fn_append ac_func_list " chmod"
+as_fn_append ac_func_list " dup"
+as_fn_append ac_func_list " dup2"
 as_fn_append ac_func_list " execv"
 as_fn_append ac_func_list " execve"
+as_fn_append ac_func_list " fcntl"
 as_fn_append ac_func_list " fork"
+as_fn_append ac_func_list " fstat"
+as_fn_append ac_func_list " fstatfs"
 as_fn_append ac_func_list " ftruncate"
-as_fn_append ac_func_list " geteuid"
+as_fn_append ac_func_list " getdirentries"
 as_fn_append ac_func_list " getegid"
+as_fn_append ac_func_list " geteuid"
 as_fn_append ac_func_list " getgid"
+as_fn_append ac_func_list " getpid"
+as_fn_append ac_func_list " getppid"
 as_fn_append ac_func_list " getrusage"
+as_fn_append ac_func_list " gettimeofday"
 as_fn_append ac_func_list " getuid"
+as_fn_append ac_func_list " ioctl"
 as_fn_append ac_func_list " kill"
-as_fn_append ac_func_list " lstat"
+as_fn_append ac_func_list " link"
+as_fn_append ac_func_list " lseek"
 as_fn_append ac_func_list " mmap"
 as_fn_append ac_func_list " munmap"
+as_fn_append ac_func_list " pipe"
 as_fn_append ac_func_list " posix_fallocate"
 as_fn_append ac_func_list " pread"
-as_fn_append ac_func_list " setuid"
+as_fn_append ac_func_list " rmdir"
+as_fn_append ac_func_list " setregid"
+as_fn_append ac_func_list " setreuid"
 as_fn_append ac_func_list " setgid"
+as_fn_append ac_func_list " setuid"
 as_fn_append ac_func_list " sigaction"
+as_fn_append ac_func_list " sigprocmask"
 as_fn_append ac_func_list " sqrt"
+as_fn_append ac_func_list " stat"
 as_fn_append ac_func_list " strsignal"
+as_fn_append ac_func_list " symlink"
+as_fn_append ac_func_list " tcdrain"
+as_fn_append ac_func_list " tcflow"
+as_fn_append ac_func_list " tcflush"
+as_fn_append ac_func_list " tcgetattr"
+as_fn_append ac_func_list " tcgetpgrp"
+as_fn_append ac_func_list " tcsendbreak"
+as_fn_append ac_func_list " tcsetattr"
+as_fn_append ac_func_list " tcsetpgrp"
 as_fn_append ac_func_list " time"
 as_fn_append ac_func_list " truncate"
+as_fn_append ac_func_list " umask"
+as_fn_append ac_func_list " unlink"
 as_fn_append ac_func_list " utime"
 # Check that the precious variables saved in the cache have kept the same
 # value.
@@ -4469,6 +4555,18 @@ done
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -4552,6 +4650,411 @@ done
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
+$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
+if ${ac_cv_struct_tm+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <time.h>
+
+int
+main ()
+{
+struct tm tm;
+				     int *p = &tm.tm_sec;
+				     return !p;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_struct_tm=time.h
+else
+  ac_cv_struct_tm=sys/time.h
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
+$as_echo "$ac_cv_struct_tm" >&6; }
+if test $ac_cv_struct_tm = sys/time.h; then
+
+$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
+$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
+if ${ac_cv_type_uid_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "uid_t" >/dev/null 2>&1; then :
+  ac_cv_type_uid_t=yes
+else
+  ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
+$as_echo "$ac_cv_type_uid_t" >&6; }
+if test $ac_cv_type_uid_t = no; then
+
+$as_echo "#define uid_t int" >>confdefs.h
+
+
+$as_echo "#define gid_t int" >>confdefs.h
+
+fi
+
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+  as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
+if eval \${$as_ac_Header+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_ac_Header=yes"
+else
+  eval "$as_ac_Header=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$as_ac_Header
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if ${ac_cv_search_opendir+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' dir; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_opendir+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_opendir+:} false; then :
+
+else
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if ${ac_cv_search_opendir+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' x; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_opendir=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if ${ac_cv_search_opendir+:} false; then :
+  break
+fi
+done
+if ${ac_cv_search_opendir+:} false; then :
+
+else
+  ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
+
+
+
+ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+_ACEOF
+
+
+$as_echo "#define HAVE_ST_BLKSIZE 1" >>confdefs.h
+
+fi
+
+
+ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BLOCKS 1
+_ACEOF
+
+
+$as_echo "#define HAVE_ST_BLOCKS 1" >>confdefs.h
+
+else
+  case " $LIBOBJS " in
+  *" fileblocks.$ac_objext "* ) ;;
+  *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext"
+ ;;
+esac
+
+fi
+
+
+ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_RDEV 1
+_ACEOF
+
+
+$as_echo "#define HAVE_ST_RDEV 1" >>confdefs.h
+
+fi
+
+
+ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include <sys/types.h>
+#include <$ac_cv_struct_tm>
+
+"
+if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_TM_TM_ZONE 1
+_ACEOF
+
+
+fi
+
+if test "$ac_cv_member_struct_tm_tm_zone" = yes; then
+
+$as_echo "#define HAVE_TM_ZONE 1" >>confdefs.h
+
+else
+  ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include <time.h>
+"
+if test "x$ac_cv_have_decl_tzname" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_TZNAME $ac_have_decl
+_ACEOF
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5
+$as_echo_n "checking for tzname... " >&6; }
+if ${ac_cv_var_tzname+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <time.h>
+#if !HAVE_DECL_TZNAME
+extern char *tzname[];
+#endif
+
+int
+main ()
+{
+return tzname[0][0];
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_var_tzname=yes
+else
+  ac_cv_var_tzname=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_var_tzname" >&5
+$as_echo "$ac_cv_var_tzname" >&6; }
+  if test $ac_cv_var_tzname = yes; then
+
+$as_echo "#define HAVE_TZNAME 1" >>confdefs.h
+
+  fi
+fi
+
+
 ac_fn_c_check_member "$LINENO" "struct stat" "st_dev" "ac_cv_member_struct_stat_st_dev" "#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
@@ -4773,6 +5276,106 @@ _ACEOF
 fi
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking type of array argument to getgroups" >&5
+$as_echo_n "checking type of array argument to getgroups... " >&6; }
+if ${ac_cv_type_getgroups+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  ac_cv_type_getgroups=cross
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Thanks to Mike Rendell for this test.  */
+$ac_includes_default
+#define NGID 256
+#undef MAX
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+
+int
+main ()
+{
+  gid_t gidset[NGID];
+  int i, n;
+  union { gid_t gval; long int lval; }  val;
+
+  val.lval = -1;
+  for (i = 0; i < NGID; i++)
+    gidset[i] = val.gval;
+  n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
+		 gidset);
+  /* Exit non-zero if getgroups seems to require an array of ints.  This
+     happens when gid_t is short int but getgroups modifies an array
+     of ints.  */
+  return n > 0 && gidset[n] != val.gval;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_type_getgroups=gid_t
+else
+  ac_cv_type_getgroups=int
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+if test $ac_cv_type_getgroups = cross; then
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <unistd.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "getgroups.*int.*gid_t" >/dev/null 2>&1; then :
+  ac_cv_type_getgroups=gid_t
+else
+  ac_cv_type_getgroups=int
+fi
+rm -f conftest*
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_getgroups" >&5
+$as_echo "$ac_cv_type_getgroups" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define GETGROUPS_T $ac_cv_type_getgroups
+_ACEOF
+
+
+ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
+if test "x$ac_cv_type_mode_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
+if test "x$ac_cv_type_off_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
 $as_echo_n "checking return type of signal handlers... " >&6; }
 if ${ac_cv_type_signal+:} false; then :
@@ -4806,6 +5409,47 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
+$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
+if ${ac_cv_type_uid_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "uid_t" >/dev/null 2>&1; then :
+  ac_cv_type_uid_t=yes
+else
+  ac_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
+$as_echo "$ac_cv_type_uid_t" >&6; }
+if test $ac_cv_type_uid_t = no; then
+
+$as_echo "#define uid_t int" >>confdefs.h
+
+
+$as_echo "#define gid_t int" >>confdefs.h
+
+fi
+
 
 
 
diff --git a/sim/m4/sim_ac_platform.m4 b/sim/m4/sim_ac_platform.m4
index c68aef1427af..95760a65a963 100644
--- a/sim/m4/sim_ac_platform.m4
+++ b/sim/m4/sim_ac_platform.m4
@@ -33,43 +33,89 @@ AC_CHECK_HEADERS_ONCE(m4_flatten([
   netinet/tcp.h
   sys/ioctl.h
   sys/mman.h
+  sys/mount.h
   sys/param.h
   sys/resource.h
   sys/select.h
   sys/socket.h
   sys/stat.h
+  sys/statfs.h
+  sys/termio.h
+  sys/termios.h
+  sys/types.h
+  sys/vfs.h
 ]))
+AC_HEADER_DIRENT
 
 AC_CHECK_FUNCS_ONCE(m4_flatten([
   __setfpucw
+  access
   aint
   anint
+  cfgetispeed
+  cfgetospeed
+  cfsetispeed
+  cfsetospeed
+  chdir
   chmod
+  dup
+  dup2
   execv
   execve
+  fcntl
   fork
+  fstat
+  fstatfs
   ftruncate
-  geteuid
+  getdirentries
   getegid
+  geteuid
   getgid
+  getpid
+  getppid
   getrusage
+  gettimeofday
   getuid
+  ioctl
   kill
-  lstat
+  link
+  lseek
   mmap
   munmap
+  pipe
   posix_fallocate
   pread
-  setuid
+  rmdir
+  setregid
+  setreuid
   setgid
+  setuid
   sigaction
+  sigprocmask
   sqrt
+  stat
   strsignal
+  symlink
+  tcdrain
+  tcflow
+  tcflush
+  tcgetattr
+  tcgetpgrp
+  tcsendbreak
+  tcsetattr
+  tcsetpgrp
   time
   truncate
+  umask
+  unlink
   utime
 ]))
 
+AC_STRUCT_ST_BLKSIZE
+AC_STRUCT_ST_BLOCKS
+AC_STRUCT_ST_RDEV
+AC_STRUCT_TIMEZONE
+
 AC_CHECK_MEMBERS([[struct stat.st_dev], [struct stat.st_ino],
 [struct stat.st_mode], [struct stat.st_nlink], [struct stat.st_uid],
 [struct stat.st_gid], [struct stat.st_rdev], [struct stat.st_size],
@@ -89,5 +135,11 @@ AC_CHECK_TYPES(socklen_t, [], [],
 ])
 
 dnl Types used by common code
+AC_TYPE_GETGROUPS
+AC_TYPE_MODE_T
+AC_TYPE_OFF_T
+AC_TYPE_PID_T
 AC_TYPE_SIGNAL
+AC_TYPE_SIZE_T
+AC_TYPE_UID_T
 ])
diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog
index fe7e7777d5bc..2a5b8cac2ac1 100644
--- a/sim/ppc/ChangeLog
+++ b/sim/ppc/ChangeLog
@@ -1,3 +1,9 @@
+2021-06-12  Mike Frysinger  <vapier@gentoo.org>
+
+	* configure.ac: Delete AC_STRUCT_*, AC_TYPE_*, AC_CHECK_FUNCS,
+	AC_CHECK_HEADERS, and AC_HEADER_DIRENT calls.
+	* config.in, configure: Regenerate.
+
 2021-06-12  Mike Frysinger  <vapier@gentoo.org>
 
 	* configure.ac: Delete sim-env configure option.
diff --git a/sim/ppc/config.in b/sim/ppc/config.in
index b7530f0081a8..2d3fbbdba36a 100644
--- a/sim/ppc/config.in
+++ b/sim/ppc/config.in
@@ -7,147 +7,18 @@
    language is requested. */
 #undef ENABLE_NLS
 
-/* Define to the type of elements in the array set by `getgroups'. Usually
-   this is either `int' or `gid_t'. */
-#undef GETGROUPS_T
-
-/* Define to 1 if you have the `access' function. */
-#undef HAVE_ACCESS
-
-/* Define to 1 if you have the `cfgetispeed' function. */
-#undef HAVE_CFGETISPEED
-
-/* Define to 1 if you have the `cfgetospeed' function. */
-#undef HAVE_CFGETOSPEED
-
-/* Define to 1 if you have the `cfsetispeed' function. */
-#undef HAVE_CFSETISPEED
-
-/* Define to 1 if you have the `cfsetospeed' function. */
-#undef HAVE_CFSETOSPEED
-
-/* Define to 1 if you have the `chdir' function. */
-#undef HAVE_CHDIR
-
-/* Define to 1 if you have the `chmod' function. */
-#undef HAVE_CHMOD
-
-/* Define to 1 if you have the `chown' function. */
-#undef HAVE_CHOWN
-
-/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
-   */
-#undef HAVE_DECL_TZNAME
-
-/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
-   */
-#undef HAVE_DIRENT_H
-
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
-/* Define to 1 if you have the `dup' function. */
-#undef HAVE_DUP
-
-/* Define to 1 if you have the `dup2' function. */
-#undef HAVE_DUP2
-
-/* Define to 1 if you have the `fchmod' function. */
-#undef HAVE_FCHMOD
-
-/* Define to 1 if you have the `fchown' function. */
-#undef HAVE_FCHOWN
-
-/* Define to 1 if you have the `fcntl' function. */
-#undef HAVE_FCNTL
-
-/* Define to 1 if you have the <fcntl.h> header file. */
-#undef HAVE_FCNTL_H
-
-/* Define to 1 if you have the `fstat' function. */
-#undef HAVE_FSTAT
-
-/* Define to 1 if you have the `fstatfs' function. */
-#undef HAVE_FSTATFS
-
-/* Define to 1 if you have the `getdirentries' function. */
-#undef HAVE_GETDIRENTRIES
-
-/* Define to 1 if you have the `getegid' function. */
-#undef HAVE_GETEGID
-
-/* Define to 1 if you have the `geteuid' function. */
-#undef HAVE_GETEUID
-
-/* Define to 1 if you have the `getgid' function. */
-#undef HAVE_GETGID
-
-/* Define to 1 if you have the `getpid' function. */
-#undef HAVE_GETPID
-
-/* Define to 1 if you have the `getppid' function. */
-#undef HAVE_GETPPID
-
-/* Define to 1 if you have the `getrusage' function. */
-#undef HAVE_GETRUSAGE
-
-/* Define to 1 if you have the `gettimeofday' function. */
-#undef HAVE_GETTIMEOFDAY
-
-/* Define to 1 if you have the `getuid' function. */
-#undef HAVE_GETUID
-
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
-/* Define to 1 if you have the `ioctl' function. */
-#undef HAVE_IOCTL
-
-/* Define to 1 if you have the `kill' function. */
-#undef HAVE_KILL
-
-/* Define to 1 if you have the `link' function. */
-#undef HAVE_LINK
-
 /* Define to 1 if the system has the type `long long'. */
 #undef HAVE_LONG_LONG
 
-/* Define to 1 if you have the `lseek' function. */
-#undef HAVE_LSEEK
-
-/* Define to 1 if you have the `lstat' function. */
-#undef HAVE_LSTAT
-
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
-/* Define to 1 if you have the `mkdir' function. */
-#undef HAVE_MKDIR
-
-/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
-#undef HAVE_NDIR_H
-
-/* Define to 1 if you have the `pipe' function. */
-#undef HAVE_PIPE
-
-/* Define to 1 if you have the `readlink' function. */
-#undef HAVE_READLINK
-
-/* Define to 1 if you have the `rmdir' function. */
-#undef HAVE_RMDIR
-
-/* Define to 1 if you have the `setregid' function. */
-#undef HAVE_SETREGID
-
-/* Define to 1 if you have the `setreuid' function. */
-#undef HAVE_SETREUID
-
-/* Define to 1 if you have the `sigprocmask' function. */
-#undef HAVE_SIGPROCMASK
-
-/* Define to 1 if you have the `stat' function. */
-#undef HAVE_STAT
-
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
@@ -163,124 +34,18 @@
 /* Define if struct statfs is defined in <sys/mount.h> */
 #undef HAVE_STRUCT_STATFS
 
-/* Define to 1 if `st_blksize' is a member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_BLKSIZE
-
-/* Define to 1 if `st_blocks' is a member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_BLOCKS
-
-/* Define to 1 if `st_rdev' is a member of `struct stat'. */
-#undef HAVE_STRUCT_STAT_ST_RDEV
-
-/* Define to 1 if `tm_zone' is a member of `struct tm'. */
-#undef HAVE_STRUCT_TM_TM_ZONE
-
-/* Define to 1 if your `struct stat' has `st_blksize'. Deprecated, use
-   `HAVE_STRUCT_STAT_ST_BLKSIZE' instead. */
-#undef HAVE_ST_BLKSIZE
-
-/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use
-   `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */
-#undef HAVE_ST_BLOCKS
-
-/* Define to 1 if your `struct stat' has `st_rdev'. Deprecated, use
-   `HAVE_STRUCT_STAT_ST_RDEV' instead. */
-#undef HAVE_ST_RDEV
-
-/* Define to 1 if you have the `symlink' function. */
-#undef HAVE_SYMLINK
-
-/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
-   */
-#undef HAVE_SYS_DIR_H
-
-/* Define to 1 if you have the <sys/ioctl.h> header file. */
-#undef HAVE_SYS_IOCTL_H
-
-/* Define to 1 if you have the <sys/mount.h> header file. */
-#undef HAVE_SYS_MOUNT_H
-
-/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
-   */
-#undef HAVE_SYS_NDIR_H
-
-/* Define to 1 if you have the <sys/param.h> header file. */
-#undef HAVE_SYS_PARAM_H
-
-/* Define to 1 if you have the <sys/resource.h> header file. */
-#undef HAVE_SYS_RESOURCE_H
-
-/* Define to 1 if you have the <sys/statfs.h> header file. */
-#undef HAVE_SYS_STATFS_H
-
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
-/* Define to 1 if you have the <sys/termios.h> header file. */
-#undef HAVE_SYS_TERMIOS_H
-
-/* Define to 1 if you have the <sys/termio.h> header file. */
-#undef HAVE_SYS_TERMIO_H
-
-/* Define to 1 if you have the <sys/times.h> header file. */
-#undef HAVE_SYS_TIMES_H
-
-/* Define to 1 if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
-/* Define to 1 if you have the <sys/vfs.h> header file. */
-#undef HAVE_SYS_VFS_H
-
-/* Define to 1 if you have the `tcdrain' function. */
-#undef HAVE_TCDRAIN
-
-/* Define to 1 if you have the `tcflow' function. */
-#undef HAVE_TCFLOW
-
-/* Define to 1 if you have the `tcflush' function. */
-#undef HAVE_TCFLUSH
-
-/* Define to 1 if you have the `tcgetattr' function. */
-#undef HAVE_TCGETATTR
-
-/* Define to 1 if you have the `tcgetpgrp' function. */
-#undef HAVE_TCGETPGRP
-
-/* Define to 1 if you have the `tcsendbreak' function. */
-#undef HAVE_TCSENDBREAK
-
-/* Define to 1 if you have the `tcsetattr' function. */
-#undef HAVE_TCSETATTR
-
-/* Define to 1 if you have the `tcsetpgrp' function. */
-#undef HAVE_TCSETPGRP
-
-/* Define to 1 if you have the `time' function. */
-#undef HAVE_TIME
-
-/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
-   `HAVE_STRUCT_TM_TM_ZONE' instead. */
-#undef HAVE_TM_ZONE
-
-/* Define to 1 if you don't have `tm_zone' but do have the external array
-   `tzname'. */
-#undef HAVE_TZNAME
-
-/* Define to 1 if you have the `umask' function. */
-#undef HAVE_UMASK
-
 /* Define if union semun is defined in <sys/sem.h> */
 #undef HAVE_UNION_SEMUN
 
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
-/* Define to 1 if you have the `unlink' function. */
-#undef HAVE_UNLINK
-
 /* Define to 1 if you have the <windows.h> header file. */
 #undef HAVE_WINDOWS_H
 
@@ -308,15 +73,9 @@
 /* Bug reporting address */
 #undef REPORT_BUGS_TO
 
-/* Define as the return type of signal handlers (`int' or `void'). */
-#undef RETSIGTYPE
-
 /* Define to 1 if you have the ANSI C header files. */
 #undef STDC_HEADERS
 
-/* Define to 1 if your <sys/time.h> declares `struct tm'. */
-#undef TM_IN_SYS_TIME
-
 /* Define if we should use the Windows API, instead of the POSIX API. On
    Windows, we use the Windows API when building for MinGW, but the POSIX API
    when building for Cygwin. */
@@ -342,21 +101,3 @@
 #  undef WORDS_BIGENDIAN
 # endif
 #endif
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef gid_t
-
-/* Define to `int' if <sys/types.h> does not define. */
-#undef mode_t
-
-/* Define to `long int' if <sys/types.h> does not define. */
-#undef off_t
-
-/* Define to `int' if <sys/types.h> does not define. */
-#undef pid_t
-
-/* Define to `unsigned int' if <sys/types.h> does not define. */
-#undef size_t
-
-/* Define to `int' if <sys/types.h> doesn't define. */
-#undef uid_t
diff --git a/sim/ppc/configure b/sim/ppc/configure
index 4781393e69e1..de2d28320a11 100755
--- a/sim/ppc/configure
+++ b/sim/ppc/configure
@@ -620,6 +620,7 @@ ac_includes_default="\
 #endif"
 
 ac_subst_vars='LTLIBOBJS
+LIBOBJS
 sim_fpu
 sim_fpu_cflags
 sim_targ_vals
@@ -660,7 +661,6 @@ RANLIB
 AR
 CFLAGS_FOR_BUILD
 CC_FOR_BUILD
-LIBOBJS
 zlibinc
 zlibdir
 target_os
@@ -1731,109 +1731,6 @@ fi
 
 } # ac_fn_c_try_link
 
-# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
-# ----------------------------------------------------
-# Tries to find if the field MEMBER exists in type AGGR, after including
-# INCLUDES, setting cache variable VAR accordingly.
-ac_fn_c_check_member ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
-$as_echo_n "checking for $2.$3... " >&6; }
-if eval \${$4+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$5
-int
-main ()
-{
-static $2 ac_aggr;
-if (ac_aggr.$3)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$4=yes"
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$5
-int
-main ()
-{
-static $2 ac_aggr;
-if (sizeof ac_aggr.$3)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$4=yes"
-else
-  eval "$4=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$4
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_member
-
-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
-# ---------------------------------------------
-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
-# accordingly.
-ac_fn_c_check_decl ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  as_decl_name=`echo $2|sed 's/ *(.*//'`
-  as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-#ifndef $as_decl_name
-#ifdef __cplusplus
-  (void) $as_decl_use;
-#else
-  (void) $as_decl_name;
-#endif
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_decl
-
 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
 # -------------------------------------------
 # Tests whether TYPE exists after having included INCLUDES, setting cache
@@ -1887,160 +1784,6 @@ $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_type
-
-# ac_fn_c_check_func LINENO FUNC VAR
-# ----------------------------------
-# Tests whether FUNC exists, setting the cache variable VAR accordingly
-ac_fn_c_check_func ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $2 innocuous_$2
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $2 (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $2
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $2 ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$2 || defined __stub___$2
-choke me
-#endif
-
-int
-main ()
-{
-return $2 ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_func
-
-# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists, giving a warning if it cannot be compiled using
-# the include files in INCLUDES and setting the cache variable VAR
-# accordingly.
-ac_fn_c_check_header_mongrel ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  if eval \${$3+:} false; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
-$as_echo_n "checking $2 usability... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_header_compiler=yes
-else
-  ac_header_compiler=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
-$as_echo_n "checking $2 presence... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <$2>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  ac_header_preproc=yes
-else
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
-  yes:no: )
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-    ;;
-  no:yes:* )
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-    ;;
-esac
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  eval "$3=\$ac_header_compiler"
-fi
-eval ac_res=\$$3
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-fi
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_header_mongrel
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -5102,544 +4845,6 @@ esac
 ac_config_headers="$ac_config_headers config.h:config.in"
 
 
-ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default"
-if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
-_ACEOF
-
-
-$as_echo "#define HAVE_ST_BLKSIZE 1" >>confdefs.h
-
-fi
-
-
-ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default"
-if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_STAT_ST_BLOCKS 1
-_ACEOF
-
-
-$as_echo "#define HAVE_ST_BLOCKS 1" >>confdefs.h
-
-else
-  case " $LIBOBJS " in
-  *" fileblocks.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext"
- ;;
-esac
-
-fi
-
-
-ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default"
-if test "x$ac_cv_member_struct_stat_st_rdev" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_STAT_ST_RDEV 1
-_ACEOF
-
-
-$as_echo "#define HAVE_ST_RDEV 1" >>confdefs.h
-
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
-$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
-if ${ac_cv_struct_tm+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <time.h>
-
-int
-main ()
-{
-struct tm tm;
-				     int *p = &tm.tm_sec;
-				     return !p;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_struct_tm=time.h
-else
-  ac_cv_struct_tm=sys/time.h
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
-$as_echo "$ac_cv_struct_tm" >&6; }
-if test $ac_cv_struct_tm = sys/time.h; then
-
-$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
-
-fi
-
-ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include <sys/types.h>
-#include <$ac_cv_struct_tm>
-
-"
-if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_STRUCT_TM_TM_ZONE 1
-_ACEOF
-
-
-fi
-
-if test "$ac_cv_member_struct_tm_tm_zone" = yes; then
-
-$as_echo "#define HAVE_TM_ZONE 1" >>confdefs.h
-
-else
-  ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include <time.h>
-"
-if test "x$ac_cv_have_decl_tzname" = xyes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_TZNAME $ac_have_decl
-_ACEOF
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5
-$as_echo_n "checking for tzname... " >&6; }
-if ${ac_cv_var_tzname+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <time.h>
-#if !HAVE_DECL_TZNAME
-extern char *tzname[];
-#endif
-
-int
-main ()
-{
-return tzname[0][0];
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_var_tzname=yes
-else
-  ac_cv_var_tzname=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_var_tzname" >&5
-$as_echo "$ac_cv_var_tzname" >&6; }
-  if test $ac_cv_var_tzname = yes; then
-
-$as_echo "#define HAVE_TZNAME 1" >>confdefs.h
-
-  fi
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
-$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
-if ${ac_cv_type_uid_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "uid_t" >/dev/null 2>&1; then :
-  ac_cv_type_uid_t=yes
-else
-  ac_cv_type_uid_t=no
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
-$as_echo "$ac_cv_type_uid_t" >&6; }
-if test $ac_cv_type_uid_t = no; then
-
-$as_echo "#define uid_t int" >>confdefs.h
-
-
-$as_echo "#define gid_t int" >>confdefs.h
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking type of array argument to getgroups" >&5
-$as_echo_n "checking type of array argument to getgroups... " >&6; }
-if ${ac_cv_type_getgroups+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_type_getgroups=cross
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-/* Thanks to Mike Rendell for this test.  */
-$ac_includes_default
-#define NGID 256
-#undef MAX
-#define MAX(x, y) ((x) > (y) ? (x) : (y))
-
-int
-main ()
-{
-  gid_t gidset[NGID];
-  int i, n;
-  union { gid_t gval; long int lval; }  val;
-
-  val.lval = -1;
-  for (i = 0; i < NGID; i++)
-    gidset[i] = val.gval;
-  n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1,
-		 gidset);
-  /* Exit non-zero if getgroups seems to require an array of ints.  This
-     happens when gid_t is short int but getgroups modifies an array
-     of ints.  */
-  return n > 0 && gidset[n] != val.gval;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_type_getgroups=gid_t
-else
-  ac_cv_type_getgroups=int
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-if test $ac_cv_type_getgroups = cross; then
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <unistd.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "getgroups.*int.*gid_t" >/dev/null 2>&1; then :
-  ac_cv_type_getgroups=gid_t
-else
-  ac_cv_type_getgroups=int
-fi
-rm -f conftest*
-
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_getgroups" >&5
-$as_echo "$ac_cv_type_getgroups" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define GETGROUPS_T $ac_cv_type_getgroups
-_ACEOF
-
-
-ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
-if test "x$ac_cv_type_mode_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define mode_t int
-_ACEOF
-
-fi
-
-ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
-if test "x$ac_cv_type_off_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define off_t long int
-_ACEOF
-
-fi
-
-ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
-if test "x$ac_cv_type_pid_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define pid_t int
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
-$as_echo_n "checking return type of signal handlers... " >&6; }
-if ${ac_cv_type_signal+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <signal.h>
-
-int
-main ()
-{
-return *(signal (0, 0)) (0) == 1;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_type_signal=int
-else
-  ac_cv_type_signal=void
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
-$as_echo "$ac_cv_type_signal" >&6; }
-
-cat >>confdefs.h <<_ACEOF
-#define RETSIGTYPE $ac_cv_type_signal
-_ACEOF
-
-
-ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = xyes; then :
-
-else
-
-cat >>confdefs.h <<_ACEOF
-#define size_t unsigned int
-_ACEOF
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5
-$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
-if ${ac_cv_type_uid_t+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "uid_t" >/dev/null 2>&1; then :
-  ac_cv_type_uid_t=yes
-else
-  ac_cv_type_uid_t=no
-fi
-rm -f conftest*
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5
-$as_echo "$ac_cv_type_uid_t" >&6; }
-if test $ac_cv_type_uid_t = no; then
-
-$as_echo "#define uid_t int" >>confdefs.h
-
-
-$as_echo "#define gid_t int" >>confdefs.h
-
-fi
-
-
-for ac_func in access cfgetispeed cfgetospeed cfsetispeed cfsetospeed chdir chmod chown dup dup2 fchmod fchown fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getppid getrusage gettimeofday getuid ioctl kill link lseek lstat mkdir pipe readlink rmdir setreuid setregid stat sigprocmask stat symlink tcgetattr tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp time umask unlink
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-for ac_header in fcntl.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h unistd.h sys/vfs.h sys/statfs.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-ac_header_dirent=no
-for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
-  as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5
-$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
-if eval \${$as_ac_Header+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <$ac_hdr>
-
-int
-main ()
-{
-if ((DIR *) 0)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$as_ac_Header=yes"
-else
-  eval "$as_ac_Header=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$as_ac_Header
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
-_ACEOF
-
-ac_header_dirent=$ac_hdr; break
-fi
-
-done
-# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
-if test $ac_header_dirent = dirent.h; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
-$as_echo_n "checking for library containing opendir... " >&6; }
-if ${ac_cv_search_opendir+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char opendir ();
-int
-main ()
-{
-return opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' dir; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_opendir=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_opendir+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_opendir+:} false; then :
-
-else
-  ac_cv_search_opendir=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
-$as_echo "$ac_cv_search_opendir" >&6; }
-ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5
-$as_echo_n "checking for library containing opendir... " >&6; }
-if ${ac_cv_search_opendir+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char opendir ();
-int
-main ()
-{
-return opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' x; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_search_opendir=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext
-  if ${ac_cv_search_opendir+:} false; then :
-  break
-fi
-done
-if ${ac_cv_search_opendir+:} false; then :
-
-else
-  ac_cv_search_opendir=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5
-$as_echo "$ac_cv_search_opendir" >&6; }
-ac_res=$ac_cv_search_opendir
-if test "$ac_res" != no; then :
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-fi
-
 
 sim_termio=""
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct termios" >&5
diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
index 8ff54d90658b..bf17622434e4 100644
--- a/sim/ppc/configure.ac
+++ b/sim/ppc/configure.ac
@@ -645,23 +645,6 @@ esac
 
 AC_CONFIG_HEADER(config.h:config.in)
 
-AC_STRUCT_ST_BLKSIZE
-AC_STRUCT_ST_BLOCKS
-AC_STRUCT_ST_RDEV
-AC_STRUCT_TIMEZONE
-
-AC_TYPE_GETGROUPS
-AC_TYPE_MODE_T
-AC_TYPE_OFF_T
-AC_TYPE_PID_T
-AC_TYPE_SIGNAL
-AC_TYPE_SIZE_T
-AC_TYPE_UID_T
-
-AC_CHECK_FUNCS(access cfgetispeed cfgetospeed cfsetispeed cfsetospeed chdir chmod chown dup dup2 fchmod fchown fcntl fstat fstatfs getdirentries getegid geteuid getgid getpid getppid getrusage gettimeofday getuid ioctl kill link lseek lstat mkdir pipe readlink rmdir setreuid setregid stat sigprocmask stat symlink tcgetattr tcsetattr tcsendbreak tcdrain tcflush tcflow tcgetpgrp tcsetpgrp time umask unlink)
-
-AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/mount.h sys/param.h sys/resource.h sys/stat.h sys/termio.h sys/termios.h sys/time.h sys/times.h sys/types.h unistd.h sys/vfs.h sys/statfs.h)
-AC_HEADER_DIRENT
 
 dnl Figure out what type of termio/termios support there is
 sim_termio=""
-- 
2.31.1


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

* [PATCH 5/7 v2] sim: unify debug/stdio/trace/profile build settings
  2021-06-07  5:33 ` [PATCH 5/7] sim: unify debug/stdio/trace/profile build settings Mike Frysinger
@ 2021-06-13  0:09   ` Mike Frysinger
  0 siblings, 0 replies; 12+ messages in thread
From: Mike Frysinger @ 2021-06-13  0:09 UTC (permalink / raw)
  To: gdb-patches

Move these options up to the common dir so we only test & export
them once across all ports.

The ppc code needs a little extra care with its trace settings as
it's not exactly the same API as the common code.  The other knobs
are the same though.
---
 sim/ChangeLog                 |   8 ++
 sim/Makefile.in               |   4 +
 sim/aarch64/config.in         |  18 -----
 sim/aarch64/configure         | 134 +---------------------------------
 sim/aclocal.m4                |   4 +
 sim/arm/config.in             |  18 -----
 sim/arm/configure             | 134 +---------------------------------
 sim/avr/config.in             |  18 -----
 sim/avr/configure             | 134 +---------------------------------
 sim/bfin/config.in            |  18 -----
 sim/bfin/configure            | 134 +---------------------------------
 sim/bpf/config.in             |  18 -----
 sim/bpf/configure             | 134 +---------------------------------
 sim/config.h.in               |  18 +++++
 sim/configure                 | 123 +++++++++++++++++++++++++++++++
 sim/configure.ac              |   6 ++
 sim/cr16/config.in            |  18 -----
 sim/cr16/configure            | 134 +---------------------------------
 sim/cris/config.in            |  18 -----
 sim/cris/configure            | 134 +---------------------------------
 sim/d10v/config.in            |  18 -----
 sim/d10v/configure            | 134 +---------------------------------
 sim/erc32/config.in           |  18 -----
 sim/erc32/configure           | 134 +---------------------------------
 sim/example-synacor/config.in |  18 -----
 sim/example-synacor/configure | 134 +---------------------------------
 sim/frv/config.in             |  18 -----
 sim/frv/configure             | 134 +---------------------------------
 sim/ft32/config.in            |  18 -----
 sim/ft32/configure            | 134 +---------------------------------
 sim/h8300/config.in           |  18 -----
 sim/h8300/configure           | 134 +---------------------------------
 sim/iq2000/config.in          |  18 -----
 sim/iq2000/configure          | 134 +---------------------------------
 sim/lm32/config.in            |  18 -----
 sim/lm32/configure            | 134 +---------------------------------
 sim/m32c/config.in            |  18 -----
 sim/m32c/configure            | 134 +---------------------------------
 sim/m32r/config.in            |  18 -----
 sim/m32r/configure            | 134 +---------------------------------
 sim/m4/sim_ac_common.m4       |  16 ----
 sim/m68hc11/config.in         |  18 -----
 sim/m68hc11/configure         | 134 +---------------------------------
 sim/mcore/config.in           |  18 -----
 sim/mcore/configure           | 134 +---------------------------------
 sim/microblaze/config.in      |  18 -----
 sim/microblaze/configure      | 134 +---------------------------------
 sim/mips/config.in            |  18 -----
 sim/mips/configure            | 134 +---------------------------------
 sim/mn10300/config.in         |  18 -----
 sim/mn10300/configure         | 134 +---------------------------------
 sim/moxie/config.in           |  18 -----
 sim/moxie/configure           | 134 +---------------------------------
 sim/msp430/config.in          |  18 -----
 sim/msp430/configure          | 134 +---------------------------------
 sim/or1k/config.in            |  18 -----
 sim/or1k/configure            | 134 +---------------------------------
 sim/ppc/config.in             |   6 --
 sim/ppc/configure             |  44 -----------
 sim/ppc/configure.ac          |  26 -------
 sim/ppc/debug.h               |  19 +++++
 sim/pru/config.in             |  18 -----
 sim/pru/configure             | 134 +---------------------------------
 sim/riscv/config.in           |  18 -----
 sim/riscv/configure           | 134 +---------------------------------
 sim/rl78/config.in            |  18 -----
 sim/rl78/configure            | 134 +---------------------------------
 sim/rx/config.in              |  18 -----
 sim/rx/configure              | 134 +---------------------------------
 sim/sh/config.in              |  18 -----
 sim/sh/configure              | 134 +---------------------------------
 sim/v850/config.in            |  18 -----
 sim/v850/configure            | 134 +---------------------------------
 73 files changed, 244 insertions(+), 4742 deletions(-)

diff --git a/sim/configure.ac b/sim/configure.ac
index ecf12b57a19b..d8c6f2d4feb4 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -99,8 +99,14 @@ if test "${enable_sim}" != no; then
 fi
 AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
 
+dnl Standard (and optional) simulator options.
+dnl Eventually all simulators will support these.
 SIM_AC_OPTION_ASSERT
+SIM_AC_OPTION_DEBUG
 SIM_AC_OPTION_ENVIRONMENT
+SIM_AC_OPTION_PROFILE
+SIM_AC_OPTION_STDIO
+SIM_AC_OPTION_TRACE
 
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index 353855707ad7..0f687dc7bc58 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -54,26 +54,10 @@ AM_CONDITIONAL(PLUGINS, test "$plugins" = yes)
 LT_INIT([dlopen])
 AC_SUBST(lt_cv_dlopen_libs)
 
-dnl Standard (and optional) simulator options.
-dnl Eventually all simulators will support these.
-dnl Do not add any here that cannot be supported by all simulators.
-dnl Do not add similar but different options to a particular simulator,
-dnl all shall eventually behave the same way.
-
-
 dnl We don't use automake, but we still want to support
 dnl --enable-maintainer-mode.
 AM_MAINTAINER_MODE
 
-
-SIM_AC_OPTION_DEBUG
-
-SIM_AC_OPTION_STDIO
-
-SIM_AC_OPTION_TRACE
-
-SIM_AC_OPTION_PROFILE
-
 SIM_AC_OPTION_INLINE
 
 ACX_PKGVERSION([SIM])
diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
index bf17622434e4..9783dcf40734 100644
--- a/sim/ppc/configure.ac
+++ b/sim/ppc/configure.ac
@@ -519,19 +519,6 @@ if test x"$silent" != x"yes"; then
 fi])dnl
 
 
-AC_MSG_CHECKING([for sim stdio debug behavior])
-sim_stdio=0
-AC_ARG_ENABLE(sim-stdio,
-[  --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)
-
-
 AC_ARG_ENABLE(sim-switch,
 [  --enable-sim-switch			Use a switch instead of a table for instruction call.],
 [case "${enableval}" in
@@ -559,19 +546,6 @@ if test x"$silent" != x"yes" && test x"$sim_timebase" != x""; then
 fi],[sim_timebase=""])dnl
 
 
-AC_MSG_CHECKING([for sim trace settings])
-sim_trace="1"
-AC_ARG_ENABLE(sim-trace,
-[  --enable-sim-trace			Specify whether tracing is supported.],
-[case "${enableval}" in
-  yes)	sim_trace="1";;
-  no)	sim_trace="0";;
-  *)	AC_MSG_ERROR([--enable-sim-trace does not take a value]);;
-esac])dnl
-AC_DEFINE_UNQUOTED([WITH_TRACE], [$sim_trace], [Sim trace settings])
-AC_MSG_RESULT($sim_trace)
-
-
 AC_ARG_ENABLE(werror,
   AS_HELP_STRING([--enable-werror], [treat compile warnings as errors]),
   [case "${enableval}" in
diff --git a/sim/ppc/debug.h b/sim/ppc/debug.h
index 6f19624179e2..08ea5795fd89 100644
--- a/sim/ppc/debug.h
+++ b/sim/ppc/debug.h
@@ -169,5 +169,24 @@ trace_option(const char *option, int setting);
 extern void trace_usage
 (int verbose);
 
+/* TODO: These values aren't currently used by the ppc port.  They're here to
+   glue the common sim compile-time settings in.  The ppc_trace settings above
+   would need to be overhauled.  */
+#define TRACE_insn     1
+#define TRACE_disasm   1
+#define TRACE_decode   1
+#define TRACE_extract  1
+#define TRACE_linenum  1
+#define TRACE_memory   1
+#define TRACE_model    1
+#define TRACE_alu      1
+#define TRACE_core     1
+#define TRACE_events   1
+#define TRACE_fpu      1
+#define TRACE_vpu      1
+#define TRACE_branch   1
+#define TRACE_syscall  1
+#define TRACE_register 1
+#define TRACE_debug    1
 
 #endif /* _DEBUG_H_ */
-- 
2.31.1


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

* [PATCH 6/7 v2] sim: unify bug & package settings
  2021-06-07  5:33 ` [PATCH 6/7] sim: unify bug & package settings Mike Frysinger
@ 2021-06-13  0:25   ` Mike Frysinger
  0 siblings, 0 replies; 12+ messages in thread
From: Mike Frysinger @ 2021-06-13  0:25 UTC (permalink / raw)
  To: gdb-patches

Move these options up to the common dir so we only test & export
them once across all ports.  The AC_INIT macro does a lot of the
heavy lifting already which allows further simplification.
---
 sim/ChangeLog                  |  6 +++
 sim/Makefile.in                |  6 ++-
 sim/aarch64/aclocal.m4         |  1 -
 sim/aarch64/config.in          |  9 ----
 sim/aarch64/configure          | 79 +---------------------------------
 sim/aclocal.m4                 |  1 +
 sim/arm/aclocal.m4             |  1 -
 sim/arm/config.in              |  9 ----
 sim/arm/configure              | 79 +---------------------------------
 sim/avr/aclocal.m4             |  1 -
 sim/avr/config.in              |  9 ----
 sim/avr/configure              | 79 +---------------------------------
 sim/bfin/aclocal.m4            |  1 -
 sim/bfin/config.in             |  9 ----
 sim/bfin/configure             | 79 +---------------------------------
 sim/bpf/aclocal.m4             |  1 -
 sim/bpf/config.in              |  9 ----
 sim/bpf/configure              | 79 +---------------------------------
 sim/config.h.in                |  6 +++
 sim/configure                  | 67 ++++++++++++++++++++++++++++
 sim/configure.ac               |  7 +++
 sim/cr16/aclocal.m4            |  1 -
 sim/cr16/config.in             |  9 ----
 sim/cr16/configure             | 79 +---------------------------------
 sim/cris/aclocal.m4            |  1 -
 sim/cris/config.in             |  9 ----
 sim/cris/configure             | 79 +---------------------------------
 sim/d10v/aclocal.m4            |  1 -
 sim/d10v/config.in             |  9 ----
 sim/d10v/configure             | 79 +---------------------------------
 sim/erc32/aclocal.m4           |  1 -
 sim/erc32/config.in            |  9 ----
 sim/erc32/configure            | 79 +---------------------------------
 sim/example-synacor/aclocal.m4 |  1 -
 sim/example-synacor/config.in  |  9 ----
 sim/example-synacor/configure  | 79 +---------------------------------
 sim/frv/aclocal.m4             |  1 -
 sim/frv/config.in              |  9 ----
 sim/frv/configure              | 79 +---------------------------------
 sim/ft32/aclocal.m4            |  1 -
 sim/ft32/config.in             |  9 ----
 sim/ft32/configure             | 79 +---------------------------------
 sim/h8300/aclocal.m4           |  1 -
 sim/h8300/config.in            |  9 ----
 sim/h8300/configure            | 79 +---------------------------------
 sim/iq2000/aclocal.m4          |  1 -
 sim/iq2000/config.in           |  9 ----
 sim/iq2000/configure           | 79 +---------------------------------
 sim/lm32/aclocal.m4            |  1 -
 sim/lm32/config.in             |  9 ----
 sim/lm32/configure             | 79 +---------------------------------
 sim/m32c/aclocal.m4            |  1 -
 sim/m32c/config.in             |  9 ----
 sim/m32c/configure             | 79 +---------------------------------
 sim/m32r/aclocal.m4            |  1 -
 sim/m32r/config.in             |  9 ----
 sim/m32r/configure             | 79 +---------------------------------
 sim/m4/sim_ac_common.m4        | 12 ------
 sim/m68hc11/aclocal.m4         |  1 -
 sim/m68hc11/config.in          |  9 ----
 sim/m68hc11/configure          | 79 +---------------------------------
 sim/mcore/aclocal.m4           |  1 -
 sim/mcore/config.in            |  9 ----
 sim/mcore/configure            | 79 +---------------------------------
 sim/microblaze/aclocal.m4      |  1 -
 sim/microblaze/config.in       |  9 ----
 sim/microblaze/configure       | 79 +---------------------------------
 sim/mips/aclocal.m4            |  1 -
 sim/mips/config.in             |  9 ----
 sim/mips/configure             | 79 +---------------------------------
 sim/mn10300/aclocal.m4         |  1 -
 sim/mn10300/config.in          |  9 ----
 sim/mn10300/configure          | 79 +---------------------------------
 sim/moxie/aclocal.m4           |  1 -
 sim/moxie/config.in            |  9 ----
 sim/moxie/configure            | 79 +---------------------------------
 sim/msp430/aclocal.m4          |  1 -
 sim/msp430/config.in           |  9 ----
 sim/msp430/configure           | 79 +---------------------------------
 sim/or1k/aclocal.m4            |  1 -
 sim/or1k/config.in             |  9 ----
 sim/or1k/configure             | 79 +---------------------------------
 sim/ppc/ChangeLog              | 11 +++++
 sim/ppc/aclocal.m4             |  1 -
 sim/ppc/config.in              |  6 ---
 sim/ppc/configure              | 63 ---------------------------
 sim/ppc/configure.ac           |  5 ---
 sim/pru/aclocal.m4             |  1 -
 sim/pru/config.in              |  9 ----
 sim/pru/configure              | 79 +---------------------------------
 sim/riscv/aclocal.m4           |  1 -
 sim/riscv/config.in            |  9 ----
 sim/riscv/configure            | 79 +---------------------------------
 sim/rl78/aclocal.m4            |  1 -
 sim/rl78/config.in             |  9 ----
 sim/rl78/configure             | 79 +---------------------------------
 sim/rx/aclocal.m4              |  1 -
 sim/rx/config.in               |  9 ----
 sim/rx/configure               | 79 +---------------------------------
 sim/sh/aclocal.m4              |  1 -
 sim/sh/config.in               |  9 ----
 sim/sh/configure               | 79 +---------------------------------
 sim/v850/aclocal.m4            |  1 -
 sim/v850/config.in             |  9 ----
 sim/v850/configure             | 79 +---------------------------------
 105 files changed, 165 insertions(+), 2785 deletions(-)

diff --git a/sim/configure.ac b/sim/configure.ac
index d8c6f2d4feb4..8022a11bc91a 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -5,6 +5,13 @@ AC_INIT([sim], [0],
   [https://sourceware.org/bugzilla/enter_bug.cgi?product=gdb&component=sim],
   [], [https://sourceware.org/gdb/wiki/Sim/])
 
+dnl Probably should unify PKGVERSION with PACKAGE_* settings from AC_INIT.
+ACX_PKGVERSION([SIM])
+AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
+dnl PACKAGE_BUGREPORT is provided by AC_INIT.
+ACX_BUGURL([$PACKAGE_BUGREPORT])
+AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
+
 AC_CONFIG_HEADERS([config.h])
 
 SIM_AC_TOOLCHAIN
diff --git a/sim/m4/sim_ac_common.m4 b/sim/m4/sim_ac_common.m4
index 0f687dc7bc58..e8385c2e7c1c 100644
--- a/sim/m4/sim_ac_common.m4
+++ b/sim/m4/sim_ac_common.m4
@@ -24,13 +24,6 @@ AC_DEFUN([SIM_AC_COMMON],
 SIM_AC_TOOLCHAIN
 AC_CONFIG_HEADERS([config.h:config.in])
 
-# 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
-# is defined.
-PACKAGE=sim
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
-AC_SUBST(PACKAGE)
-
 # Dependency checking.
 ZW_CREATE_DEPDIR
 ZW_PROG_COMPILER_DEPENDENCIES([CC])
@@ -60,11 +53,6 @@ AM_MAINTAINER_MODE
 
 SIM_AC_OPTION_INLINE
 
-ACX_PKGVERSION([SIM])
-ACX_BUGURL([https://www.gnu.org/software/gdb/bugs/])
-AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
-AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
-
 dnl Detect exe extension
 AC_EXEEXT
 ]) dnl End of SIM_AC_COMMON
diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
index 9783dcf40734..56973455e0be 100644
--- a/sim/ppc/configure.ac
+++ b/sim/ppc/configure.ac
@@ -592,11 +592,6 @@ if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
 fi],[sim_xor_endian=""])dnl
 
 
-ACX_PKGVERSION([GDB])
-ACX_BUGURL([https://www.gnu.org/software/gdb/bugs/])
-AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
-AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
-
 AC_CANONICAL_SYSTEM
 AC_ARG_PROGRAM
 
-- 
2.31.1


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

* [PATCH 7/7 v2] sim: overhaul alignment settings management
  2021-06-07  5:33 ` [PATCH 7/7] sim: overhaul alignment settings management Mike Frysinger
@ 2021-06-13  1:19   ` Mike Frysinger
  0 siblings, 0 replies; 12+ messages in thread
From: Mike Frysinger @ 2021-06-13  1:19 UTC (permalink / raw)
  To: gdb-patches

Currently, the sim-config module will abort if alignment settings
haven't been specified by the port's configure.ac.  This is a bit
weird when we've allowed SIM_AC_OPTION_ALIGNMENT to seem like it's
optional to use.  Thus everyone invokes it.

There are 4 alignment settings, but really only 2 matters: strict
and nonstrict.  The "mixed" setting is just the default ("unset"),
and "forced" isn't used directly by anyone (it's available as a
runtime option for some ports).

The m4 macro has 2 args: the "wire" settings (which represents the
hardwired port behavior), and the default settings (which are used
if nothing else is specified).  If none are specified, then the
build won't work (see above as if SIM_AC_OPTION_ALIGNMENT wasn't
called).  If default settings are provided, then that is used, but
we allow the user to override at runtime.  Otherwise, the "wire"
settings are used and user runtime options to change are ignored.

Most ports specify a default, or set the "wire" to nonstrict.  A
few set "wire" to strict, but it's not clear that's necessary as
it doesn't make the code behavior, by default, any different.  It
might make things a little faster, but we should provide the user
the choice of the compromises to make: force a specific mode at
compile time for faster runtime, or allow the choice at runtime.
More likely it seems like an oversight when these ports were
initially created, and/or copied & pasted from existing ports.

With all that backstory, let's get to what this commit does.

First kill off the idea of a compile-time default alignment and
set it to nonstrict in the common code.  For any ports that want
strict alignment by default, that code is moved to sim_open while
initializing the sim.  That means WITH_DEFAULT_ALIGNMENT can be
completely removed.

Moving the default alignment to the runtime also allows removal
of setting the "wire" settings at configure time.  Which allows
removing of all arguments to SIM_AC_OPTION_ALIGNMENT and moving
that call to common code.

The macro logic can be reworked to not pass WITH_ALIGNMENT as -D
CPPFLAG and instead move it to config.h.

All of these taken together mean we can hoist the macro up to the
top level and share it among all sims so behavior is consistent
among all the ports.
---
 sim/ChangeLog                     |  6 +++
 sim/Makefile.in                   |  1 +
 sim/aarch64/ChangeLog             |  5 +++
 sim/aarch64/aclocal.m4            |  1 -
 sim/aarch64/configure             | 62 ++-----------------------------
 sim/aarch64/configure.ac          |  5 ---
 sim/aarch64/interp.c              |  5 +++
 sim/aclocal.m4                    |  1 +
 sim/arm/ChangeLog                 |  5 +++
 sim/arm/aclocal.m4                |  1 -
 sim/arm/configure                 | 58 ++---------------------------
 sim/arm/configure.ac              |  1 -
 sim/arm/wrapper.c                 |  3 ++
 sim/avr/ChangeLog                 |  5 +++
 sim/avr/aclocal.m4                |  1 -
 sim/avr/configure                 | 58 ++---------------------------
 sim/avr/configure.ac              |  1 -
 sim/avr/interp.c                  |  3 ++
 sim/bfin/ChangeLog                |  5 +++
 sim/bfin/aclocal.m4               |  1 -
 sim/bfin/configure                | 58 ++---------------------------
 sim/bfin/configure.ac             |  1 -
 sim/bfin/interp.c                 |  3 ++
 sim/bpf/ChangeLog                 |  4 ++
 sim/bpf/aclocal.m4                |  1 -
 sim/bpf/configure                 | 58 ++---------------------------
 sim/bpf/configure.ac              |  1 -
 sim/common/ChangeLog              |  8 ++++
 sim/common/Make-common.in         |  2 -
 sim/common/sim-config.c           |  8 +---
 sim/common/sim-config.h           | 11 +-----
 sim/config.h.in                   |  3 ++
 sim/configure                     | 24 ++++++++++++
 sim/configure.ac                  |  1 +
 sim/cr16/ChangeLog                |  4 ++
 sim/cr16/aclocal.m4               |  1 -
 sim/cr16/configure                | 58 ++---------------------------
 sim/cr16/configure.ac             |  1 -
 sim/cris/ChangeLog                |  4 ++
 sim/cris/aclocal.m4               |  1 -
 sim/cris/configure                | 58 ++---------------------------
 sim/cris/configure.ac             |  1 -
 sim/d10v/ChangeLog                |  5 +++
 sim/d10v/aclocal.m4               |  1 -
 sim/d10v/configure                | 58 ++---------------------------
 sim/d10v/configure.ac             |  1 -
 sim/d10v/interp.c                 |  3 ++
 sim/example-synacor/ChangeLog     |  5 +++
 sim/example-synacor/aclocal.m4    |  1 -
 sim/example-synacor/configure     | 58 ++---------------------------
 sim/example-synacor/configure.ac  |  1 -
 sim/example-synacor/interp.c      |  3 ++
 sim/frv/ChangeLog                 |  5 +++
 sim/frv/aclocal.m4                |  1 -
 sim/frv/configure                 | 58 ++---------------------------
 sim/frv/configure.ac              |  1 -
 sim/frv/sim-if.c                  |  3 ++
 sim/ft32/ChangeLog                |  5 +++
 sim/ft32/aclocal.m4               |  1 -
 sim/ft32/configure                | 58 ++---------------------------
 sim/ft32/configure.ac             |  1 -
 sim/ft32/interp.c                 |  3 ++
 sim/h8300/ChangeLog               |  4 ++
 sim/h8300/aclocal.m4              |  1 -
 sim/h8300/configure               | 58 ++---------------------------
 sim/h8300/configure.ac            |  1 -
 sim/iq2000/ChangeLog              |  5 +++
 sim/iq2000/aclocal.m4             |  1 -
 sim/iq2000/configure              | 58 ++---------------------------
 sim/iq2000/configure.ac           |  1 -
 sim/iq2000/sim-if.c               |  3 ++
 sim/lm32/ChangeLog                |  5 +++
 sim/lm32/aclocal.m4               |  1 -
 sim/lm32/configure                | 58 ++---------------------------
 sim/lm32/configure.ac             |  1 -
 sim/lm32/sim-if.c                 |  3 ++
 sim/m32r/ChangeLog                |  5 +++
 sim/m32r/aclocal.m4               |  1 -
 sim/m32r/configure                | 58 ++---------------------------
 sim/m32r/configure.ac             |  1 -
 sim/m32r/sim-if.c                 |  3 ++
 sim/m4/sim_ac_option_alignment.m4 | 53 +++++---------------------
 sim/m68hc11/ChangeLog             |  4 ++
 sim/m68hc11/aclocal.m4            |  1 -
 sim/m68hc11/configure             | 58 ++---------------------------
 sim/m68hc11/configure.ac          |  1 -
 sim/mcore/ChangeLog               |  4 ++
 sim/mcore/aclocal.m4              |  1 -
 sim/mcore/configure               | 58 ++---------------------------
 sim/mcore/configure.ac            |  1 -
 sim/microblaze/ChangeLog          |  4 ++
 sim/microblaze/aclocal.m4         |  1 -
 sim/microblaze/configure          | 58 ++---------------------------
 sim/microblaze/configure.ac       |  1 -
 sim/mips/ChangeLog                |  4 ++
 sim/mips/aclocal.m4               |  1 -
 sim/mips/configure                | 58 ++---------------------------
 sim/mips/configure.ac             |  1 -
 sim/mn10300/ChangeLog             |  4 ++
 sim/mn10300/aclocal.m4            |  1 -
 sim/mn10300/configure             | 58 ++---------------------------
 sim/mn10300/configure.ac          |  1 -
 sim/moxie/ChangeLog               |  4 ++
 sim/moxie/aclocal.m4              |  1 -
 sim/moxie/configure               | 58 ++---------------------------
 sim/moxie/configure.ac            |  1 -
 sim/msp430/ChangeLog              |  4 ++
 sim/msp430/aclocal.m4             |  1 -
 sim/msp430/configure              | 58 ++---------------------------
 sim/msp430/configure.ac           |  1 -
 sim/or1k/ChangeLog                |  4 ++
 sim/or1k/aclocal.m4               |  1 -
 sim/or1k/configure                | 58 ++---------------------------
 sim/or1k/configure.ac             |  1 -
 sim/ppc/ChangeLog                 |  6 +++
 sim/ppc/Makefile.in               |  2 -
 sim/ppc/configure                 | 20 ----------
 sim/ppc/configure.ac              | 14 -------
 sim/pru/ChangeLog                 |  5 +++
 sim/pru/aclocal.m4                |  1 -
 sim/pru/configure                 | 58 ++---------------------------
 sim/pru/configure.ac              |  1 -
 sim/pru/interp.c                  |  3 ++
 sim/riscv/ChangeLog               |  4 ++
 sim/riscv/aclocal.m4              |  1 -
 sim/riscv/configure               | 58 ++---------------------------
 sim/riscv/configure.ac            |  1 -
 sim/sh/ChangeLog                  |  5 +++
 sim/sh/aclocal.m4                 |  1 -
 sim/sh/configure                  | 58 ++---------------------------
 sim/sh/configure.ac               |  1 -
 sim/sh/interp.c                   |  3 ++
 sim/v850/ChangeLog                |  4 ++
 sim/v850/aclocal.m4               |  1 -
 sim/v850/configure                | 58 ++---------------------------
 sim/v850/configure.ac             |  1 -
 136 files changed, 334 insertions(+), 1616 deletions(-)

diff --git a/sim/aarch64/configure.ac b/sim/aarch64/configure.ac
index 1c212dc2c955..381682fb5f09 100644
--- a/sim/aarch64/configure.ac
+++ b/sim/aarch64/configure.ac
@@ -25,11 +25,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
-## We use NONSTRICT_ALIGNMENT as the default because AArch64 only
-## enforces 4-byte alignment, even for 8-byte reads/writes.  The
-## common core does not support this, so we opt for non-strict
-## alignment instead.
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT,NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/aarch64/interp.c b/sim/aarch64/interp.c
index fd35f4fa683d..18c2fc0eacbd 100644
--- a/sim/aarch64/interp.c
+++ b/sim/aarch64/interp.c
@@ -330,6 +330,11 @@ sim_open (SIM_OPEN_KIND                  kind,
 
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* We use NONSTRICT_ALIGNMENT as the default because AArch64 only enforces
+     4-byte alignment, even for 8-byte reads/writes.  The common core does not
+     support this, so we opt for non-strict alignment instead.  */
+  current_alignment = NONSTRICT_ALIGNMENT;
+
   /* Perform the initialization steps one by one.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK
       || sim_pre_argv_init (sd, argv[0]) != SIM_RC_OK
diff --git a/sim/arm/configure.ac b/sim/arm/configure.ac
index 88fac82e7b4c..7638b6d8e11b 100644
--- a/sim/arm/configure.ac
+++ b/sim/arm/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c
index a1147e402cc0..e697d55a6b5e 100644
--- a/sim/arm/wrapper.c
+++ b/sim/arm/wrapper.c
@@ -801,6 +801,9 @@ sim_open (SIM_OPEN_KIND kind,
   SIM_DESC sd = sim_state_alloc (kind, cb);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/avr/configure.ac b/sim/avr/configure.ac
index 92046a1762dd..9d6e1e6ded71 100644
--- a/sim/avr/configure.ac
+++ b/sim/avr/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/avr/interp.c b/sim/avr/interp.c
index d456c39390a7..1626fadaa973 100644
--- a/sim/avr/interp.c
+++ b/sim/avr/interp.c
@@ -1684,6 +1684,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
   SIM_DESC sd = sim_state_alloc_extra (kind, cb, sizeof (struct avr_sim_state));
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/bfin/configure.ac b/sim/bfin/configure.ac
index 18e82fae66b9..e2d53bcc7ca9 100644
--- a/sim/bfin/configure.ac
+++ b/sim/bfin/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_DEFAULT_MODEL(bf537)
 SIM_AC_OPTION_WARNINGS
 SIM_AC_OPTION_HARDWARE(\
diff --git a/sim/bfin/interp.c b/sim/bfin/interp.c
index 34357201934c..2e9696f8bfe1 100644
--- a/sim/bfin/interp.c
+++ b/sim/bfin/interp.c
@@ -720,6 +720,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
   SIM_DESC sd = sim_state_alloc_extra (kind, callback,
 				       sizeof (struct bfin_board_data));
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/bpf/configure.ac b/sim/bpf/configure.ac
index a0f8576fc392..4e00c1316090 100644
--- a/sim/bpf/configure.ac
+++ b/sim/bpf/configure.ac
@@ -6,7 +6,6 @@ SIM_AC_COMMON
 
 SIM_AC_OPTION_BITSIZE([64])
 SIM_AC_OPTION_ENDIAN([], [LITTLE])
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL([bpf-def])
 SIM_AC_OPTION_WARNINGS(no)
diff --git a/sim/common/Make-common.in b/sim/common/Make-common.in
index f32026e179d3..999b1eea00a9 100644
--- a/sim/common/Make-common.in
+++ b/sim/common/Make-common.in
@@ -82,7 +82,6 @@ CPPFLAGS = @CPPFLAGS@
 CXXFLAGS = @CXXFLAGS@
 LDFLAGS = @LDFLAGS@
 
-SIM_ALIGNMENT = @sim_alignment@
 SIM_BITSIZE = @sim_bitsize@
 SIM_DEFAULT_MODEL = @sim_default_model@
 SIM_ENDIAN = @sim_endian@
@@ -222,7 +221,6 @@ CGEN_INCLUDE_DEPS = \
 CONFIG_CFLAGS = \
 	@DEFS@ \
 	$(SIM_DEFAULT_MODEL) \
-	$(SIM_ALIGNMENT) \
 	$(SIM_BITSIZE) \
 	$(SIM_ENDIAN) \
 	$(SIM_FLOAT) \
diff --git a/sim/common/sim-config.c b/sim/common/sim-config.c
index df99d6a957fd..c9005f449fe6 100644
--- a/sim/common/sim-config.c
+++ b/sim/common/sim-config.c
@@ -253,8 +253,9 @@ sim_config (SIM_DESC sd)
 #endif
   if (current_alignment == 0)
     current_alignment = WITH_ALIGNMENT;
+  /* If the port hasn't specified an alignment, default to not enforcing.  */
   if (current_alignment == 0)
-    current_alignment = WITH_DEFAULT_ALIGNMENT;
+    current_alignment = NONSTRICT_ALIGNMENT;
 
   /* verify the alignment */
   if (CURRENT_ALIGNMENT == 0)
@@ -331,11 +332,6 @@ sim_config_print (SIM_DESC sd)
   sim_io_printf (sd, "WITH_ALIGNMENT = %s\n",
 		 config_alignment_to_a (WITH_ALIGNMENT));
 
-#if defined (WITH_DEFAULT_ALIGNMENT)
-  sim_io_printf (sd, "WITH_DEFAULT_ALIGNMENT = %s\n",
-		 config_alignment_to_a (WITH_DEFAULT_ALIGNMENT));
-#endif
-
 #if defined (WITH_XOR_ENDIAN)
   sim_io_printf (sd, "WITH_XOR_ENDIAN = %d\n", WITH_XOR_ENDIAN);
 #endif
diff --git a/sim/common/sim-config.h b/sim/common/sim-config.h
index 6ab8d1a97eca..2b6ed3d0b7d4 100644
--- a/sim/common/sim-config.h
+++ b/sim/common/sim-config.h
@@ -195,11 +195,11 @@ extern char *simulator_sysroot;
 
 /* Alignment:
 
-   A processor architecture may or may not handle miss aligned
+   A processor architecture may or may not handle misaligned
    transfers.
 
    As alternatives: both little and big endian modes take an exception
-   (STRICT_ALIGNMENT); big and little endian models handle mis aligned
+   (STRICT_ALIGNMENT); big and little endian models handle misaligned
    transfers (NONSTRICT_ALIGNMENT); or the address is forced into
    alignment using a mask (FORCED_ALIGNMENT).
 
@@ -220,13 +220,6 @@ extern enum sim_alignments current_alignment;
 #define WITH_ALIGNMENT 0
 #endif
 
-#if !defined (WITH_DEFAULT_ALIGNMENT)
-#define WITH_DEFAULT_ALIGNMENT 0 /* fatal */
-#endif
-
-
-
-
 #define CURRENT_ALIGNMENT (WITH_ALIGNMENT \
 			   ? WITH_ALIGNMENT \
 			   : current_alignment)
diff --git a/sim/configure.ac b/sim/configure.ac
index 8022a11bc91a..e7f3f535ef59 100644
--- a/sim/configure.ac
+++ b/sim/configure.ac
@@ -108,6 +108,7 @@ AM_CONDITIONAL([SIM_ENABLE_IGEN], [test "$sim_igen" = "yes"])
 
 dnl Standard (and optional) simulator options.
 dnl Eventually all simulators will support these.
+SIM_AC_OPTION_ALIGNMENT
 SIM_AC_OPTION_ASSERT
 SIM_AC_OPTION_DEBUG
 SIM_AC_OPTION_ENVIRONMENT
diff --git a/sim/cr16/configure.ac b/sim/cr16/configure.ac
index f4dc9c1314db..8cd4d23a479b 100644
--- a/sim/cr16/configure.ac
+++ b/sim/cr16/configure.ac
@@ -5,6 +5,5 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 
 SIM_AC_OUTPUT
diff --git a/sim/cris/configure.ac b/sim/cris/configure.ac
index b5eaea7b8adf..cc5bb4922f18 100644
--- a/sim/cris/configure.ac
+++ b/sim/cris/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_HARDWARE(rv cris cris_900000xx)
diff --git a/sim/d10v/configure.ac b/sim/d10v/configure.ac
index 811452094557..ec8a87e7d397 100644
--- a/sim/d10v/configure.ac
+++ b/sim/d10v/configure.ac
@@ -5,6 +5,5 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 
 SIM_AC_OUTPUT
diff --git a/sim/d10v/interp.c b/sim/d10v/interp.c
index b587cc18654f..c0cdc034700d 100644
--- a/sim/d10v/interp.c
+++ b/sim/d10v/interp.c
@@ -755,6 +755,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
   SIM_DESC sd = sim_state_alloc (kind, cb);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/example-synacor/configure.ac b/sim/example-synacor/configure.ac
index 13b311197e36..8cd4d23a479b 100644
--- a/sim/example-synacor/configure.ac
+++ b/sim/example-synacor/configure.ac
@@ -5,6 +5,5 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 
 SIM_AC_OUTPUT
diff --git a/sim/example-synacor/interp.c b/sim/example-synacor/interp.c
index eaf8f1fdf975..784c9cbc5755 100644
--- a/sim/example-synacor/interp.c
+++ b/sim/example-synacor/interp.c
@@ -82,6 +82,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback,
   int i;
   SIM_DESC sd = sim_state_alloc (kind, callback);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/frv/configure.ac b/sim/frv/configure.ac
index e5bbdbfba228..fcc2e8836bb7 100644
--- a/sim/frv/configure.ac
+++ b/sim/frv/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(fr500)
 SIM_AC_OPTION_WARNINGS(no)
diff --git a/sim/frv/sim-if.c b/sim/frv/sim-if.c
index 8ac9665f4cfc..0ad5f626e45c 100644
--- a/sim/frv/sim-if.c
+++ b/sim/frv/sim-if.c
@@ -54,6 +54,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, bfd *abfd,
   unsigned long elf_flags = 0;
   SIM_DESC sd = sim_state_alloc (kind, callback);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/ft32/configure.ac b/sim/ft32/configure.ac
index 658a0a459d01..9d6e1e6ded71 100644
--- a/sim/ft32/configure.ac
+++ b/sim/ft32/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/ft32/interp.c b/sim/ft32/interp.c
index 5fc9ea246583..8a44a472f605 100644
--- a/sim/ft32/interp.c
+++ b/sim/ft32/interp.c
@@ -808,6 +808,9 @@ sim_open (SIM_OPEN_KIND kind,
   size_t i;
   SIM_DESC sd = sim_state_alloc (kind, cb);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/h8300/configure.ac b/sim/h8300/configure.ac
index 43250f817416..7e2a166307ed 100644
--- a/sim/h8300/configure.ac
+++ b/sim/h8300/configure.ac
@@ -5,6 +5,5 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 
 SIM_AC_OUTPUT
diff --git a/sim/iq2000/configure.ac b/sim/iq2000/configure.ac
index 623fa192d74b..c61c9480d5e5 100644
--- a/sim/iq2000/configure.ac
+++ b/sim/iq2000/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(iq2000)
 SIM_AC_OPTION_WARNINGS(no)
diff --git a/sim/iq2000/sim-if.c b/sim/iq2000/sim-if.c
index 679d5164033a..82ac53f2d0bd 100644
--- a/sim/iq2000/sim-if.c
+++ b/sim/iq2000/sim-if.c
@@ -60,6 +60,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
   int i;
   SIM_DESC sd = sim_state_alloc (kind, callback);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/lm32/configure.ac b/sim/lm32/configure.ac
index 63548874a114..4a2037468dee 100644
--- a/sim/lm32/configure.ac
+++ b/sim/lm32/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(lm32)
 SIM_AC_OPTION_WARNINGS(no)
diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c
index 3d4ee35d7462..fba2d638f42b 100644
--- a/sim/lm32/sim-if.c
+++ b/sim/lm32/sim-if.c
@@ -91,6 +91,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
   int i;
   unsigned long base, limit;
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/m32r/configure.ac b/sim/m32r/configure.ac
index 8ab55bc155a8..a5cea83849e7 100644
--- a/sim/m32r/configure.ac
+++ b/sim/m32r/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL(m32r/d)
 SIM_AC_OPTION_WARNINGS(no)
diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c
index e08a5d461af2..bea6505d7404 100644
--- a/sim/m32r/sim-if.c
+++ b/sim/m32r/sim-if.c
@@ -54,6 +54,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
   char c;
   int i;
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/m4/sim_ac_option_alignment.m4 b/sim/m4/sim_ac_option_alignment.m4
index dcfa47984a63..409fbfc1a432 100644
--- a/sim/m4/sim_ac_option_alignment.m4
+++ b/sim/m4/sim_ac_option_alignment.m4
@@ -15,52 +15,19 @@ dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
 dnl
 dnl Specify the alignment restrictions of the target architecture.
 dnl Without this option all possible alignment restrictions are accommodated.
-dnl arg[1] is hardwired target alignment
-dnl arg[2] is default target alignment
 AC_DEFUN([SIM_AC_OPTION_ALIGNMENT],
-wire_alignment="[$1]"
-default_alignment="[$2]"
-[
+[dnl
+AC_MSG_CHECKING([whether to force sim alignment])
+sim_alignment=
 AC_ARG_ENABLE(sim-alignment,
 [AS_HELP_STRING([--enable-sim-alignment=align],
 		[Specify strict, nonstrict or forced alignment of memory accesses])],
 [case "${enableval}" in
-  strict | STRICT)       sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
-  nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
-  forced | FORCED)       sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
-  yes) if test x"$wire_alignment" != x; then
-	 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
-       else
-         if test x"$default_alignment" != x; then
-           sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
-         else
-	   echo "No hard-wired alignment for target $target" 1>&6
-	   sim_alignment="-DWITH_ALIGNMENT=0"
-         fi
-       fi;;
-  no)  if test x"$default_alignment" != x; then
-	 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
-       else
-         if test x"$wire_alignment" != x; then
-	   sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
-         else
-           echo "No default alignment for target $target" 1>&6
-           sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
-         fi
-       fi;;
-  *)   AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
-  echo "Setting alignment flags = $sim_alignment" 6>&1
-fi],
-[if test x"$default_alignment" != x; then
-  sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
-else
-  if test x"$wire_alignment" != x; then
-    sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
-  else
-    sim_alignment=
-  fi
-fi])dnl
+  yes | strict | STRICT)      sim_alignment="STRICT_ALIGNMENT";;
+  no | nonstrict | NONSTRICT) sim_alignment="NONSTRICT_ALIGNMENT";;
+  forced | FORCED)            sim_alignment="FORCED_ALIGNMENT";;
+  *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment");;
+esac])dnl
+AC_DEFINE_UNQUOTED([WITH_ALIGNMENT], [${sim_alignment:-0}], [Sim alignment settings])
+AC_MSG_RESULT([${sim_alignment:-no}])
 ])dnl
-AC_SUBST(sim_alignment)
diff --git a/sim/m68hc11/configure.ac b/sim/m68hc11/configure.ac
index 57e13e207bdd..b2685040f61e 100644
--- a/sim/m68hc11/configure.ac
+++ b/sim/m68hc11/configure.ac
@@ -6,7 +6,6 @@ SIM_AC_COMMON
 
 dnl Options available in this module
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_HARDWARE(\
   m68hc11 m68hc11sio m68hc11eepr m68hc11tim m68hc11spi nvram)
 
diff --git a/sim/mcore/configure.ac b/sim/mcore/configure.ac
index 811452094557..ec8a87e7d397 100644
--- a/sim/mcore/configure.ac
+++ b/sim/mcore/configure.ac
@@ -5,6 +5,5 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 
 SIM_AC_OUTPUT
diff --git a/sim/microblaze/configure.ac b/sim/microblaze/configure.ac
index 88fac82e7b4c..7638b6d8e11b 100644
--- a/sim/microblaze/configure.ac
+++ b/sim/microblaze/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/mips/configure.ac b/sim/mips/configure.ac
index f4e67376c12e..f0b26b4f0acb 100644
--- a/sim/mips/configure.ac
+++ b/sim/mips/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 dnl Options available in this module
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_RESERVED_BITS(1)
 
diff --git a/sim/mn10300/configure.ac b/sim/mn10300/configure.ac
index 55aec73be500..b09159d7d47f 100644
--- a/sim/mn10300/configure.ac
+++ b/sim/mn10300/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS(no)
 SIM_AC_OPTION_RESERVED_BITS
 SIM_AC_OPTION_BITSIZE(32,31)
diff --git a/sim/moxie/configure.ac b/sim/moxie/configure.ac
index fb5a91eacf8f..75a6f37ed265 100644
--- a/sim/moxie/configure.ac
+++ b/sim/moxie/configure.ac
@@ -7,6 +7,5 @@ SIM_AC_COMMON
 AC_CHECK_TOOL(DTC, dtc)
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 
 SIM_AC_OUTPUT
diff --git a/sim/msp430/configure.ac b/sim/msp430/configure.ac
index 0277d7f497e3..19839d11822a 100644
--- a/sim/msp430/configure.ac
+++ b/sim/msp430/configure.ac
@@ -24,7 +24,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/or1k/configure.ac b/sim/or1k/configure.ac
index 32fb0d49b95d..e09fee1ac13d 100644
--- a/sim/or1k/configure.ac
+++ b/sim/or1k/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(BIG)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT)
 SIM_AC_OPTION_BITSIZE([32], [31], [32])
 SIM_AC_OPTION_SCACHE(16384)
 SIM_AC_OPTION_DEFAULT_MODEL([or1200])
diff --git a/sim/ppc/configure.ac b/sim/ppc/configure.ac
index 56973455e0be..3b93beefbfe0 100644
--- a/sim/ppc/configure.ac
+++ b/sim/ppc/configure.ac
@@ -19,19 +19,6 @@ ALL_LINGUAS=
 ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
 
 
-AC_ARG_ENABLE(sim-alignment,
-[  --enable-sim-alignment=align		Specify strict or nonstrict alignment.],
-[case "${enableval}" in
-  yes | strict | STRICT)	sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
-  no | nonstrict | NONSTRICT)	sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
-  0 | default | DEFAULT)	sim_alignment="-DWITH_ALIGNMENT=0";;
-  *)				AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
-  echo "Setting alignment flags = $sim_alignment" 6>&1
-fi],[sim_alignment=""])dnl
-
-
 AC_MSG_CHECKING([whether to enable sim asserts])
 sim_assert="1"
 AC_ARG_ENABLE(sim-assert,
@@ -818,7 +805,6 @@ AC_SUBST(sim_igen_smp)
 AC_SUBST(sim_bitsize)
 AC_SUBST(sim_hostbitsize)
 AC_SUBST(sim_timebase)
-AC_SUBST(sim_alignment)
 AC_SUBST(sim_float)
 AC_SUBST(sim_reserved)
 AC_SUBST(sim_monitor)
diff --git a/sim/pru/configure.ac b/sim/pru/configure.ac
index a4db77beec2f..79dab8b24039 100644
--- a/sim/pru/configure.ac
+++ b/sim/pru/configure.ac
@@ -24,7 +24,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 SIM_AC_OUTPUT
diff --git a/sim/pru/interp.c b/sim/pru/interp.c
index 58ac333c1e6c..38269df44ce7 100644
--- a/sim/pru/interp.c
+++ b/sim/pru/interp.c
@@ -745,6 +745,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
   SIM_DESC sd = sim_state_alloc (kind, cb);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/riscv/configure.ac b/sim/riscv/configure.ac
index e5a07bbc46b0..3d678acb47be 100644
--- a/sim/riscv/configure.ac
+++ b/sim/riscv/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS
 
 # Select the default model for the target.
diff --git a/sim/sh/configure.ac b/sim/sh/configure.ac
index 4417ba4e561e..dd975d3259e6 100644
--- a/sim/sh/configure.ac
+++ b/sim/sh/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN
-SIM_AC_OPTION_ALIGNMENT(STRICT_ALIGNMENT,STRICT_ALIGNMENT)
 SIM_AC_OPTION_WARNINGS(no)
 
 SIM_AC_OUTPUT
diff --git a/sim/sh/interp.c b/sim/sh/interp.c
index 87fb863887f7..264e9b1de465 100644
--- a/sim/sh/interp.c
+++ b/sim/sh/interp.c
@@ -2358,6 +2358,9 @@ sim_open (SIM_OPEN_KIND kind, host_callback *cb,
   SIM_DESC sd = sim_state_alloc (kind, cb);
   SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER);
 
+  /* Set default options before parsing user options.  */
+  current_alignment = STRICT_ALIGNMENT;
+
   /* The cpu data is kept in a separately allocated chunk of memory.  */
   if (sim_cpu_alloc_all (sd, 1) != SIM_RC_OK)
     {
diff --git a/sim/v850/configure.ac b/sim/v850/configure.ac
index 9a7c1ec3df4b..6d586f194fd0 100644
--- a/sim/v850/configure.ac
+++ b/sim/v850/configure.ac
@@ -5,7 +5,6 @@ AC_CONFIG_MACRO_DIRS([../m4 ../.. ../../config])
 SIM_AC_COMMON
 
 SIM_AC_OPTION_ENDIAN(LITTLE)
-SIM_AC_OPTION_ALIGNMENT(,NONSTRICT_ALIGNMENT)
 SIM_AC_OPTION_RESERVED_BITS
 SIM_AC_OPTION_BITSIZE(32,31)
 
-- 
2.31.1


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

end of thread, other threads:[~2021-06-13  1:19 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07  5:33 [PATCH 1/7] sim: unify platform function & header tests Mike Frysinger
2021-06-07  5:33 ` [PATCH 2/7] sim: unify assert build settings Mike Frysinger
2021-06-07  5:33 ` [PATCH 3/7] sim: unify environment " Mike Frysinger
2021-06-12 17:17   ` [PATCH/committed] sim: ppc: unify env settings too Mike Frysinger
2021-06-07  5:33 ` [PATCH 4/7] sim: split debug/stdio/trace/profile options into dedicated m4 files Mike Frysinger
2021-06-07  5:33 ` [PATCH 5/7] sim: unify debug/stdio/trace/profile build settings Mike Frysinger
2021-06-13  0:09   ` [PATCH 5/7 v2] " Mike Frysinger
2021-06-07  5:33 ` [PATCH 6/7] sim: unify bug & package settings Mike Frysinger
2021-06-13  0:25   ` [PATCH 6/7 v2] " Mike Frysinger
2021-06-07  5:33 ` [PATCH 7/7] sim: overhaul alignment settings management Mike Frysinger
2021-06-13  1:19   ` [PATCH 7/7 v2] " Mike Frysinger
2021-06-12 18:40 ` [PATCH/committed] sim: ppc: unify header & function & type tests too 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).