sim: unify scache settings
[binutils-gdb.git] / sim / m4 / sim_ac_option_inline.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-inline is for users that wish to ramp up the simulator's
17 dnl performance by inlining functions.
18 dnl Default sims to no inlining.
19 AC_DEFUN([SIM_AC_OPTION_INLINE],
20 [dnl
21 AC_MSG_CHECKING([sim inline settings])
22 sim_inline="-DDEFAULT_INLINE=m4_ifblank([$1],[0],[$1])"
23 AC_ARG_ENABLE(sim-inline,
24 [AS_HELP_STRING([--enable-sim-inline=inlines],
25 [Specify which functions should be inlined])],
26 [sim_inline=""
27 case "$enableval" in
28 no) sim_inline="-DDEFAULT_INLINE=0";;
29 0) sim_inline="-DDEFAULT_INLINE=0";;
30 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";;
31 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
32 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
33 new_flag=""
34 case "$x" in
35 *_INLINE=*) new_flag="-D$x";;
36 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
37 *_INLINE) new_flag="-D$x=ALL_C_INLINE";;
38 *) new_flag="-D$x""_INLINE=ALL_C_INLINE";;
39 esac
40 if test x"$sim_inline" = x""; then
41 sim_inline="$new_flag"
42 else
43 sim_inline="$sim_inline $new_flag"
44 fi
45 done;;
46 esac
47 ])dnl
48 AC_MSG_RESULT([$sim_inline])
49 SIM_INLINE=$sim_inline
50 AC_SUBST(SIM_INLINE)
51 ])