1 dnl Copyright (C) 1997-2021 Free Software Foundation, Inc.
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.
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.
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/>.
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],
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}"
33 if test x"$default_endian" != x; then
34 sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}"
36 echo "No hard-wired endian for target $target" 1>&6
37 sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_UNKNOWN"
40 no) if test x"$default_endian" != x; then
41 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}"
43 if test x"$wire_endian" != x; then
44 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}"
46 echo "No default endian for target $target" 1>&6
47 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_UNKNOWN"
50 *) AC_MSG_ERROR("Unknown value $enableval for --enable-sim-endian"); sim_endian="";;
52 if test x"$silent" != x"yes" && test x"$sim_endian" != x""; then
53 echo "Setting endian flags = $sim_endian" 6>&1
55 [if test x"$default_endian" != x; then
56 sim_endian="-DWITH_DEFAULT_TARGET_BYTE_ORDER=BFD_ENDIAN_${default_endian}"
58 if test x"$wire_endian" != x; then
59 sim_endian="-DWITH_TARGET_BYTE_ORDER=BFD_ENDIAN_${wire_endian}"