ubsan: z8k: index 10 out of bounds for type 'unsigned int const[10]'
[deliverable/binutils-gdb.git] / sim / common / acinclude.m4
index 7f98903cc91324fb5918c0fed23d609493085a68..71a8841ab02dabecce5604199389226b4ff35c9f 100644 (file)
@@ -5,7 +5,7 @@
 # SIM_AC_OUTPUT is a cover function to AC_OUTPUT to generate the Makefile.
 # It is intended to be invoked last.
 #
-# The simulator's configure.in should look like:
+# The simulator's configure.ac should look like:
 #
 # dnl Process this file with autoconf to produce a configure script.
 # AC_PREREQ(2.64)dnl
@@ -36,14 +36,17 @@ AC_REQUIRE([AC_PROG_CC])
 AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in)
 AC_CANONICAL_SYSTEM
 AC_USE_SYSTEM_EXTENSIONS
+AC_C_BIGENDIAN
 AC_ARG_PROGRAM
 AC_PROG_INSTALL
 
 # Put a plausible default for CC_FOR_BUILD in Makefile.
-if test "x$cross_compiling" = "xno"; then
-  CC_FOR_BUILD='$(CC)'
-else
-  CC_FOR_BUILD=gcc
+if test -z "$CC_FOR_BUILD"; then
+  if test "x$cross_compiling" = "xno"; then
+    CC_FOR_BUILD='$(CC)'
+  else
+    CC_FOR_BUILD=gcc
+  fi
 fi
 AC_SUBST(CC_FOR_BUILD)
 
@@ -83,10 +86,26 @@ ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
 # FIXME: Seems to me this can cause problems for i386-windows hosts.
 # At one point there were hardcoded AC_DEFINE's if ${host} = i386-*-windows*.
 AC_CHECK_HEADERS(stdlib.h string.h strings.h unistd.h time.h)
-AC_CHECK_HEADERS(sys/time.h sys/resource.h)
+AC_CHECK_HEADERS(sys/time.h sys/times.h sys/resource.h sys/mman.h)
 AC_CHECK_HEADERS(fcntl.h fpu_control.h)
 AC_CHECK_HEADERS(dlfcn.h errno.h sys/stat.h)
 AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
+AC_CHECK_FUNCS(mmap munmap lstat truncate ftruncate posix_fallocate)
+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(socklen_t, [], [],
+[#include <sys/types.h>
+#include <sys/socket.h>
+])
 
 # Check for socket libraries
 AC_CHECK_LIB(socket, bind)
@@ -113,106 +132,72 @@ dnl all shall eventually behave the same way.
 
 dnl We don't use automake, but we still want to support
 dnl --enable-maintainer-mode.
-USE_MAINTAINER_MODE=no
-AC_ARG_ENABLE(maintainer-mode,
-[  --enable-maintainer-mode            Enable developer functionality.],
-[case "${enableval}" in
-  yes) MAINT="" USE_MAINTAINER_MODE=yes ;;
-  no)  MAINT="#" ;;
-  *)   AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;;
-esac
-if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
-  echo "Setting maintainer mode" 6>&1
-fi],[MAINT="#"])dnl
-AC_SUBST(MAINT)
-
-
-dnl This is a generic option to enable special byte swapping
-dnl insns on *any* cpu.
-AC_ARG_ENABLE(sim-bswap,
-[  --enable-sim-bswap                  Use Host specific BSWAP instruction.],
-[case "${enableval}" in
-  yes) sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
-  no)  sim_bswap="-DWITH_BSWAP=0";;
-  *)   AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
-  echo "Setting bswap flags = $sim_bswap" 6>&1
-fi],[sim_bswap=""])dnl
-AC_SUBST(sim_bswap)
-
-
-AC_ARG_ENABLE(sim-cflags,
-[  --enable-sim-cflags=opts            Extra CFLAGS for use in building simulator],
-[case "${enableval}" in
-  yes)  sim_cflags="-O2 -fomit-frame-pointer";;
-  trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";;
-  no)   sim_cflags="";;
-  *)    sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
-esac
-if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
-  echo "Setting sim cflags = $sim_cflags" 6>&1
-fi],[sim_cflags=""])dnl
-AC_SUBST(sim_cflags)
+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,
-[  --enable-sim-debug=opts             Enable debugging flags],
+[AS_HELP_STRING([--enable-sim-debug=opts],
+               [Enable debugging flags (for developers of the sim itself)])],
 [case "${enableval}" in
-  yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
-  no)  sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
-  *)   sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
-  echo "Setting sim debug = $sim_debug" 6>&1
-fi],[sim_debug=""])dnl
-AC_SUBST(sim_debug)
+  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,
-[  --enable-sim-stdio                  Specify whether to use stdio for console input/output.],
+[AS_HELP_STRING([--enable-sim-stdio],
+               [Specify whether to use stdio for console input/output])],
 [case "${enableval}" in
-  yes) sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
-  no)  sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
-  *)   AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
-  echo "Setting stdio flags = $sim_stdio" 6>&1
-fi],[sim_stdio=""])dnl
-AC_SUBST(sim_stdio)
+  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.
+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,
-[  --enable-sim-trace=opts             Enable tracing flags],
+[AS_HELP_STRING([--enable-sim-trace=opts],
+               [Enable tracing of simulated programs])],
 [case "${enableval}" in
-  yes) sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
-  no)  sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
+  yes) sim_trace="-1";;
+  no)  sim_trace="0";;
   [[-0-9]]*)
