OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [sim/] [common/] [aclocal.m4] - Diff between revs 835 and 841

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 835 Rev 841
# This file contains common code used by all simulators.
# This file contains common code used by all simulators.
#
#
# SIM_AC_COMMON invokes AC macros used by all simulators and by the common
# SIM_AC_COMMON invokes AC macros used by all simulators and by the common
# directory.  It is intended to be invoked before any target specific stuff.
# directory.  It is intended to be invoked before any target specific stuff.
# SIM_AC_OUTPUT is a cover function to AC_OUTPUT to generate the Makefile.
# SIM_AC_OUTPUT is a cover function to AC_OUTPUT to generate the Makefile.
# It is intended to be invoked last.
# It is intended to be invoked last.
#
#
# The simulator's configure.in should look like:
# The simulator's configure.in should look like:
#
#
# dnl Process this file with autoconf to produce a configure script.
# dnl Process this file with autoconf to produce a configure script.
# sinclude(../common/aclocal.m4)
# sinclude(../common/aclocal.m4)
# AC_PREREQ(2.5)dnl
# AC_PREREQ(2.5)dnl
# AC_INIT(Makefile.in)
# AC_INIT(Makefile.in)
#
#
# SIM_AC_COMMON
# SIM_AC_COMMON
#
#
# ... target specific stuff ...
# ... target specific stuff ...
#
#
# SIM_AC_OUTPUT
# SIM_AC_OUTPUT
 
 
# Include global overrides and fixes for Autoconf.
# Include global overrides and fixes for Autoconf.
m4_include(../../config/override.m4)
m4_include(../../config/override.m4)
sinclude([../../config/zlib.m4])
sinclude([../../config/zlib.m4])
 
 
AC_DEFUN([SIM_AC_COMMON],
AC_DEFUN([SIM_AC_COMMON],
[
[
# autoconf.info says this should be called right after AC_INIT.
# autoconf.info says this should be called right after AC_INIT.
AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in)
AC_CONFIG_HEADER(ifelse([$1],,config.h,[$1]):config.in)
AC_CANONICAL_SYSTEM
AC_CANONICAL_SYSTEM
AC_ARG_PROGRAM
AC_ARG_PROGRAM
AC_PROG_CC
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_INSTALL
 
 
# Put a plausible default for CC_FOR_BUILD in Makefile.
# Put a plausible default for CC_FOR_BUILD in Makefile.
if test "x$cross_compiling" = "xno"; then
if test "x$cross_compiling" = "xno"; then
  CC_FOR_BUILD='$(CC)'
  CC_FOR_BUILD='$(CC)'
else
else
  CC_FOR_BUILD=gcc
  CC_FOR_BUILD=gcc
fi
fi
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(CC_FOR_BUILD)
 
 
AC_SUBST(CFLAGS)
AC_SUBST(CFLAGS)
AC_SUBST(HDEFINES)
AC_SUBST(HDEFINES)
AR=${AR-ar}
AR=${AR-ar}
AC_SUBST(AR)
AC_SUBST(AR)
AC_PROG_RANLIB
AC_PROG_RANLIB
 
 
dnl We don't use gettext, but bfd does.  So we do the appropriate checks
dnl We don't use gettext, but bfd does.  So we do the appropriate checks
dnl to see if there are intl libraries we should link against.
dnl to see if there are intl libraries we should link against.
ALL_LINGUAS=
ALL_LINGUAS=
ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
ZW_GNU_GETTEXT_SISTER_DIR(../../intl)
 
 
# Check for common headers.
# Check for common headers.
# FIXME: Seems to me this can cause problems for i386-windows hosts.
# 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*.
# 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(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/resource.h)
AC_CHECK_HEADERS(fcntl.h fpu_control.h)
AC_CHECK_HEADERS(fcntl.h fpu_control.h)
AC_CHECK_HEADERS(dlfcn.h errno.h sys/stat.h)
AC_CHECK_HEADERS(dlfcn.h errno.h sys/stat.h)
AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
 
 
# Check for socket libraries
# Check for socket libraries
AC_CHECK_LIB(socket, bind)
AC_CHECK_LIB(socket, bind)
AC_CHECK_LIB(nsl, gethostbyname)
AC_CHECK_LIB(nsl, gethostbyname)
 
 
. ${srcdir}/../../bfd/configure.host
. ${srcdir}/../../bfd/configure.host
 
 
dnl Standard (and optional) simulator options.
dnl Standard (and optional) simulator options.
dnl Eventually all simulators will support these.
dnl Eventually all simulators will support these.
dnl Do not add any here that cannot be supported by all simulators.
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 Do not add similar but different options to a particular simulator,
dnl all shall eventually behave the same way.
dnl all shall eventually behave the same way.
 
 
 
 
dnl We don't use automake, but we still want to support
dnl We don't use automake, but we still want to support
dnl --enable-maintainer-mode.
dnl --enable-maintainer-mode.
USE_MAINTAINER_MODE=no
USE_MAINTAINER_MODE=no
AC_ARG_ENABLE(maintainer-mode,
AC_ARG_ENABLE(maintainer-mode,
[  --enable-maintainer-mode             Enable developer functionality.],
[  --enable-maintainer-mode             Enable developer functionality.],
[case "${enableval}" in
[case "${enableval}" in
  yes)  MAINT="" USE_MAINTAINER_MODE=yes ;;
  yes)  MAINT="" USE_MAINTAINER_MODE=yes ;;
  no)   MAINT="#" ;;
  no)   MAINT="#" ;;
  *)    AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;;
  *)    AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;;
esac
esac
if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
if test x"$silent" != x"yes" && test x"$MAINT" = x""; then
  echo "Setting maintainer mode" 6>&1
  echo "Setting maintainer mode" 6>&1
fi],[MAINT="#"])dnl
fi],[MAINT="#"])dnl
AC_SUBST(MAINT)
AC_SUBST(MAINT)
 
 
 
 
dnl This is a generic option to enable special byte swapping
dnl This is a generic option to enable special byte swapping
dnl insns on *any* cpu.
dnl insns on *any* cpu.
AC_ARG_ENABLE(sim-bswap,
AC_ARG_ENABLE(sim-bswap,
[  --enable-sim-bswap                   Use Host specific BSWAP instruction.],
[  --enable-sim-bswap                   Use Host specific BSWAP instruction.],
[case "${enableval}" in
[case "${enableval}" in
  yes)  sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
  yes)  sim_bswap="-DWITH_BSWAP=1 -DUSE_BSWAP=1";;
  no)   sim_bswap="-DWITH_BSWAP=0";;
  no)   sim_bswap="-DWITH_BSWAP=0";;
  *)    AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
  *)    AC_MSG_ERROR("--enable-sim-bswap does not take a value"); sim_bswap="";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
if test x"$silent" != x"yes" && test x"$sim_bswap" != x""; then
  echo "Setting bswap flags = $sim_bswap" 6>&1
  echo "Setting bswap flags = $sim_bswap" 6>&1
fi],[sim_bswap=""])dnl
fi],[sim_bswap=""])dnl
AC_SUBST(sim_bswap)
AC_SUBST(sim_bswap)
 
 
 
 
AC_ARG_ENABLE(sim-cflags,
AC_ARG_ENABLE(sim-cflags,
[  --enable-sim-cflags=opts             Extra CFLAGS for use in building simulator],
[  --enable-sim-cflags=opts             Extra CFLAGS for use in building simulator],
[case "${enableval}" in
[case "${enableval}" in
  yes)   sim_cflags="-O2 -fomit-frame-pointer";;
  yes)   sim_cflags="-O2 -fomit-frame-pointer";;
  trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";;
  trace) AC_MSG_ERROR("Please use --enable-sim-debug instead."); sim_cflags="";;
  no)    sim_cflags="";;
  no)    sim_cflags="";;
  *)     sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
  *)     sim_cflags=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
if test x"$silent" != x"yes" && test x"$sim_cflags" != x""; then
  echo "Setting sim cflags = $sim_cflags" 6>&1
  echo "Setting sim cflags = $sim_cflags" 6>&1
