sim: enable hardware support by default
[binutils-gdb.git] / sim / m4 / sim_ac_option_endian.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-endian={yes,no,big,little} is for simulators
17 dnl that support both big and little endian targets.
18 dnl arg[1] is hardwired target endianness.
19 dnl arg[2] is default target endianness.
20 AC_DEFUN([SIM_AC_OPTION_ENDIAN],
21 [
22 wire_endian="[$1]"
23 default_endian="[$2]"
24 AC_ARG_ENABLE(sim-endian,
25 [AS_HELP_STRING([--enable-sim-endian=endian],
26 [Specify target byte endian orientation])],
27 [case "${enableval}" in
28 b*|B*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_BIG";;
29 l*|L*) sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_LITTLE";;
30 yes) if test x"$wire_endian" != x; then
31 sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}"
32 else
33 if test x"$default_endian" != x; then
34 sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}"
35 else
36 echo "No hard-wired endian for target $target" 1>&6
37 sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_UNKNOWN"
38 fi
39 fi;;
40 no) if test x"$default_endian" != x; then
41 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}"
42 else
43 if test x"$wire_endian" != x; then
44 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}"
45 else
46 echo "No default endian for target $target" 1>&6
47 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_UNKNOWN"
48 fi
49 fi;;
50 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
51 esac
52 if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
53 echo "Setting endian flags = $sim_endian" 6>&1
54 fi],
55 [if test x"$default_endian" != x; then
56 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}"
57 else
58 if test x"$wire_endian" != x; then
59 sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}"
60 else
61 sim_endian=
62 fi
63 fi])dnl
64 ])
65 AC_SUBST(sim_endian)