-       sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
+       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="-DWITH_TRACE='(TRACE_$x"
+           sim_trace="(TRACE_$x"
          else
            sim_trace="${sim_trace}|TRACE_$x"
          fi
        done
-       sim_trace="$sim_trace)'" ;;
-esac
-if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
-  echo "Setting sim trace = $sim_trace" 6>&1
-fi],[sim_trace=""])dnl
-AC_SUBST(sim_trace)
+       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
@@ -220,30 +205,38 @@ 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,
-[  --enable-sim-profile=opts           Enable profiling flags],
+[AS_HELP_STRING([--enable-sim-profile=opts], [Enable profiling flags])],
 [case "${enableval}" in
-  yes) sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
-  no)  sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
+  yes) profile="1" sim_profile="-1";;
+  no)  profile="0" sim_profile="0";;
   [[-0-9]]*)
-       sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
+       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="-DWITH_PROFILE='(PROFILE_$x"
+           sim_profile="(PROFILE_$x"
          else
            sim_profile="${sim_profile}|PROFILE_$x"
          fi
        done
-       sim_profile="$sim_profile)'" ;;
-esac
-if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
-  echo "Setting sim profile = $sim_profile" 6>&1
-fi],[sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1"])dnl
-AC_SUBST(sim_profile)
+       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)
 
-ACX_PKGVERSION([GDB])
+
+SIM_AC_OPTION_ASSERT
+SIM_AC_OPTION_ENVIRONMENT
+SIM_AC_OPTION_INLINE
+
+ACX_PKGVERSION([SIM])
 ACX_BUGURL([http://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])
@@ -254,39 +247,18 @@ AC_TYPE_SIGNAL
 dnl Detect exe extension
 AC_EXEEXT
 
-dnl These are available to append to as desired.
-sim_link_files=
-sim_link_links=
-
-dnl Create tconfig.h either from simulator's tconfig.in or default one
-dnl in common.
-sim_link_links=tconfig.h
-if test -f ${srcdir}/tconfig.in
-then
-  sim_link_files=tconfig.in
-else
-  sim_link_files=../common/tconfig.in
-fi
-
-# targ-vals.def points to the libc macro description file.
-case "${target}" in
-*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
-esac
-sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
-sim_link_links="${sim_link_links} targ-vals.def"
-
 ]) dnl End of SIM_AC_COMMON
 
 
 dnl Additional SIM options that can (optionally) be configured
 dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined.
 dnl Simulators that wish to use the relevant option specify the macro
-dnl in the simulator specific configure.in file between the SIM_AC_COMMON
+dnl in the simulator specific configure.ac file between the SIM_AC_COMMON
 dnl and SIM_AC_OUTPUT lines.
 
 
 dnl Specify the running environment.
-dnl If the simulator invokes this in its configure.in then without this option
+dnl If the simulator invokes this in its configure.ac then without this option
 dnl the default is the user environment and all are runtime selectable.
 dnl If the simulator doesn't invoke this, only the user environment is
 dnl supported.