fi],[sim_cflags=""])dnl
fi],[sim_cflags=""])dnl
AC_SUBST(sim_cflags)
AC_SUBST(sim_cflags)
 
 
 
 
dnl --enable-sim-debug is for developers of the simulator
dnl --enable-sim-debug is for developers of the simulator
dnl the allowable values are work-in-progress
dnl the allowable values are work-in-progress
AC_ARG_ENABLE(sim-debug,
AC_ARG_ENABLE(sim-debug,
[  --enable-sim-debug=opts              Enable debugging flags],
[  --enable-sim-debug=opts              Enable debugging flags],
[case "${enableval}" in
[case "${enableval}" in
  yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
  yes) sim_debug="-DDEBUG=7 -DWITH_DEBUG=7";;
  no)  sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
  no)  sim_debug="-DDEBUG=0 -DWITH_DEBUG=0";;
  *)   sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
  *)   sim_debug="-DDEBUG='(${enableval})' -DWITH_DEBUG='(${enableval})'";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
if test x"$silent" != x"yes" && test x"$sim_debug" != x""; then
  echo "Setting sim debug = $sim_debug" 6>&1
  echo "Setting sim debug = $sim_debug" 6>&1
fi],[sim_debug=""])dnl
fi],[sim_debug=""])dnl
AC_SUBST(sim_debug)
AC_SUBST(sim_debug)
 
 
 
 
dnl --enable-sim-stdio is for users of the simulator
dnl --enable-sim-stdio is for users of the simulator
dnl It determines if IO from the program is routed through STDIO (buffered)
dnl It determines if IO from the program is routed through STDIO (buffered)
AC_ARG_ENABLE(sim-stdio,
AC_ARG_ENABLE(sim-stdio,
[  --enable-sim-stdio                   Specify whether to use stdio for console input/output.],
[  --enable-sim-stdio                   Specify whether to use stdio for console input/output.],
[case "${enableval}" in
[case "${enableval}" in
  yes)  sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
  yes)  sim_stdio="-DWITH_STDIO=DO_USE_STDIO";;
  no)   sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
  no)   sim_stdio="-DWITH_STDIO=DONT_USE_STDIO";;
  *)    AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";;
  *)    AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-stdio"); sim_stdio="";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
if test x"$silent" != x"yes" && test x"$sim_stdio" != x""; then
  echo "Setting stdio flags = $sim_stdio" 6>&1
  echo "Setting stdio flags = $sim_stdio" 6>&1
fi],[sim_stdio=""])dnl
fi],[sim_stdio=""])dnl
AC_SUBST(sim_stdio)
AC_SUBST(sim_stdio)
 
 
 
 
dnl --enable-sim-trace is for users of the simulator
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 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 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 elements to enable.  The latter is only supported on simulators that
dnl use WITH_TRACE.
dnl use WITH_TRACE.
AC_ARG_ENABLE(sim-trace,
AC_ARG_ENABLE(sim-trace,
[  --enable-sim-trace=opts              Enable tracing flags],
[  --enable-sim-trace=opts              Enable tracing flags],
[case "${enableval}" in
[case "${enableval}" in
  yes)  sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
  yes)  sim_trace="-DTRACE=1 -DWITH_TRACE=-1";;
  no)   sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
  no)   sim_trace="-DTRACE=0 -DWITH_TRACE=0";;
  [[-0-9]]*)
  [[-0-9]]*)
        sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
        sim_trace="-DTRACE='(${enableval})' -DWITH_TRACE='(${enableval})'";;
  [[a-z]]*)
  [[a-z]]*)
        sim_trace=""
        sim_trace=""
        for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
        for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
          if test x"$sim_trace" = x; then
          if test x"$sim_trace" = x; then
            sim_trace="-DWITH_TRACE='(TRACE_$x"
            sim_trace="-DWITH_TRACE='(TRACE_$x"
          else
          else
            sim_trace="${sim_trace}|TRACE_$x"
            sim_trace="${sim_trace}|TRACE_$x"
          fi
          fi
        done
        done
        sim_trace="$sim_trace)'" ;;
        sim_trace="$sim_trace)'" ;;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
if test x"$silent" != x"yes" && test x"$sim_trace" != x""; then
  echo "Setting sim trace = $sim_trace" 6>&1
  echo "Setting sim trace = $sim_trace" 6>&1
fi],[sim_trace=""])dnl
fi],[sim_trace=""])dnl
AC_SUBST(sim_trace)
AC_SUBST(sim_trace)
 
 
 
 
dnl --enable-sim-profile
dnl --enable-sim-profile
dnl The argument is either a bitmask of things to enable [exactly what is
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 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 elements to enable.  The latter is only supported on simulators that
dnl use WITH_PROFILE.
dnl use WITH_PROFILE.
AC_ARG_ENABLE(sim-profile,
AC_ARG_ENABLE(sim-profile,
[  --enable-sim-profile=opts            Enable profiling flags],
[  --enable-sim-profile=opts            Enable profiling flags],
[case "${enableval}" in
[case "${enableval}" in
  yes)  sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
  yes)  sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1";;
  no)   sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
  no)   sim_profile="-DPROFILE=0 -DWITH_PROFILE=0";;
  [[-0-9]]*)
  [[-0-9]]*)
        sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
        sim_profile="-DPROFILE='(${enableval})' -DWITH_PROFILE='(${enableval})'";;
  [[a-z]]*)
  [[a-z]]*)
        sim_profile=""
        sim_profile=""
        for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
        for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
          if test x"$sim_profile" = x; then
          if test x"$sim_profile" = x; then
            sim_profile="-DWITH_PROFILE='(PROFILE_$x"
            sim_profile="-DWITH_PROFILE='(PROFILE_$x"
          else
          else
            sim_profile="${sim_profile}|PROFILE_$x"
            sim_profile="${sim_profile}|PROFILE_$x"
          fi
          fi
        done
        done
        sim_profile="$sim_profile)'" ;;
        sim_profile="$sim_profile)'" ;;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
if test x"$silent" != x"yes" && test x"$sim_profile" != x""; then
  echo "Setting sim profile = $sim_profile" 6>&1
  echo "Setting sim profile = $sim_profile" 6>&1
fi],[sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1"])dnl
fi],[sim_profile="-DPROFILE=1 -DWITH_PROFILE=-1"])dnl
AC_SUBST(sim_profile)
AC_SUBST(sim_profile)
 
 
 
 
dnl Types used by common code
dnl Types used by common code
AC_TYPE_SIGNAL
AC_TYPE_SIGNAL
 
 
dnl Detect exe extension
dnl Detect exe extension
AC_EXEEXT
AC_EXEEXT
 
 
dnl These are available to append to as desired.
dnl These are available to append to as desired.
sim_link_files=
sim_link_files=
sim_link_links=
sim_link_links=
 
 
dnl Create tconfig.h either from simulator's tconfig.in or default one
dnl Create tconfig.h either from simulator's tconfig.in or default one
dnl in common.
dnl in common.
sim_link_links=tconfig.h
sim_link_links=tconfig.h
if test -f ${srcdir}/tconfig.in
if test -f ${srcdir}/tconfig.in
then
then
  sim_link_files=tconfig.in
  sim_link_files=tconfig.in
else
else
  sim_link_files=../common/tconfig.in
  sim_link_files=../common/tconfig.in
