Do top level sim-hw module for device tree.
[deliverable/binutils-gdb.git] / sim / common / aclocal.m4
index e5678d9042420617e98015c55f0671a5e8ef9c3a..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
@@ -326,40 +329,65 @@ dnl --enable-sim-bitsize is for developers of the simulator
 dnl It specifies the number of BITS in the target.
 dnl arg[1] is the number of bits in a word
 dnl arg[2] is the number assigned to the most significant bit
-dnl In the future this macro may also take arguments for specifying
-dnl the number of bits in an address and an Open Firmware cell.
+dnl arg[3] is the number of bits in an address
+dnl arg[4] is the number of bits in an OpenFirmware cell.
 dnl FIXME: this information should be obtained from bfd/archure
 AC_DEFUN(SIM_AC_OPTION_BITSIZE,
-wire_bitsize="[$1]"
-wire_msb="[$2]"
+wire_word_bitsize="[$1]"
+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).],
-[case "${enableval}" in
-  64,63) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=63";;
-  32,31) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31";;
-  64,0) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
-  32,0) sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0";;
-  32) if test x"$wire_msb" != x -a x"$wire_msb" != x0; then
+[  --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";;
+  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";;
+  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
         sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31"
       else
         sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=0"
       fi ;;
-  64) if test x"$wire_msb" != x -a x"$wire_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"
       else
         sim_bitsize="-DWITH_TARGET_WORD_BITSIZE=64 -DWITH_TARGET_WORD_MSB=0"
       fi ;;
-  *)  AC_MSG_ERROR("--enable-sim-bitsize was given $enableval.  Expected 32 or 64"); sim_bitsize="";;
+  *)  AC_MSG_ERROR("--enable-sim-bitsize was given $enableval.  Expected 32 or 64") ;;
+esac
+# address bitsize
+tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9]]*,*//"`
+case x"${tmp}" in
+  x ) ;;
+  x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_ADDRESS_BITSIZE=32" ;;
+  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") ;;
+esac
+# cell bitsize
+tmp=`echo "${enableval}" | sed -e "s/^[[0-9]]*,*[[0-9*]]*,*[[0-9]]*,*//"`
+case x"${tmp}" in
+  x ) ;;
+  x32 | x32,* ) sim_bitsize="${sim_bitsize} -DWITH_TARGET_CELL_BITSIZE=32" ;;
+  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") ;;
 esac
 if test x"$silent" != x"yes" && test x"$sim_bitsize" != x""; then
   echo "Setting bitsize flags = $sim_bitsize" 6>&1
 fi],
 [sim_bitsize=""
-if test x"$wire_bitsize" != x; then
-  sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_bitsize"
+if test x"$wire_word_bitsize" != x; then
+  sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_BITSIZE=$wire_word_bitsize"
+fi
+if test x"$wire_word_msb" != x; then
+  sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_word_msb"
+fi
+if test x"$wire_address_bitsize" != x; then
+  sim_bitsize="$sim_bitsize -DWITH_TARGET_ADDRESS_BITSIZE=$wire_address_bitsize"
 fi
-if test x"$wire_msb" != x; then
-  sim_bitsize="$sim_bitsize -DWITH_TARGET_WORD_MSB=$wire_msb"
+if test x"$wire_cell_bitsize" != x; then
+  sim_bitsize="$sim_bitsize -DWITH_TARGET_CELL_BITSIZE=$wire_cell_bitsize"
 fi])dnl
 ])
 AC_SUBST(sim_bitsize)
@@ -447,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)
 
@@ -501,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.025157 seconds and 4 git commands to generate.