@@ -294,22 +266,21 @@ dnl ??? Until there is demonstrable value in doing something more complicated,
 dnl let's not.
 AC_DEFUN([SIM_AC_OPTION_ENVIRONMENT],
 [
+AC_MSG_CHECKING([default sim environment setting])
+sim_environment="ALL_ENVIRONMENT"
 AC_ARG_ENABLE(sim-environment,
-[  --enable-sim-environment=environment        Specify mixed, user, virtual or operating environment.],
+[AS_HELP_STRING([--enable-sim-environment=environment],
+               [Specify mixed, user, virtual or operating environment])],
 [case "${enableval}" in
-  all | ALL)             sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT";;
-  user | USER)           sim_environment="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";;
-  virtual | VIRTUAL)     sim_environment="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";;
-  operating | OPERATING) sim_environment="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";;
-  *)   AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-environment");
-       sim_environment="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_environment" != x""; then
-  echo "Setting sim environment = $sim_environment" 6>&1
-fi],
-[sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT"])dnl
+  all | ALL)             sim_environment="ALL_ENVIRONMENT";;
+  user | USER)           sim_environment="USER_ENVIRONMENT";;
+  virtual | VIRTUAL)     sim_environment="VIRTUAL_ENVIRONMENT";;
+  operating | OPERATING) sim_environment="OPERATING_ENVIRONMENT";;
+  *)   AC_MSG_ERROR([Unknown value $enableval passed to --enable-sim-environment]);;
+esac])dnl
+AC_DEFINE_UNQUOTED([WITH_ENVIRONMENT], [$sim_environment], [Sim default environment])
+AC_MSG_RESULT($sim_environment)
 ])
-AC_SUBST(sim_environment)
 
 
 dnl Specify the alignment restrictions of the target architecture.
@@ -321,7 +292,8 @@ wire_alignment="[$1]"
 default_alignment="[$2]"
 [
 AC_ARG_ENABLE(sim-alignment,
-[  --enable-sim-alignment=align                Specify strict,  nonstrict or forced alignment of memory accesses.],
+[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";;
@@ -367,18 +339,19 @@ AC_SUBST(sim_alignment)
 dnl Conditionally compile in assertion statements.
 AC_DEFUN([SIM_AC_OPTION_ASSERT],
 [
+AC_MSG_CHECKING([whether to enable sim asserts])
+sim_assert="1"
 AC_ARG_ENABLE(sim-assert,
-[  --enable-sim-assert                 Specify whether to perform random assertions.],
+[AS_HELP_STRING([--enable-sim-assert],
+               [Specify whether to perform random assertions])],
 [case "${enableval}" in
-  yes) sim_assert="-DWITH_ASSERT=1";;
-  no)  sim_assert="-DWITH_ASSERT=0";;
-  *)   AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
-  echo "Setting assert flags = $sim_assert" 6>&1
-fi],[sim_assert=""])dnl
+  yes) sim_assert="1";;
+  no)  sim_assert="0";;
+  *)   AC_MSG_ERROR([--enable-sim-assert does not take a value]);;
+esac])dnl
+AC_DEFINE_UNQUOTED([WITH_ASSERT], [$sim_assert], [Sim assert settings])
+AC_MSG_RESULT($sim_assert)
 ])
-AC_SUBST(sim_assert)
 
 
 
@@ -395,7 +368,7 @@ wire_word_msb="[$2]"
 wire_address_bitsize="[$3]"
 wire_cell_bitsize="[$4]"
 [AC_ARG_ENABLE(sim-bitsize,
-[  --enable-sim-bitsize=N              Specify target bitsize (32 or 64).],
+[AS_HELP_STRING([--enable-sim-bitsize=N], [Specify target bitsize (32 or 64)])],
 [sim_bitsize=
 case "${enableval}" in
   64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
@@ -460,28 +433,29 @@ AC_DEFUN([SIM_AC_OPTION_ENDIAN],
 wire_endian="[$1]"
 default_endian="[$2]"
 AC_ARG_ENABLE(sim-endian,
-[  --enable-sim-endian=endian          Specify target byte endian orientation.],
+[AS_HELP_STRING([--enable-sim-endian=endian],
+               [Specify target byte endian orientation])],
 [case "${enableval}" in
-  b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
-  l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
+  b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_BIG";;
+  l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE";;
   yes)  if test x"$wire_endian" != x; then
-          sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
+          sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}"
         else
-           if test x"$default_endian" != x; then
-            sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
+         if test x"$default_endian" != x; then
+            sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}"
           else
             echo "No hard-wired endian for target $target" 1>&6
-            sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
+            sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_UNKNOWN"
           fi
         fi;;
   no)   if test x"$default_endian" != x; then
-          sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
+          sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}"
         else
           if test x"$wire_endian" != x; then
-            sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
+            sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}"
           else
             echo "No default endian for target $target" 1>&6
