Do top level sim-hw module for device tree.
[deliverable/binutils-gdb.git] / sim / common / aclocal.m4
index 990dfa217ae69fc1e338db4f6963ad11e05cda49..481ae330ab0be58ff95c124a93670db0a8b4fdfb 100644 (file)
@@ -46,8 +46,10 @@ AC_PROG_RANLIB
 # Check for common headers.
 # 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 sys/time.h sys/resource.h)
-AC_CHECK_FUNCS(getrusage time sigaction)
+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(fcntl.h fpu_control.h)
+AC_CHECK_FUNCS(getrusage time sigaction __setfpucw)
 
 . ${srcdir}/../../bfd/configure.host
 
@@ -60,10 +62,11 @@ 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="" ;;
+  yes) MAINT="" USE_MAINTAINER_MODE=yes ;;
   no)  MAINT="#" ;;
   *)   AC_MSG_ERROR("--enable-maintainer-mode does not take a value"); MAINT="#" ;;
 esac
@@ -472,19 +475,35 @@ 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.
+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
 AC_DEFUN(SIM_AC_OPTION_FLOAT,
 [
-default_sim_floating_point="ifelse([$1],,0,[$1])"
+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.],
 [case "${enableval}" in
   yes | hard)  sim_float="-DWITH_FLOATING_POINT=HARD_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";;
+  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="";;
 esac
 if test x"$silent" != x"yes" && test x"$sim_float" != x""; then
   echo "Setting float flags = $sim_float" 6>&1
-fi],[sim_float="-DWITH_FLOATING_POINT=${default_sim_floating_point}"])dnl
+fi],[
+sim_float=
+if test x"${default_sim_float}" != x""; then
+  sim_float="-DWITH_FLOATING_POINT=${default_sim_float}"
+fi
+if test x"${default_sim_float_bitsize}" != x""; then
+  sim_float="$sim_float -DWITH_TARGET_FLOATING_POINT_BITSIZE=${default_sim_float_bitsize}"
+fi
+])dnl
 ])
 AC_SUBST(sim_float)
 
@@ -526,30 +545,46 @@ fi],[sim_default_model="-DWITH_DEFAULT_MODEL='\"${default_sim_default_model}\"'"
 AC_SUBST(sim_default_model)
 
 
+dnl --enable-sim-hardware is for users of the simulator
+dnl arg[1] is a space separated list of devices that override the defaults
+dnl arg[2] is a space separated list of extra target specific devices.
 AC_DEFUN(SIM_AC_OPTION_HARDWARE,
 [
+sim_hardware="-DWITH_HW=1"
+sim_hw_obj="hw-device.o hw-ports.o hw-properties.o hw-base.o hw-tree.o"
+hardware="ifelse([$1],,[core pal glue],[$1]) ifelse([$2],,,[$2])"
 AC_ARG_ENABLE(sim-hardware,
-[  --enable-sim-hardware=list          Specify the hardware to be included in the build.],
-[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
+[  --enable-sim-hardware=LIST          Specify the hardware to be included in the build.],
+[
 case "${enableval}" in
   yes) ;;
-  no)  AC_MSG_ERROR("List of hardware must be specified for --enable-sim-hardware"); hardware="";;
-  ,*)   hardware="${hardware}${enableval}";;
-  *,)   hardware="${enableval}${hardware}";;
-  *)   hardware="${enableval}"'';;
+  no)  hardware=""; sim_hardware="-DWITH_HW=0"; sim_hw_obj="";;
+  ,*)   hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
+  *,)   hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
+  *)   hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
 esac
-sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
-sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
+dnl remove duplicates
+sim_hw=""
+for i in x $hardware ; do
+  case " $f " in
+    x) ;;
+    *" $i "*) ;;
+    *) sim_hw="$sim_hw $i" ;;
+  esac
+done
+sim_hw_obj="$sim_hw_obj `echo $sim_hw | sed -e 's/\([[^ ]]*\)/dv-\1.o/g'`"
 if test x"$silent" != x"yes" && test x"$hardware" != x""; then
-  echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
-fi],[hardware="cpu,memory,nvram,iobus,htab,disk,trace,register,vm,init,core,pal,com,eeprom,opic,glue,phb,ide"
-sim_hw_src=`echo $hardware | sed -e 's/,/.c hw_/g' -e 's/^/hw_/' -e s'/$/.c/'`
-sim_hw_obj=`echo $sim_hw_src | sed -e 's/\.c/.o/g'`
+  echo "Setting hardware to $sim_hardware, $sim_hw, $sim_hw_obj"
+fi],[
+sim_hw="$hardware"
+sim_hw_obj="$sim_hw_obj `echo $sim_hw | sed -e 's/\([[^ ]]*\)/dv-\1.o/g'`"
 if test x"$silent" != x"yes"; then
-  echo "Setting hardware to $sim_hw_src, $sim_hw_obj"
+  echo "Setting hardware to $sim_hardware, $sim_hw, $sim_hw_obj"
 fi])dnl
 ])
 AC_SUBST(sim_hardware)
+AC_SUBST(sim_hw_obj)
+AC_SUBST(sim_hw)
 
 
 dnl --enable-sim-inline is for users that wish to ramp up the simulator's
This page took 0.024681 seconds and 4 git commands to generate.