fi
fi
 
 
# targ-vals.def points to the libc macro description file.
# targ-vals.def points to the libc macro description file.
case "${target}" in
case "${target}" in
*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
*-*-*) TARG_VALS_DEF=../common/nltvals.def ;;
esac
esac
sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
sim_link_files="${sim_link_files} ${TARG_VALS_DEF}"
sim_link_links="${sim_link_links} targ-vals.def"
sim_link_links="${sim_link_links} targ-vals.def"
 
 
]) dnl End of SIM_AC_COMMON
]) dnl End of SIM_AC_COMMON
 
 
 
 
dnl Additional SIM options that can (optionally) be configured
dnl Additional SIM options that can (optionally) be configured
dnl For optional simulator options, a macro SIM_AC_OPTION_* is defined.
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 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.in file between the SIM_AC_COMMON
dnl and SIM_AC_OUTPUT lines.
dnl and SIM_AC_OUTPUT lines.
 
 
 
 
dnl Specify the running environment.
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.in then without this option
dnl the default is the user environment and all are runtime selectable.
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 If the simulator doesn't invoke this, only the user environment is
dnl supported.
dnl supported.
dnl ??? Until there is demonstrable value in doing something more complicated,
dnl ??? Until there is demonstrable value in doing something more complicated,
dnl let's not.
dnl let's not.
AC_DEFUN([SIM_AC_OPTION_ENVIRONMENT],
AC_DEFUN([SIM_AC_OPTION_ENVIRONMENT],
[
[
AC_ARG_ENABLE(sim-environment,
AC_ARG_ENABLE(sim-environment,
[  --enable-sim-environment=environment Specify mixed, user, virtual or operating environment.],
[  --enable-sim-environment=environment Specify mixed, user, virtual or operating environment.],
[case "${enableval}" in
[case "${enableval}" in
  all | ALL)             sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT";;
  all | ALL)             sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT";;
  user | USER)           sim_environment="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";;
  user | USER)           sim_environment="-DWITH_ENVIRONMENT=USER_ENVIRONMENT";;
  virtual | VIRTUAL)     sim_environment="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";;
  virtual | VIRTUAL)     sim_environment="-DWITH_ENVIRONMENT=VIRTUAL_ENVIRONMENT";;
  operating | OPERATING) sim_environment="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";;
  operating | OPERATING) sim_environment="-DWITH_ENVIRONMENT=OPERATING_ENVIRONMENT";;
  *)   AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-environment");
  *)   AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-environment");
       sim_environment="";;
       sim_environment="";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_environment" != x""; then
if test x"$silent" != x"yes" && test x"$sim_environment" != x""; then
  echo "Setting sim environment = $sim_environment" 6>&1
  echo "Setting sim environment = $sim_environment" 6>&1
fi],
fi],
[sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT"])dnl
[sim_environment="-DWITH_ENVIRONMENT=ALL_ENVIRONMENT"])dnl
])
])
AC_SUBST(sim_environment)
AC_SUBST(sim_environment)
 
 
 
 
dnl Specify the alignment restrictions of the target architecture.
dnl Specify the alignment restrictions of the target architecture.
dnl Without this option all possible alignment restrictions are accommodated.
dnl Without this option all possible alignment restrictions are accommodated.
dnl arg[1] is hardwired target alignment
dnl arg[1] is hardwired target alignment
dnl arg[2] is default target alignment
dnl arg[2] is default target alignment
AC_DEFUN([SIM_AC_OPTION_ALIGNMENT],
AC_DEFUN([SIM_AC_OPTION_ALIGNMENT],
wire_alignment="[$1]"
wire_alignment="[$1]"
default_alignment="[$2]"
default_alignment="[$2]"
[
[
AC_ARG_ENABLE(sim-alignment,
AC_ARG_ENABLE(sim-alignment,
[  --enable-sim-alignment=align         Specify strict,  nonstrict or forced alignment of memory accesses.],
[  --enable-sim-alignment=align         Specify strict,  nonstrict or forced alignment of memory accesses.],
[case "${enableval}" in
[case "${enableval}" in
  strict | STRICT)       sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
  strict | STRICT)       sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
  nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
  nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
  forced | FORCED)       sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
  forced | FORCED)       sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
  yes) if test x"$wire_alignment" != x; then
  yes) if test x"$wire_alignment" != x; then
         sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
         sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
       else
       else
         if test x"$default_alignment" != x; then
         if test x"$default_alignment" != x; then
           sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
           sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
         else
         else
           echo "No hard-wired alignment for target $target" 1>&6
           echo "No hard-wired alignment for target $target" 1>&6
           sim_alignment="-DWITH_ALIGNMENT=0"
           sim_alignment="-DWITH_ALIGNMENT=0"
         fi
         fi
       fi;;
       fi;;
  no)  if test x"$default_alignment" != x; then
  no)  if test x"$default_alignment" != x; then
         sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
         sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
       else
       else
         if test x"$wire_alignment" != x; then
         if test x"$wire_alignment" != x; then
           sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
           sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
         else
         else
           echo "No default alignment for target $target" 1>&6
           echo "No default alignment for target $target" 1>&6
           sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
           sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
         fi
         fi
       fi;;
       fi;;
  *)   AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
  *)   AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
  echo "Setting alignment flags = $sim_alignment" 6>&1
  echo "Setting alignment flags = $sim_alignment" 6>&1
fi],
fi],
[if test x"$default_alignment" != x; then
[if test x"$default_alignment" != x; then
  sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
  sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
else
else
  if test x"$wire_alignment" != x; then
  if test x"$wire_alignment" != x; then
    sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
    sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
  else
  else
    sim_alignment=
    sim_alignment=
  fi
  fi
fi])dnl
fi])dnl
])dnl
])dnl
AC_SUBST(sim_alignment)
AC_SUBST(sim_alignment)
 
 
 
 
dnl Conditionally compile in assertion statements.
dnl Conditionally compile in assertion statements.
AC_DEFUN([SIM_AC_OPTION_ASSERT],
AC_DEFUN([SIM_AC_OPTION_ASSERT],
[
[
AC_ARG_ENABLE(sim-assert,
AC_ARG_ENABLE(sim-assert,
[  --enable-sim-assert                  Specify whether to perform random assertions.],
[  --enable-sim-assert                  Specify whether to perform random assertions.],
[case "${enableval}" in
[case "${enableval}" in
  yes)  sim_assert="-DWITH_ASSERT=1";;
  yes)  sim_assert="-DWITH_ASSERT=1";;
  no)   sim_assert="-DWITH_ASSERT=0";;
  no)   sim_assert="-DWITH_ASSERT=0";;
  *)    AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
  *)    AC_MSG_ERROR("--enable-sim-assert does not take a value"); sim_assert="";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
if test x"$silent" != x"yes" && test x"$sim_assert" != x""; then
  echo "Setting assert flags = $sim_assert" 6>&1
  echo "Setting assert flags = $sim_assert" 6>&1
fi],[sim_assert=""])dnl
fi],[sim_assert=""])dnl
])
])
AC_SUBST(sim_assert)
AC_SUBST(sim_assert)
 
 
 
 
 
 
dnl --enable-sim-bitsize is for developers of the simulator
dnl --enable-sim-bitsize is for developers of the simulator
dnl It specifies the number of BITS in the target.
dnl It specifies the number of BITS in the target.
dnl arg[1] is the number of bits in a word
dnl arg[1] is the number of bits in a word
dnl arg[2] is the number assigned to the most significant bit
dnl arg[2] is the number assigned to the most significant bit
dnl arg[3] is the number of bits in an address
dnl arg[3] is the number of bits in an address
dnl arg[4] is the number of bits in an OpenFirmware cell.
dnl arg[4] is the number of bits in an OpenFirmware cell.
dnl FIXME: this information should be obtained from bfd/archure
dnl FIXME: this information should be obtained from bfd/archure
AC_DEFUN([SIM_AC_OPTION_BITSIZE],
AC_DEFUN([SIM_AC_OPTION_BITSIZE],
wire_word_bitsize="[$1]"
wire_word_bitsize="[$1]"
wire_word_msb="[$2]"
wire_word_msb="[$2]"
wire_address_bitsize="[$3]"
wire_address_bitsize="[$3]"
wire_cell_bitsize="[$4]"
wire_cell_bitsize="[$4]"
[AC_ARG_ENABLE(sim-bitsize,
[AC_ARG_ENABLE(sim-bitsize,
[  --enable-sim-bitsize=N               Specify target bitsize (32 or 64).],
[  --enable-sim-bitsize=N               Specify target bitsize (32 or 64).],
[sim_bitsize=
[sim_bitsize=
case "${enableval}" in
case "${enableval}" in
  64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
  64,63 | 64,63,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
  32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
  32,31 | 32,31,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
  64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
  64,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
  32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
  32,0 | 64,0,* ) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
  32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
  32) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
      else
      else
        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
      fi ;;
      fi ;;
  64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
  64) if test x"$wire_word_msb" != x -a x"$wire_word_msb" != x0; then
        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63"
      else
      else
        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
        sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
      fi ;;
      fi ;;
  *)  AC_MSG_ERROR("--enable-sim-bitsize was given $enableval.  Expected 32 or 64") ;;
  *)  AC_MSG_ERROR("--enable-sim-bitsize was given $enableval.  Expected 32 or 64") ;;
esac
esac
# address bitsize
# address bitsize
tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"`
tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"`
case x"${tmp}" in
case x"${tmp}" in
  x ) ;;
  x ) ;;
  x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;;
  x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;;
  x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;;
  x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=64" ;;
  * ) AC_MSG_ERROR("--enable-sim-bitsize was given address size $enableval.  Expected 32 or 64") ;;
  * ) AC_MSG_ERROR("--enable-sim-bitsize was given address size $enableval.  Expected 32 or 64") ;;