-            sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
+            sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_UNKNOWN"
           fi
         fi;;
   *)    AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
@@ -490,10 +464,10 @@ if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
   echo "Setting endian flags = $sim_endian" 6>&1
 fi],
 [if test x"$default_endian" != x; then
-  sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
+  sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}"
 else
   if test x"$wire_endian" != x; then
-    sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
+    sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}"
   else
     sim_endian=
   fi
@@ -502,36 +476,6 @@ fi])dnl
 AC_SUBST(sim_endian)
 
 
-dnl --enable-sim-hostendian is for users of the simulator when
-dnl they find that AC_C_BIGENDIAN does not function correctly
-dnl (for instance in a canadian cross)
-AC_DEFUN([SIM_AC_OPTION_HOSTENDIAN],
-[
-AC_ARG_ENABLE(sim-hostendian,
-[  --enable-sim-hostendian=end         Specify host byte endian orientation.],
-[case "${enableval}" in
-  no)   sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
-  b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
-  l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
-  *)    AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
-  echo "Setting hostendian flags = $sim_hostendian" 6>&1
-fi],[
-if test "x$cross_compiling" = "xno"; then
-  AC_C_BIGENDIAN
-  if test $ac_cv_c_bigendian = yes; then
-    sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
-  else
-    sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
-  fi
-else
-  sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
-fi])dnl
-])
-AC_SUBST(sim_hostendian)
-
-
 dnl --enable-sim-float is for developers of the simulator
 dnl It specifies the presence of hardware floating point
 dnl And optionally the bitsize of the floating point register.
