]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - sim/m4/sim_ac_option_hardware.m4
sim: common: split up acinclude.m4 into individual m4 files
[thirdparty/binutils-gdb.git] / sim / m4 / sim_ac_option_hardware.m4
1 dnl Copyright (C) 1997-2021 Free Software Foundation, Inc.
2 dnl
3 dnl This program is free software; you can redistribute it and/or modify
4 dnl it under the terms of the GNU General Public License as published by
5 dnl the Free Software Foundation; either version 3 of the License, or
6 dnl (at your option) any later version.
7 dnl
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 dnl GNU General Public License for more details.
12 dnl
13 dnl You should have received a copy of the GNU General Public License
14 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
15 dnl
16 dnl --enable-sim-hardware is for users of the simulator
17 dnl arg[1] Enable sim-hw by default? ("yes" or "no")
18 dnl arg[2] is a space separated list of devices that override the defaults
19 dnl arg[3] is a space separated list of extra target specific devices.
20 AC_DEFUN([SIM_AC_OPTION_HARDWARE],
21 [
22 if test "[$2]"; then
23 hardware="[$2]"
24 else
25 hardware="cfi core pal glue"
26 fi
27 hardware="$hardware [$3]"
28
29 sim_hw_cflags="-DWITH_HW=1"
30 sim_hw="$hardware"
31 sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
32
33 AC_ARG_ENABLE(sim-hardware,
34 [AS_HELP_STRING([--enable-sim-hardware=LIST],
35 [Specify the hardware to be included in the build.])],
36 ,[enable_sim_hardware="[$1]"])
37 case ${enable_sim_hardware} in
38 yes|no) ;;
39 ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
40 *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
41 *) hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
42 esac
43
44 if test "$enable_sim_hardware" = no; then
45 sim_hw_objs=
46 sim_hw_cflags="-DWITH_HW=0"
47 sim_hw=
48 else
49 sim_hw_cflags="-DWITH_HW=1"
50 # remove duplicates
51 sim_hw=""
52 sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
53 for i in $hardware ; do
54 case " $sim_hw " in
55 *" $i "*) ;;
56 *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
57 esac
58 done
59 # mingw does not support sockser
60 case ${host} in
61 *mingw*) ;;
62 *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
63 # that you instatiate. Instead, other code will call into it directly.
64 # At some point, we should convert it over.
65 sim_hw_objs="$sim_hw_objs dv-sockser.o"
66 AC_DEFINE_UNQUOTED(
67 [HAVE_DV_SOCKSER], 1, [Define if dv-sockser is usable.])
68 ;;
69 esac
70 if test x"$silent" != x"yes"; then
71 echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
72 fi
73 dnl Some devices require extra libraries.
74 case " $hardware " in
75 *" cfi "*) AC_CHECK_LIB(m, log2);;
76 esac
77 fi
78 ])
79 AC_SUBST(sim_hw_cflags)
80 AC_SUBST(sim_hw_objs)
81 AC_SUBST(sim_hw)