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 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],
22 default_alignment="[$2]"
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}"
34 if test x"$default_alignment" != x; then
35 sim_alignment="-DWITH_ALIGNMENT=${default_alignment}"
37 echo "No hard-wired alignment for target $target" 1>&6
38 sim_alignment="-DWITH_ALIGNMENT=0"
41 no) if test x"$default_alignment" != x; then
42 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
44 if test x"$wire_alignment" != x; then
45 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${wire_alignment}"
47 echo "No default alignment for target $target" 1>&6
48 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=0"
51 *) AC_MSG_ERROR("Unknown value $enableval passed to --enable-sim-alignment"); sim_alignment="";;
53 if test x"$silent" != x"yes" && test x"$sim_alignment" != x""; then
54 echo "Setting alignment flags = $sim_alignment" 6>&1
56 [if test x"$default_alignment" != x; then
57 sim_alignment="-DWITH_DEFAULT_ALIGNMENT=${default_alignment}"
59 if test x"$wire_alignment" != x; then
60 sim_alignment="-DWITH_ALIGNMENT=${wire_alignment}"
66 AC_SUBST(sim_alignment)