@@ -542,7 +486,8 @@ AC_DEFUN([SIM_AC_OPTION_FLOAT],
 default_sim_float="[$1]"
 default_sim_float_bitsize="[$2]"
 AC_ARG_ENABLE(sim-float,
-[  --enable-sim-float                  Specify that the target processor has floating point hardware.],
+[AS_HELP_STRING([--enable-sim-float],
+               [Specify that the target processor has floating point hardware])],
 [case "${enableval}" in
   yes | hard)  sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
   no | soft)   sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
@@ -570,7 +515,8 @@ AC_DEFUN([SIM_AC_OPTION_SCACHE],
 [
 default_sim_scache="ifelse([$1],,0,[$1])"
 AC_ARG_ENABLE(sim-scache,
-[  --enable-sim-scache=size            Specify simulator execution cache size.],
+[AS_HELP_STRING([--enable-sim-scache=size],
+               [Specify simulator execution cache size])],
 [case "${enableval}" in
   yes) sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
   no)  sim_scache="-DWITH_SCACHE=0" ;;
@@ -590,7 +536,8 @@ AC_DEFUN([SIM_AC_OPTION_DEFAULT_MODEL],
 [
 default_sim_default_model="ifelse([$1],,0,[$1])"
 AC_ARG_ENABLE(sim-default-model,
-[  --enable-sim-default-model=model    Specify default model to simulate.],
+[AS_HELP_STRING([--enable-sim-default-model=model],
+               [Specify default model to simulate])],
 [case "${enableval}" in
   yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");;
   *)   sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";;
@@ -603,36 +550,34 @@ AC_SUBST(sim_default_model)
 
 
 dnl --enable-sim-hardware is for users of the simulator
-dnl arg[1] Enable sim-hw by default? ("yes", "no", or "always")
+dnl arg[1] Enable sim-hw by default? ("yes" or "no")
 dnl arg[2] is a space separated list of devices that override the defaults
 dnl arg[3] is a space separated list of extra target specific devices.
 AC_DEFUN([SIM_AC_OPTION_HARDWARE],
 [
-if test x"[$1]" != x"no"; then
-  sim_hw_p=yes
-else
-  sim_hw_p=no
-fi
 if test "[$2]"; then
   hardware="[$2]"
 else
   hardware="cfi core pal glue"
 fi
 hardware="$hardware [$3]"
+
 sim_hw_cflags="-DWITH_HW=1"
 sim_hw="$hardware"
 sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
+
 AC_ARG_ENABLE(sim-hardware,
-[  --enable-sim-hardware=LIST          Specify the hardware to be included in the build.],
-[
-case "${enableval}" in
-  yes) sim_hw_p=yes;;
-  no)  sim_hw_p=no;;
-  ,*)   sim_hw_p=yes; hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
-  *,)   sim_hw_p=yes; hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
-  *)   sim_hw_p=yes; hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
+  [AS_HELP_STRING([--enable-sim-hardware=LIST],
+                  [Specify the hardware to be included in the build.])],
+  ,[enable_sim_hardware="[$1]"])
+case ${enable_sim_hardware} in
+  yes|no) ;;
+  ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)  hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
 esac
-if test "$sim_hw_p" != yes; then
+
+if test "$enable_sim_hardware" = no; then
   sim_hw_objs=
   sim_hw_cflags="-DWITH_HW=0"
   sim_hw=
@@ -648,35 +593,24 @@ else
     esac
   done
   # mingw does not support sockser
-  SIM_DV_SOCKSER_O=""
   case ${host} in
     *mingw*) ;;
-    *) SIM_DV_SOCKSER_O="dv-sockser.o"
+    *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
+       # that you instatiate.  Instead, other code will call into it directly.
+       # At some point, we should convert it over.
+       sim_hw_objs="$sim_hw_objs dv-sockser.o"
        AC_DEFINE_UNQUOTED(
          [HAVE_DV_SOCKSER], 1, [Define if dv-sockser is usable.])
        ;;
   esac
-  AC_SUBST(SIM_DV_SOCKSER_O)
-fi
-if test x"$silent" != x"yes" && test "$sim_hw_p" = "yes"; then
-  echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
-fi],[
-if test "$sim_hw_p" != yes; then
-  if test "[$1]" = "always"; then
-    AC_MSG_ERROR([Sorry, but this simulator requires that hardware support
-be enabled. Please configure without --disable-hw-support.])
+  if test x"$silent" != x"yes"; then
+    echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
   fi
-  sim_hw_objs=
-  sim_hw_cflags="-DWITH_HW=0"
-  sim_hw=
+  dnl Some devices require extra libraries.
+  case " $hardware " in
+    *" cfi "*) AC_CHECK_LIB(m, log2);;
+  esac
 fi
-if test x"$silent" != x"yes"; then
-  echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
-fi])
-dnl Some devices require extra libraries.
-case " $hardware " in
-  *" cfi "*) AC_CHECK_LIB(m, log2);;
-esac
 ])
 AC_SUBST(sim_hw_cflags)
 AC_SUBST(sim_hw_objs)
@@ -685,13 +619,13 @@ AC_SUBST(sim_hw)
 
 dnl --enable-sim-inline is for users that wish to ramp up the simulator's
 dnl performance by inlining functions.
-dnl Guarantee that unconfigured simulators do not do any inlining
-sim_inline="-DDEFAULT_INLINE=0"
+dnl Default sims to no inlining.
 AC_DEFUN([SIM_AC_OPTION_INLINE],
 [
-default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
+sim_inline="-DDEFAULT_INLINE=m4_ifblank([$1],[0],[$1])"
 AC_ARG_ENABLE(sim-inline,
-[  --enable-sim-inline=inlines         Specify which functions should be inlined.],
+[AS_HELP_STRING([--enable-sim-inline=inlines],
+               [Specify which functions should be inlined])],
 [sim_inline=""
 case "$enableval" in
   no)          sim_inline="-DDEFAULT_INLINE=0";;
@@ -715,71 +649,17 @@ case "$enableval" in
 esac
 if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
   echo "Setting inline flags = $sim_inline" 6>&1
-fi],[
-if test "x$cross_compiling" = "xno"; then
-  if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
-    sim_inline="${default_sim_inline}"
-    if test x"$silent" != x"yes"; then
-      echo "Setting inline flags = $sim_inline" 6>&1
-    fi
-  else
-    sim_inline=""
-  fi
-else
-  sim_inline="-DDEFAULT_INLINE=0"
 fi])dnl
 ])
 AC_SUBST(sim_inline)
 
 