esac
esac
# cell bitsize
# cell bitsize
tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"`
tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"`
case x"${tmp}" in
case x"${tmp}" in
  x ) ;;
  x ) ;;
  x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;;
  x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;;
  x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;;
  x64 | x64,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=64" ;;
  * ) AC_MSG_ERROR("--enable-sim-bitsize was given cell size $enableval.  Expected 32 or 64") ;;
  * ) AC_MSG_ERROR("--enable-sim-bitsize was given cell size $enableval.  Expected 32 or 64") ;;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
  echo "Setting bitsize flags = $sim_bitsize" 6>&1
  echo "Setting bitsize flags = $sim_bitsize" 6>&1
fi],
fi],
[sim_bitsize=""
[sim_bitsize=""
if test x"$wire_word_bitsize" != x; then
if test x"$wire_word_bitsize" != x; then
  sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
  sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
fi
fi
if test x"$wire_word_msb" != x; then
if test x"$wire_word_msb" != x; then
  sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
  sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
fi
fi
if test x"$wire_address_bitsize" != x; then
if test x"$wire_address_bitsize" != x; then
  sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
  sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
fi
fi
if test x"$wire_cell_bitsize" != x; then
if test x"$wire_cell_bitsize" != x; then
  sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
  sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
fi])dnl
fi])dnl
])
])
AC_SUBST(sim_bitsize)
AC_SUBST(sim_bitsize)
 
 
 
 
 
 
dnl --enable-sim-endian={yes,no,big,little} is for simulators
dnl --enable-sim-endian={yes,no,big,little} is for simulators
dnl that support both big and little endian targets.
dnl that support both big and little endian targets.
dnl arg[1] is hardwired target endianness.
dnl arg[1] is hardwired target endianness.
dnl arg[2] is default target endianness.
dnl arg[2] is default target endianness.
AC_DEFUN([SIM_AC_OPTION_ENDIAN],
AC_DEFUN([SIM_AC_OPTION_ENDIAN],
[
[
wire_endian="[$1]"
wire_endian="[$1]"
default_endian="[$2]"
default_endian="[$2]"
AC_ARG_ENABLE(sim-endian,
AC_ARG_ENABLE(sim-endian,
[  --enable-sim-endian=endian           Specify target byte endian orientation.],
[  --enable-sim-endian=endian           Specify target byte endian orientation.],
[case "${enableval}" in
[case "${enableval}" in
  b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
  b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BIG_ENDIAN";;
  l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
  l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=LITTLE_ENDIAN";;
  yes)   if test x"$wire_endian" != x; then
  yes)   if test x"$wire_endian" != x; then
           sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
           sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
         else
         else
           if test x"$default_endian" != x; then
           if test x"$default_endian" != x; then
             sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
             sim_endian="-DWITH_TARGET_BYTE_ORDER=${default_endian}"
           else
           else
             echo "No hard-wired endian for target $target" 1>&6
             echo "No hard-wired endian for target $target" 1>&6
             sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
             sim_endian="-DWITH_TARGET_BYTE_ORDER=0"
           fi
           fi
         fi;;
         fi;;
  no)    if test x"$default_endian" != x; then
  no)    if test x"$default_endian" != x; then
           sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
           sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
         else
         else
           if test x"$wire_endian" != x; then
           if test x"$wire_endian" != x; then
             sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
             sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${wire_endian}"
           else
           else
             echo "No default endian for target $target" 1>&6
             echo "No default endian for target $target" 1>&6
             sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
             sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=0"
           fi
           fi
         fi;;
         fi;;
  *)     AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
  *)     AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
  echo "Setting endian flags = $sim_endian" 6>&1
  echo "Setting endian flags = $sim_endian" 6>&1
fi],
fi],
[if test x"$default_endian" != x; then
[if test x"$default_endian" != x; then
  sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
  sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=${default_endian}"
else
else
  if test x"$wire_endian" != x; then
  if test x"$wire_endian" != x; then
    sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
    sim_endian="-DWITH_TARGET_BYTE_ORDER=${wire_endian}"
  else
  else
    sim_endian=
    sim_endian=
  fi
  fi
fi])dnl
fi])dnl
])
])
AC_SUBST(sim_endian)
AC_SUBST(sim_endian)
 
 
 
 
dnl --enable-sim-hostendian is for users of the simulator when
dnl --enable-sim-hostendian is for users of the simulator when
dnl they find that AC_C_BIGENDIAN does not function correctly
dnl they find that AC_C_BIGENDIAN does not function correctly
dnl (for instance in a canadian cross)
dnl (for instance in a canadian cross)
AC_DEFUN([SIM_AC_OPTION_HOSTENDIAN],
AC_DEFUN([SIM_AC_OPTION_HOSTENDIAN],
[
[
AC_ARG_ENABLE(sim-hostendian,
AC_ARG_ENABLE(sim-hostendian,
[  --enable-sim-hostendian=end          Specify host byte endian orientation.],
[  --enable-sim-hostendian=end          Specify host byte endian orientation.],
[case "${enableval}" in
[case "${enableval}" in
  no)    sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
  no)    sim_hostendian="-DWITH_HOST_BYTE_ORDER=0";;
  b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
  b*|B*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN";;
  l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
  l*|L*) sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN";;
  *)     AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
  *)     AC_MSG_ERROR("Unknown value $enableval for --enable-sim-hostendian"); sim_hostendian="";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
if test x"$silent" != x"yes" && test x"$sim_hostendian" != x""; then
  echo "Setting hostendian flags = $sim_hostendian" 6>&1
  echo "Setting hostendian flags = $sim_hostendian" 6>&1
fi],[
fi],[
if test "x$cross_compiling" = "xno"; then
if test "x$cross_compiling" = "xno"; then
  AC_C_BIGENDIAN
  AC_C_BIGENDIAN
  if test $ac_cv_c_bigendian = yes; then
  if test $ac_cv_c_bigendian = yes; then
    sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
    sim_hostendian="-DWITH_HOST_BYTE_ORDER=BIG_ENDIAN"
  else
  else
    sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
    sim_hostendian="-DWITH_HOST_BYTE_ORDER=LITTLE_ENDIAN"
  fi
  fi
else
else
  sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
  sim_hostendian="-DWITH_HOST_BYTE_ORDER=0"
fi])dnl
fi])dnl
])
])
AC_SUBST(sim_hostendian)
AC_SUBST(sim_hostendian)
 
 
 
 
dnl --enable-sim-float is for developers of the simulator
dnl --enable-sim-float is for developers of the simulator
dnl It specifies the presence of hardware floating point
dnl It specifies the presence of hardware floating point
dnl And optionally the bitsize of the floating point register.
dnl And optionally the bitsize of the floating point register.
dnl arg[1] specifies the presence (or absence) of floating point hardware
dnl arg[1] specifies the presence (or absence) of floating point hardware
dnl arg[2] specifies the number of bits in a floating point register
dnl arg[2] specifies the number of bits in a floating point register
AC_DEFUN([SIM_AC_OPTION_FLOAT],
AC_DEFUN([SIM_AC_OPTION_FLOAT],
[
[
default_sim_float="[$1]"
default_sim_float="[$1]"
default_sim_float_bitsize="[$2]"
default_sim_float_bitsize="[$2]"
AC_ARG_ENABLE(sim-float,
AC_ARG_ENABLE(sim-float,
[  --enable-sim-float                   Specify that the target processor has floating point hardware.],
[  --enable-sim-float                   Specify that the target processor has floating point hardware.],
[case "${enableval}" in
[case "${enableval}" in
  yes | hard)   sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
  yes | hard)   sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT";;
  no | soft)    sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
  no | soft)    sim_float="-DWITH_FLOATING_POINT=SOFT_FLOATING_POINT";;
  32)           sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=32";;
  32)           sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=32";;
  64)           sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=64";;
  64)           sim_float="-DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=64";;
  *)            AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
  *)            AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-float"); sim_float="";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
  echo "Setting float flags = $sim_float" 6>&1
  echo "Setting float flags = $sim_float" 6>&1
