sim: unify bug & package settings
[binutils-gdb.git] / sim / m4 / sim_ac_option_alignment.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 Specify the alignment restrictions of the target architecture.
17 dnl Without this option all possible alignment restrictions are accommodated.
18 dnl arg[1] is hardwired target alignment
19 dnl arg[2] is default target alignment
20 AC_DEFUN([SIM_AC_OPTION_ALIGNMENT],
21 wire_alignment="[$1]"
22 default_alignment="[$2]"
23 [
24 AC_ARG_ENABLE(sim-alignment,
25 [AS_HELP_STRING([--enable-sim-alignment=align],
26 [Specify strict, nonstrict or forced alignment of memory accesses])],
27 [case "${enableval}" in
28 strict | STRICT) sim_alignment="-DWITH_ALIGNMENT=STRICT_ALIGNMENT";;
29 nonstrict | NONSTRICT) sim_alignment="-DWITH_ALIGNMENT=NONSTRICT_ALIGNMENT";;
30 forced | FORCED) sim_alignment="-DWITH_ALIGNMENT=FORCED_ALIGNMENT";;
31 yes) if test x"$wire_alignment" != x; then
32 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
33 else
34 if test x"$default_alignment" != x; then
35 sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
36 else
37 echo "No hard-wired alignment for target $target" 1>&6
38 sim_alignment="-DWITH_ALIGNMENT=0"
39 fi
40 fi;;
41 no) if test x"$default_alignment" != x; then
42 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
43 else
44 if test x"$wire_alignment" != x; then
45 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
46 else
47 echo "No default alignment for target $target" 1>&6
48 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
49 fi
50 fi;;
51 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
52 esac
53 if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
54 echo "Setting alignment flags = $sim_alignment" 6>&1
55 fi],
56 [if test x"$default_alignment" != x; then
57 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
58 else
59 if test x"$wire_alignment" != x; then
60 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
61 else
62 sim_alignment=
63 fi
64 fi])dnl
65 ])dnl
66 AC_SUBST(sim_alignment)