-AC_DEFUN([SIM_AC_OPTION_PACKAGES],
-[
-AC_ARG_ENABLE(sim-packages,
-[  --enable-sim-packages=list          Specify the packages to be included in the build.],
-[packages=disklabel
-case "${enableval}" in
-  yes) ;;
-  no)  AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
-  ,*)   packages="${packages}${enableval}";;
-  *,)   packages="${enableval}${packages}";;
-  *)   packages="${enableval}"'';;
-esac
-sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
-sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
-if test x"$silent" != x"yes" && test x"$packages" != x""; then
-  echo "Setting packages to $sim_pk_src, $sim_pk_obj"
-fi],[packages=disklabel
-sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
-sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
-if test x"$silent" != x"yes"; then
-  echo "Setting packages to $sim_pk_src, $sim_pk_obj"
-fi])dnl
-])
-AC_SUBST(sim_packages)
-
-
-AC_DEFUN([SIM_AC_OPTION_REGPARM],
-[
-AC_ARG_ENABLE(sim-regparm,
-[  --enable-sim-regparm=nr-parm                Pass parameters in registers instead of on the stack - x86/GCC specific.],
-[case "${enableval}" in
-  0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
-  no)                            sim_regparm="" ;;
-  yes)                           sim_regparm="-DWITH_REGPARM=3";;
-  *)   AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
-  echo "Setting regparm flags = $sim_regparm" 6>&1
-fi],[sim_regparm=""])dnl
-])
-AC_SUBST(sim_regparm)
-
-
 AC_DEFUN([SIM_AC_OPTION_RESERVED_BITS],
 [
 default_sim_reserved_bits="ifelse([$1],,1,[$1])"
 AC_ARG_ENABLE(sim-reserved-bits,
-[  --enable-sim-reserved-bits          Specify whether to check reserved bits in instruction.],
+[AS_HELP_STRING([--enable-sim-reserved-bits],
+               [Specify whether to check reserved bits in instruction])],
 [case "${enableval}" in
   yes) sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
   no)  sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
@@ -794,56 +674,39 @@ AC_SUBST(sim_reserved_bits)
 
 AC_DEFUN([SIM_AC_OPTION_SMP],
 [
+AC_MSG_CHECKING([number of sim cpus to support])
 default_sim_smp="ifelse([$1],,5,[$1])"
+sim_smp="$default_sim_smp""
 AC_ARG_ENABLE(sim-smp,
-[  --enable-sim-smp=n                  Specify number of processors to configure for (default ${default_sim_smp}).],
+[AS_HELP_STRING([--enable-sim-smp=n],
+               [Specify number of processors to configure for (default ${default_sim_smp})])],
 [case "${enableval}" in
-  yes) sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
-  no)  sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
-  *)   sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
-  echo "Setting smp flags = $sim_smp" 6>&1
-fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
-if test x"$silent" != x"yes"; then
-  echo "Setting smp flags = $sim_smp" 6>&1
-fi])dnl
-])
-AC_SUBST(sim_smp)
-
-
-AC_DEFUN([SIM_AC_OPTION_STDCALL],
-[
-AC_ARG_ENABLE(sim-stdcall,
-[  --enable-sim-stdcall=type           Use an alternative function call/return mechanism - x86/GCC specific.],
-[case "${enableval}" in
-  no)          sim_stdcall="" ;;
-  std*)                sim_stdcall="-DWITH_STDCALL=1";;
-  yes)         sim_stdcall="-DWITH_STDCALL=1";;
-  *)   AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
-  echo "Setting function call flags = $sim_stdcall" 6>&1
-fi],[sim_stdcall=""])dnl
+  yes) sim_smp="5";;
+  no)  sim_smp="0";;
+  *)   sim_smp="$enableval";;
+esac])dnl
+sim_igen_smp="-N ${sim_smp}"
+AC_DEFINE_UNQUOTED([WITH_SMP], [$sim_smp], [Sim SMP settings])
+AC_MSG_RESULT($sim_smp)
 ])