fi],[
fi],[
sim_float=
sim_float=
if test x"${default_sim_float}" != x""; then
if test x"${default_sim_float}" != x""; then
  sim_float="-DWITH_FLOATING_POINT=${default_sim_float}"
  sim_float="-DWITH_FLOATING_POINT=${default_sim_float}"
fi
fi
if test x"${default_sim_float_bitsize}" != x""; then
if test x"${default_sim_float_bitsize}" != x""; then
  sim_float="$sim_float -DWITH_TARGET_FLOATING_POINT_BITSIZE=${default_sim_float_bitsize}"
  sim_float="$sim_float -DWITH_TARGET_FLOATING_POINT_BITSIZE=${default_sim_float_bitsize}"
fi
fi
])dnl
])dnl
])
])
AC_SUBST(sim_float)
AC_SUBST(sim_float)
 
 
 
 
dnl The argument is the default cache size if none is specified.
dnl The argument is the default cache size if none is specified.
AC_DEFUN([SIM_AC_OPTION_SCACHE],
AC_DEFUN([SIM_AC_OPTION_SCACHE],
[
[
default_sim_scache="ifelse([$1],,0,[$1])"
default_sim_scache="ifelse([$1],,0,[$1])"
AC_ARG_ENABLE(sim-scache,
AC_ARG_ENABLE(sim-scache,
[  --enable-sim-scache=size             Specify simulator execution cache size.],
[  --enable-sim-scache=size             Specify simulator execution cache size.],
[case "${enableval}" in
[case "${enableval}" in
  yes)  sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
  yes)  sim_scache="-DWITH_SCACHE=${default_sim_scache}";;
  no)   sim_scache="-DWITH_SCACHE=0" ;;
  no)   sim_scache="-DWITH_SCACHE=0" ;;
  [[0-9]]*) sim_scache="-DWITH_SCACHE=${enableval}";;
  [[0-9]]*) sim_scache="-DWITH_SCACHE=${enableval}";;
  *)    AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
  *)    AC_MSG_ERROR("Bad value $enableval passed to --enable-sim-scache");
        sim_scache="";;
        sim_scache="";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
if test x"$silent" != x"yes" && test x"$sim_scache" != x""; then
  echo "Setting scache size = $sim_scache" 6>&1
  echo "Setting scache size = $sim_scache" 6>&1
fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
fi],[sim_scache="-DWITH_SCACHE=${default_sim_scache}"])
])
])
AC_SUBST(sim_scache)
AC_SUBST(sim_scache)
 
 
 
 
dnl The argument is the default model if none is specified.
dnl The argument is the default model if none is specified.
AC_DEFUN([SIM_AC_OPTION_DEFAULT_MODEL],
AC_DEFUN([SIM_AC_OPTION_DEFAULT_MODEL],
[
[
default_sim_default_model="ifelse([$1],,0,[$1])"
default_sim_default_model="ifelse([$1],,0,[$1])"
AC_ARG_ENABLE(sim-default-model,
AC_ARG_ENABLE(sim-default-model,
[  --enable-sim-default-model=model     Specify default model to simulate.],
[  --enable-sim-default-model=model     Specify default model to simulate.],
[case "${enableval}" in
[case "${enableval}" in
  yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");;
  yes|no) AC_MSG_ERROR("Missing argument to --enable-sim-default-model");;
  *)    sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";;
  *)    sim_default_model="-DWITH_DEFAULT_MODEL='\"${enableval}\"'";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
if test x"$silent" != x"yes" && test x"$sim_default_model" != x""; then
  echo "Setting default model = $sim_default_model" 6>&1
  echo "Setting default model = $sim_default_model" 6>&1
fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"])
])
])
AC_SUBST(sim_default_model)
AC_SUBST(sim_default_model)
 
 
 
 
dnl --enable-sim-hardware is for users of the simulator
dnl --enable-sim-hardware is for users of the simulator
dnl arg[1] Enable sim-hw by default? ("yes" or "no")
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[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.
dnl arg[3] is a space separated list of extra target specific devices.
AC_DEFUN([SIM_AC_OPTION_HARDWARE],
AC_DEFUN([SIM_AC_OPTION_HARDWARE],
[
[
if test x"[$1]" = x"yes"; then
if test x"[$1]" = x"yes"; then
  sim_hw_p=yes
  sim_hw_p=yes
else
else
  sim_hw_p=no
  sim_hw_p=no
fi
fi
if test "[$2]"; then
if test "[$2]"; then
  hardware="core pal glue"
  hardware="core pal glue"
else
else
  hardware="core pal glue [$3]"
  hardware="core pal glue [$3]"
fi
fi
sim_hw_cflags="-DWITH_HW=1"
sim_hw_cflags="-DWITH_HW=1"
sim_hw="$hardware"
sim_hw="$hardware"
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
AC_ARG_ENABLE(sim-hardware,
AC_ARG_ENABLE(sim-hardware,
[  --enable-sim-hardware=LIST           Specify the hardware to be included in the build.],
[  --enable-sim-hardware=LIST           Specify the hardware to be included in the build.],
[
[
case "${enableval}" in
case "${enableval}" in
  yes)  sim_hw_p=yes;;
  yes)  sim_hw_p=yes;;
  no)   sim_hw_p=no;;
  no)   sim_hw_p=no;;
  ,*)   sim_hw_p=yes; hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
  ,*)   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/,/ /'` ${hardware}";;
  *)    sim_hw_p=yes; hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
  *)    sim_hw_p=yes; hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
esac
esac
if test "$sim_hw_p" != yes; then
if test "$sim_hw_p" != yes; then
  sim_hw_objs=
  sim_hw_objs=
  sim_hw_cflags="-DWITH_HW=0"
  sim_hw_cflags="-DWITH_HW=0"
  sim_hw=
  sim_hw=
else
else
  sim_hw_cflags="-DWITH_HW=1"
  sim_hw_cflags="-DWITH_HW=1"
  # remove duplicates
  # remove duplicates
  sim_hw=""
  sim_hw=""
  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
  sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
  for i in $hardware ; do
  for i in $hardware ; do
    case " $sim_hw " in
    case " $sim_hw " in
      *" $i "*) ;;
      *" $i "*) ;;
      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
      *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
    esac
    esac
  done
  done
fi
fi
if test x"$silent" != x"yes" && test "$sim_hw_p" = "yes"; then
if test x"$silent" != x"yes" && test "$sim_hw_p" = "yes"; then
  echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
  echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
