sim: unify various library testing logic
[deliverable/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] is a space separated list of extra target specific devices.
18 AC_DEFUN([SIM_AC_OPTION_HARDWARE],
19 [
20 hardware="cfi core pal glue [$1]"
21 sim_hw_cflags="-DWITH_HW=1"
22 sim_hw="$hardware"
23 sim_hw_objs="\$(SIM_COMMON_HW_OBJS) `echo $sim_hw | sed -e 's/\([[^ ]][[^ ]]*\)/dv-\1.o/g'`"
24
25 AC_ARG_ENABLE(sim-hardware,
26 [AS_HELP_STRING([--enable-sim-hardware=LIST],
27 [Specify the hardware to be included in the build.])],
28 ,[enable_sim_hardware="yes"])
29 case ${enable_sim_hardware} in
30 yes|no) ;;
31 ,*) hardware="${hardware} `echo ${enableval} | sed -e 's/,/ /'`";;
32 *,) hardware="`echo ${enableval} | sed -e 's/,/ /'` ${hardware}";;
33 *) hardware="`echo ${enableval} | sed -e 's/,/ /'`"'';;
34 esac
35
36 if test "$enable_sim_hardware" = no; then
37 sim_hw_objs=
38 sim_hw_cflags="-DWITH_HW=0"
39 sim_hw=
40 else
41 sim_hw_cflags="-DWITH_HW=1"
42 # remove duplicates
43 sim_hw=""
44 sim_hw_objs="\$(SIM_COMMON_HW_OBJS)"
45 for i in $hardware ; do
46 case " $sim_hw " in
47 *" $i "*) ;;
48 *) sim_hw="$sim_hw $i" ; sim_hw_objs="$sim_hw_objs dv-$i.o";;
49 esac
50 done
51 # mingw does not support sockser
52 case ${host} in
53 *mingw*) ;;
54 *) # TODO: We don't add dv-sockser to sim_hw as it is not a "real" device
55 # that you instatiate. Instead, other code will call into it directly.
56 # At some point, we should convert it over.
57 sim_hw_objs="$sim_hw_objs dv-sockser.o"
58 sim_hw_cflags="$sim_hw_cflags -DHAVE_DV_SOCKSER"
59 ;;
60 esac
61 if test x"$silent" != x"yes"; then
62 echo "Setting hardware to $sim_hw_cflags, $sim_hw, $sim_hw_objs"
63 fi
64 fi
65 ])
66 AC_SUBST(sim_hw_cflags)
67 AC_SUBST(sim_hw_objs)
68 AC_SUBST(sim_hw)
This page took 0.036366 seconds and 4 git commands to generate.