-AC_SUBST(sim_stdcall)
 
 
 AC_DEFUN([SIM_AC_OPTION_XOR_ENDIAN],
 [
+AC_MSG_CHECKING([for xor endian support])
 default_sim_xor_endian="ifelse([$1],,8,[$1])"
+sim_xor_endian="$default_sim_xor_endian"
 AC_ARG_ENABLE(sim-xor-endian,
-[  --enable-sim-xor-endian=n           Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).],
+[AS_HELP_STRING([--enable-sim-xor-endian=n],
+               [Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian})])],
 [case "${enableval}" in
-  yes) sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
-  no)  sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
-  *)   sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
-esac
-if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
-  echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
-fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
+  yes) sim_xor_endian="8";;
+  no)  sim_xor_endian="0";;
+  *)   sim_xor_endian="$enableval";;
+esac])dnl
+AC_DEFINE_UNQUOTED([WITH_XOR_ENDIAN], [$sim_xor_endian], [Sim XOR endian settings])
+AC_MSG_RESULT($sim_smp)
 ])
-AC_SUBST(sim_xor_endian)
 
 
 dnl --enable-build-warnings is for developers of the simulator.
@@ -870,20 +733,18 @@ if test "${ERROR_ON_WARNING}" = yes ; then
      true
 fi
 
-# The entries after -Wno-pointer-sign are disabled warnings which may
-# be enabled in the future, which can not currently be used to build
-# GDB.
-# NOTE: If you change this list, remember to update
-# gdb/doc/gdbint.texinfo.
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
--Wformat-nonliteral -Wno-pointer-sign \
+-Wpointer-sign \
 -Wno-unused -Wunused-value -Wunused-function \
--Wno-switch -Wno-char-subscripts -Wmissing-prototypes"
+-Wno-switch -Wno-char-subscripts -Wmissing-prototypes
+-Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \
+-Wold-style-declaration -Wold-style-definition"
 
 # Enable -Wno-format by default when using gcc on mingw since many
 # GCC versions complain about %I64.
 case "${host}" in
   *-*-mingw32*) build_warnings="$build_warnings -Wno-format" ;;
+  *) build_warnings="$build_warnings -Wformat-nonliteral" ;;
 esac
 
 AC_ARG_ENABLE(build-warnings,
@@ -946,7 +807,6 @@ dnl the target's fragment at the appropriate points.
 
 AC_DEFUN([SIM_AC_OUTPUT],
 [
-AC_LINK_FILES($sim_link_files, $sim_link_links)
 dnl Make @cgen_breaks@ non-null only if the sim uses CGEN.
 cgen_breaks=""
 if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
@@ -986,16 +846,22 @@ dnl a directory name, but what we're doing here is an enable/disable kind
 dnl of thing and specifying both --enable and --with is klunky.
 dnl If you reeely want this to be --with, go ahead and change it.
 AC_ARG_ENABLE(cgen-maint,
-[  --enable-cgen-maint[=DIR]    build cgen generated files],
+[AS_HELP_STRING([--enable-cgen-maint[=DIR]], [build cgen generated files])],
 [case "${enableval}" in
   yes) cgen_maint=yes ;;
   no)  cgen_maint=no ;;
   *)
-       # argument is cgen install directory (not implemented yet).
-       # Having a `share' directory might be more appropriate for the .scm,
-       # .cpu, etc. files.
-       cgendir=${cgen_maint}/lib/cgen
-       cgen=guile
+       # Argument is a directory where cgen can be found.  In some
+       # future world cgen could be installable, but right now this
+       # is not the case.  Instead we assume the directory is a path
+       # to the cgen source tree.
+       cgen_maint=yes
+        if test -r ${enableval}/iformat.scm; then
+          # This looks like a cgen source tree.
+         cgendir=${enableval}
+        else
+         AC_MSG_ERROR(${enableval} doesn't look like a cgen source tree)
+        fi
        ;;
 esac])dnl
 dnl AM_CONDITIONAL(CGEN_MAINT, test x${cgen_maint} != xno)
This page took 0.034565 seconds and 4 git commands to generate.