fi],[
fi],[
if test "$sim_hw_p" != yes; then
if test "$sim_hw_p" != yes; then
  sim_hw_objs=
  sim_hw_objs=
  sim_hw_cflags="-DWITH_HW=0"
  sim_hw_cflags="-DWITH_HW=0"
  sim_hw=
  sim_hw=
fi
fi
if test x"$silent" != x"yes"; then
if test x"$silent" != x"yes"; then
  echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
  echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
fi])dnl
fi])dnl
])
])
AC_SUBST(sim_hw_cflags)
AC_SUBST(sim_hw_cflags)
AC_SUBST(sim_hw_objs)
AC_SUBST(sim_hw_objs)
AC_SUBST(sim_hw)
AC_SUBST(sim_hw)
 
 
 
 
dnl --enable-sim-inline is for users that wish to ramp up the simulator's
dnl --enable-sim-inline is for users that wish to ramp up the simulator's
dnl performance by inlining functions.
dnl performance by inlining functions.
dnl Guarantee that unconfigured simulators do not do any inlining
dnl Guarantee that unconfigured simulators do not do any inlining
sim_inline="-DDEFAULT_INLINE=0"
sim_inline="-DDEFAULT_INLINE=0"
AC_DEFUN([SIM_AC_OPTION_INLINE],
AC_DEFUN([SIM_AC_OPTION_INLINE],
[
[
default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
default_sim_inline="ifelse([$1],,,-DDEFAULT_INLINE=[$1])"
AC_ARG_ENABLE(sim-inline,
AC_ARG_ENABLE(sim-inline,
[  --enable-sim-inline=inlines          Specify which functions should be inlined.],
[  --enable-sim-inline=inlines          Specify which functions should be inlined.],
[sim_inline=""
[sim_inline=""
case "$enableval" in
case "$enableval" in
  no)           sim_inline="-DDEFAULT_INLINE=0";;
  no)           sim_inline="-DDEFAULT_INLINE=0";;
  0)            sim_inline="-DDEFAULT_INLINE=0";;
  0)            sim_inline="-DDEFAULT_INLINE=0";;
  yes | 2)      sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";;
  yes | 2)      sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";;
  1)            sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
  1)            sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
  *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
  *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
       new_flag=""
       new_flag=""
       case "$x" in
       case "$x" in
         *_INLINE=*)    new_flag="-D$x";;
         *_INLINE=*)    new_flag="-D$x";;
         *=*)           new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
         *=*)           new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
         *_INLINE)      new_flag="-D$x=ALL_C_INLINE";;
         *_INLINE)      new_flag="-D$x=ALL_C_INLINE";;
         *)             new_flag="-D$x""_INLINE=ALL_C_INLINE";;
         *)             new_flag="-D$x""_INLINE=ALL_C_INLINE";;
       esac
       esac
       if test x"$sim_inline" = x""; then
       if test x"$sim_inline" = x""; then
         sim_inline="$new_flag"
         sim_inline="$new_flag"
       else
       else
         sim_inline="$sim_inline $new_flag"
         sim_inline="$sim_inline $new_flag"
       fi
       fi
     done;;
     done;;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
  echo "Setting inline flags = $sim_inline" 6>&1
  echo "Setting inline flags = $sim_inline" 6>&1
fi],[
fi],[
if test "x$cross_compiling" = "xno"; then
if test "x$cross_compiling" = "xno"; then
  if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
  if test x"$GCC" != "x" -a x"${default_sim_inline}" != "x" ; then
    sim_inline="${default_sim_inline}"
    sim_inline="${default_sim_inline}"
    if test x"$silent" != x"yes"; then
    if test x"$silent" != x"yes"; then
      echo "Setting inline flags = $sim_inline" 6>&1
      echo "Setting inline flags = $sim_inline" 6>&1
    fi
    fi
  else
  else
    sim_inline=""
    sim_inline=""
  fi
  fi
else
else
  sim_inline="-DDEFAULT_INLINE=0"
  sim_inline="-DDEFAULT_INLINE=0"
fi])dnl
fi])dnl
])
])
AC_SUBST(sim_inline)
AC_SUBST(sim_inline)
 
 
 
 
AC_DEFUN([SIM_AC_OPTION_PACKAGES],
AC_DEFUN([SIM_AC_OPTION_PACKAGES],
[
[
AC_ARG_ENABLE(sim-packages,
AC_ARG_ENABLE(sim-packages,
[  --enable-sim-packages=list           Specify the packages to be included in the build.],
[  --enable-sim-packages=list           Specify the packages to be included in the build.],
[packages=disklabel
[packages=disklabel
case "${enableval}" in
case "${enableval}" in
  yes)  ;;
  yes)  ;;
  no)   AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
  no)   AC_MSG_ERROR("List of packages must be specified for --enable-sim-packages"); packages="";;
  ,*)   packages="${packages}${enableval}";;
  ,*)   packages="${packages}${enableval}";;
  *,)   packages="${enableval}${packages}";;
  *,)   packages="${enableval}${packages}";;
  *)    packages="${enableval}"'';;
  *)    packages="${enableval}"'';;
esac
esac
sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
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'`
sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
if test x"$silent" != x"yes" && test x"$packages" != x""; then
if test x"$silent" != x"yes" && test x"$packages" != x""; then
  echo "Setting packages to $sim_pk_src, $sim_pk_obj"
  echo "Setting packages to $sim_pk_src, $sim_pk_obj"
fi],[packages=disklabel
fi],[packages=disklabel
sim_pk_src=`echo $packages | sed -e 's/,/.c pk_/g' -e 's/^/pk_/' -e 's/$/.c/'`
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'`
sim_pk_obj=`echo $sim_pk_src | sed -e 's/\.c/.o/g'`
if test x"$silent" != x"yes"; then
if test x"$silent" != x"yes"; then
  echo "Setting packages to $sim_pk_src, $sim_pk_obj"
  echo "Setting packages to $sim_pk_src, $sim_pk_obj"
fi])dnl
fi])dnl
])
])
AC_SUBST(sim_packages)
AC_SUBST(sim_packages)
 
 
 
 
AC_DEFUN([SIM_AC_OPTION_REGPARM],
AC_DEFUN([SIM_AC_OPTION_REGPARM],
[
[
AC_ARG_ENABLE(sim-regparm,
AC_ARG_ENABLE(sim-regparm,
[  --enable-sim-regparm=nr-parm         Pass parameters in registers instead of on the stack - x86/GCC specific.],
[  --enable-sim-regparm=nr-parm         Pass parameters in registers instead of on the stack - x86/GCC specific.],
[case "${enableval}" in
[case "${enableval}" in
  0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
  0*|1*|2*|3*|4*|5*|6*|7*|8*|9*) sim_regparm="-DWITH_REGPARM=${enableval}";;
  no)                            sim_regparm="" ;;
  no)                            sim_regparm="" ;;
  yes)                           sim_regparm="-DWITH_REGPARM=3";;
  yes)                           sim_regparm="-DWITH_REGPARM=3";;
  *)   AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
  *)   AC_MSG_ERROR("Unknown value $enableval for --enable-sim-regparm"); sim_regparm="";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
if test x"$silent" != x"yes" && test x"$sim_regparm" != x""; then
  echo "Setting regparm flags = $sim_regparm" 6>&1
  echo "Setting regparm flags = $sim_regparm" 6>&1
fi],[sim_regparm=""])dnl
fi],[sim_regparm=""])dnl
])
])
AC_SUBST(sim_regparm)
AC_SUBST(sim_regparm)
 
 
 
 
AC_DEFUN([SIM_AC_OPTION_RESERVED_BITS],
AC_DEFUN([SIM_AC_OPTION_RESERVED_BITS],
[
[
default_sim_reserved_bits="ifelse([$1],,1,[$1])"
default_sim_reserved_bits="ifelse([$1],,1,[$1])"
AC_ARG_ENABLE(sim-reserved-bits,
AC_ARG_ENABLE(sim-reserved-bits,
[  --enable-sim-reserved-bits           Specify whether to check reserved bits in instruction.],
[  --enable-sim-reserved-bits           Specify whether to check reserved bits in instruction.],
[case "${enableval}" in
[case "${enableval}" in
  yes)  sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
  yes)  sim_reserved_bits="-DWITH_RESERVED_BITS=1";;
  no)   sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
  no)   sim_reserved_bits="-DWITH_RESERVED_BITS=0";;
  *)    AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";;
  *)    AC_MSG_ERROR("--enable-sim-reserved-bits does not take a value"); sim_reserved_bits="";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
if test x"$silent" != x"yes" && test x"$sim_reserved_bits" != x""; then
  echo "Setting reserved flags = $sim_reserved_bits" 6>&1
  echo "Setting reserved flags = $sim_reserved_bits" 6>&1
fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
fi],[sim_reserved_bits="-DWITH_RESERVED_BITS=${default_sim_reserved_bits}"])dnl
])
])
AC_SUBST(sim_reserved_bits)
AC_SUBST(sim_reserved_bits)
 
 
 
 
AC_DEFUN([SIM_AC_OPTION_SMP],
AC_DEFUN([SIM_AC_OPTION_SMP],
[
[
default_sim_smp="ifelse([$1],,5,[$1])"
default_sim_smp="ifelse([$1],,5,[$1])"
AC_ARG_ENABLE(sim-smp,
AC_ARG_ENABLE(sim-smp,
[  --enable-sim-smp=n                   Specify number of processors to configure for (default ${default_sim_smp}).],
[  --enable-sim-smp=n                   Specify number of processors to configure for (default ${default_sim_smp}).],
[case "${enableval}" in
[case "${enableval}" in
  yes)  sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
  yes)  sim_smp="-DWITH_SMP=5" ; sim_igen_smp="-N 5";;
  no)   sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
  no)   sim_smp="-DWITH_SMP=0" ; sim_igen_smp="-N 0";;
  *)    sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
  *)    sim_smp="-DWITH_SMP=$enableval" ; sim_igen_smp="-N $enableval";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
if test x"$silent" != x"yes" && test x"$sim_smp" != x""; then
  echo "Setting smp flags = $sim_smp" 6>&1
  echo "Setting smp flags = $sim_smp" 6>&1
fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
fi],[sim_smp="-DWITH_SMP=${default_sim_smp}" ; sim_igen_smp="-N ${default_sim_smp}"
if test x"$silent" != x"yes"; then
if test x"$silent" != x"yes"; then
  echo "Setting smp flags = $sim_smp" 6>&1
  echo "Setting smp flags = $sim_smp" 6>&1
fi])dnl
fi])dnl
])
])
AC_SUBST(sim_smp)
AC_SUBST(sim_smp)
 
 
 
 
AC_DEFUN([SIM_AC_OPTION_STDCALL],
AC_DEFUN([SIM_AC_OPTION_STDCALL],
[
[
AC_ARG_ENABLE(sim-stdcall,
AC_ARG_ENABLE(sim-stdcall,
[  --enable-sim-stdcall=type            Use an alternative function call/return mechanism - x86/GCC specific.],
[  --enable-sim-stdcall=type            Use an alternative function call/return mechanism - x86/GCC specific.],
[case "${enableval}" in
[case "${enableval}" in
  no)           sim_stdcall="" ;;
  no)           sim_stdcall="" ;;
  std*)         sim_stdcall="-DWITH_STDCALL=1";;
  std*)         sim_stdcall="-DWITH_STDCALL=1";;
  yes)          sim_stdcall="-DWITH_STDCALL=1";;
  yes)          sim_stdcall="-DWITH_STDCALL=1";;
  *)   AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
  *)   AC_MSG_ERROR("Unknown value $enableval for --enable-sim-stdcall"); sim_stdcall="";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
if test x"$silent" != x"yes" && test x"$sim_stdcall" != x""; then
  echo "Setting function call flags = $sim_stdcall" 6>&1
  echo "Setting function call flags = $sim_stdcall" 6>&1
fi],[sim_stdcall=""])dnl
fi],[sim_stdcall=""])dnl
])
])
AC_SUBST(sim_stdcall)
AC_SUBST(sim_stdcall)
 
 
 
 
AC_DEFUN([SIM_AC_OPTION_XOR_ENDIAN],
AC_DEFUN([SIM_AC_OPTION_XOR_ENDIAN],
[
[
default_sim_xor_endian="ifelse([$1],,8,[$1])"
default_sim_xor_endian="ifelse([$1],,8,[$1])"
AC_ARG_ENABLE(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}).],
[  --enable-sim-xor-endian=n            Specify number bytes involved in XOR bi-endian mode (default ${default_sim_xor_endian}).],
[case "${enableval}" in
[case "${enableval}" in
  yes)  sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
  yes)  sim_xor_endian="-DWITH_XOR_ENDIAN=8";;
  no)   sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
  no)   sim_xor_endian="-DWITH_XOR_ENDIAN=0";;
  *)    sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
  *)    sim_xor_endian="-DWITH_XOR_ENDIAN=$enableval";;
esac
esac
if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
if test x"$silent" != x"yes" && test x"$sim_xor_endian" != x""; then
  echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
  echo "Setting xor-endian flag = $sim_xor_endian" 6>&1
fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
fi],[sim_xor_endian="-DWITH_XOR_ENDIAN=${default_sim_xor_endian}"])dnl
])
])
AC_SUBST(sim_xor_endian)
AC_SUBST(sim_xor_endian)
 
 
 
 
dnl --enable-build-warnings is for developers of the simulator.
dnl --enable-build-warnings is for developers of the simulator.
dnl it enables extra GCC specific warnings.
dnl it enables extra GCC specific warnings.
AC_DEFUN([SIM_AC_OPTION_WARNINGS],
AC_DEFUN([SIM_AC_OPTION_WARNINGS],
[
[
# NOTE: Don't add -Wall or -Wunused, they both include
# NOTE: Don't add -Wall or -Wunused, they both include
# -Wunused-parameter which reports bogus warnings.
# -Wunused-parameter which reports bogus warnings.
# NOTE: If you add to this list, remember to update
# NOTE: If you add to this list, remember to update
# gdb/doc/gdbint.texinfo.
# gdb/doc/gdbint.texinfo.
build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
-Wformat -Wparentheses -Wpointer-arith"
-Wformat -Wparentheses -Wpointer-arith"
# GCC supports -Wuninitialized only with -O or -On, n != 0.
# GCC supports -Wuninitialized only with -O or -On, n != 0.
if test x${CFLAGS+set} = xset; then
if test x${CFLAGS+set} = xset; then
  case "${CFLAGS}" in
  case "${CFLAGS}" in
    *"-O0"* ) ;;
    *"-O0"* ) ;;
    *"-O"* )
    *"-O"* )
      build_warnings="${build_warnings} -Wuninitialized"
      build_warnings="${build_warnings} -Wuninitialized"
    ;;
    ;;
  esac
  esac
else
else
  build_warnings="${build_warnings} -Wuninitialized"
  build_warnings="${build_warnings} -Wuninitialized"
fi
fi
# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
# -Wunused-function -Wunused-label -Wunused-variable -Wunused-value
# -Wunused-function -Wunused-label -Wunused-variable -Wunused-value
# -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
# -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
# -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
# -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
# -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
# -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
# -Woverloaded-virtual -Winline -Werror"
# -Woverloaded-virtual -Winline -Werror"
AC_ARG_ENABLE(build-warnings,
AC_ARG_ENABLE(build-warnings,
[  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
[  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
[case "${enableval}" in
[case "${enableval}" in
  yes)  ;;
  yes)  ;;
  no)   build_warnings="-w";;
  no)   build_warnings="-w";;
  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
        build_warnings="${build_warnings} ${t}";;
        build_warnings="${build_warnings} ${t}";;
  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
        build_warnings="${t} ${build_warnings}";;
        build_warnings="${t} ${build_warnings}";;
  *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
  *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
esac
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
  echo "Setting compiler warning flags = $build_warnings" 6>&1
  echo "Setting compiler warning flags = $build_warnings" 6>&1
fi])dnl
fi])dnl
AC_ARG_ENABLE(sim-build-warnings,
AC_ARG_ENABLE(sim-build-warnings,
[  --enable-gdb-build-warnings Enable SIM specific build-time compiler warnings if gcc is used],
[  --enable-gdb-build-warnings Enable SIM specific build-time compiler warnings if gcc is used],
[case "${enableval}" in
[case "${enableval}" in
  yes)  ;;
  yes)  ;;
  no)   build_warnings="-w";;
  no)   build_warnings="-w";;
  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
  ,*)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
        build_warnings="${build_warnings} ${t}";;
        build_warnings="${build_warnings} ${t}";;
  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
  *,)   t=`echo "${enableval}" | sed -e "s/,/ /g"`
        build_warnings="${t} ${build_warnings}";;
        build_warnings="${t} ${build_warnings}";;
  *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
  *)    build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
esac
esac
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
  echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
  echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
fi])dnl
fi])dnl
WARN_CFLAGS=""
WARN_CFLAGS=""
WERROR_CFLAGS=""
WERROR_CFLAGS=""
if test "x${build_warnings}" != x -a "x$GCC" = xyes
if test "x${build_warnings}" != x -a "x$GCC" = xyes
then
then
    AC_MSG_CHECKING(compiler warning flags)
    AC_MSG_CHECKING(compiler warning flags)
    # Separate out the -Werror flag as some files just cannot be
    # Separate out the -Werror flag as some files just cannot be
    # compiled with it enabled.
    # compiled with it enabled.
    for w in ${build_warnings}; do
    for w in ${build_warnings}; do
        case $w in
        case $w in
        -Werr*) WERROR_CFLAGS=-Werror ;;
        -Werr*) WERROR_CFLAGS=-Werror ;;
        *) # Check that GCC accepts it
        *) # Check that GCC accepts it
            saved_CFLAGS="$CFLAGS"
            saved_CFLAGS="$CFLAGS"
            CFLAGS="$CFLAGS $w"
            CFLAGS="$CFLAGS $w"
            AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
            AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
            CFLAGS="$saved_CFLAGS"
            CFLAGS="$saved_CFLAGS"
        esac
        esac
    done
    done
    AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS})
    AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS})
fi
fi
])
])
AC_SUBST(WARN_CFLAGS)
AC_SUBST(WARN_CFLAGS)
AC_SUBST(WERROR_CFLAGS)
AC_SUBST(WERROR_CFLAGS)
 
 
 
 
dnl Generate the Makefile in a target specific directory.
dnl Generate the Makefile in a target specific directory.
dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
dnl Substitutions aren't performed on the file in AC_SUBST_FILE,
dnl so this is a cover macro to tuck the details away of how we cope.
dnl so this is a cover macro to tuck the details away of how we cope.
dnl We cope by having autoconf generate two files and then merge them into
dnl We cope by having autoconf generate two files and then merge them into
dnl one afterwards.  The two pieces of the common fragment are inserted into
dnl one afterwards.  The two pieces of the common fragment are inserted into
dnl the target's fragment at the appropriate points.
dnl the target's fragment at the appropriate points.
 
 
AC_DEFUN([SIM_AC_OUTPUT],
AC_DEFUN([SIM_AC_OUTPUT],
[
[
AC_LINK_FILES($sim_link_files, $sim_link_links)
AC_LINK_FILES($sim_link_files, $sim_link_links)
dnl Make @cgen_breaks@ non-null only if the sim uses CGEN.
dnl Make @cgen_breaks@ non-null only if the sim uses CGEN.
cgen_breaks=""
cgen_breaks=""
if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
if grep CGEN_MAINT $srcdir/Makefile.in >/dev/null; then
cgen_breaks="break cgen_rtx_error";
cgen_breaks="break cgen_rtx_error";
fi
fi
AC_SUBST(cgen_breaks)
AC_SUBST(cgen_breaks)
AC_CONFIG_FILES(Makefile.sim:Makefile.in)
AC_CONFIG_FILES(Makefile.sim:Makefile.in)
AC_CONFIG_FILES(Make-common.sim:../common/Make-common.in)
AC_CONFIG_FILES(Make-common.sim:../common/Make-common.in)
AC_CONFIG_FILES(.gdbinit:../common/gdbinit.in)
AC_CONFIG_FILES(.gdbinit:../common/gdbinit.in)
AC_CONFIG_COMMANDS([Makefile],
AC_CONFIG_COMMANDS([Makefile],
[echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
[echo "Merging Makefile.sim+Make-common.sim into Makefile ..."
 rm -f Makesim1.tmp Makesim2.tmp Makefile
 rm -f Makesim1.tmp Makesim2.tmp Makefile
 sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
 sed -n -e '/^## COMMON_PRE_/,/^## End COMMON_PRE_/ p' <Make-common.sim >Makesim1.tmp
 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
 sed -n -e '/^## COMMON_POST_/,/^## End COMMON_POST_/ p' <Make-common.sim >Makesim2.tmp
 sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
 sed -e '/^## COMMON_PRE_/ r Makesim1.tmp' \
        -e '/^## COMMON_POST_/ r Makesim2.tmp' \
        -e '/^## COMMON_POST_/ r Makesim2.tmp' \
        <Makefile.sim >Makefile
        <Makefile.sim >Makefile
 rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
 rm -f Makefile.sim Make-common.sim Makesim1.tmp Makesim2.tmp
])
])
AC_CONFIG_COMMANDS([stamp-h], [echo > stamp-h])
AC_CONFIG_COMMANDS([stamp-h], [echo > stamp-h])
AC_OUTPUT
AC_OUTPUT
])
])
 
 
sinclude(../../config/gettext-sister.m4)
sinclude(../../config/gettext-sister.m4)
sinclude(../../config/acx.m4)
sinclude(../../config/acx.m4)
 
 
dnl --enable-cgen-maint support
dnl --enable-cgen-maint support
AC_DEFUN([SIM_AC_OPTION_CGEN_MAINT],
AC_DEFUN([SIM_AC_OPTION_CGEN_MAINT],
[
[
cgen_maint=no
cgen_maint=no
dnl Default is to use one in build tree.
dnl Default is to use one in build tree.
cgen=guile
cgen=guile
cgendir='$(srcdir)/../../cgen'
cgendir='$(srcdir)/../../cgen'
dnl Having --enable-maintainer-mode take arguments is another way to go.
dnl Having --enable-maintainer-mode take arguments is another way to go.
dnl ??? One can argue --with is more appropriate if one wants to specify
dnl ??? One can argue --with is more appropriate if one wants to specify
dnl a directory name, but what we're doing here is an enable/disable kind
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 of thing and specifying both --enable and --with is klunky.
dnl If you reeely want this to be --with, go ahead and change it.
dnl If you reeely want this to be --with, go ahead and change it.
AC_ARG_ENABLE(cgen-maint,
AC_ARG_ENABLE(cgen-maint,
[  --enable-cgen-maint[=DIR]    build cgen generated files],
[  --enable-cgen-maint[=DIR]    build cgen generated files],
[case "${enableval}" in
[case "${enableval}" in
  yes)  cgen_maint=yes ;;
  yes)  cgen_maint=yes ;;
  no)   cgen_maint=no ;;
  no)   cgen_maint=no ;;
  *)
  *)
        # argument is cgen install directory (not implemented yet).
        # argument is cgen install directory (not implemented yet).
        # Having a `share' directory might be more appropriate for the .scm,
        # Having a `share' directory might be more appropriate for the .scm,
        # .cpu, etc. files.
        # .cpu, etc. files.
        cgendir=${cgen_maint}/lib/cgen
        cgendir=${cgen_maint}/lib/cgen
        cgen=guile
        cgen=guile
        ;;
        ;;
esac])dnl
esac])dnl
dnl AM_CONDITIONAL(CGEN_MAINT, test x${cgen_maint} != xno)
dnl AM_CONDITIONAL(CGEN_MAINT, test x${cgen_maint} != xno)
if test x${cgen_maint} != xno ; then
if test x${cgen_maint} != xno ; then
  CGEN_MAINT=''
  CGEN_MAINT=''
else
else
  CGEN_MAINT='#'
  CGEN_MAINT='#'
fi
fi
AC_SUBST(CGEN_MAINT)
AC_SUBST(CGEN_MAINT)
AC_SUBST(cgendir)
AC_SUBST(cgendir)
AC_SUBST(cgen)
AC_SUBST(cgen)
])
])
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.