sim: require AC_PROG_CPP explicitly
[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 [
21 sim_inline="-DDEFAULT_INLINE=m4_ifblank([$1],[0],[$1])"
22 AC_ARG_ENABLE(sim-inline,
23 [AS_HELP_STRING([--enable-sim-inline=inlines],
24 [Specify which functions should be inlined])],
25 [sim_inline=""
26 case "$enableval" in
27 no) sim_inline="-DDEFAULT_INLINE=0";;
28 0) sim_inline="-DDEFAULT_INLINE=0";;
29 yes | 2) sim_inline="-DDEFAULT_INLINE=ALL_C_INLINE";;
30 1) sim_inline="-DDEFAULT_INLINE=INLINE_LOCALS";;
31 *) for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
32 new_flag=""
33 case "$x" in
34 *_INLINE=*) new_flag="-D$x";;
35 *=*) new_flag=`echo "$x" | sed -e "s/=/_INLINE=/" -e "s/^/-D/"`;;
36 *_INLINE) new_flag="-D$x=ALL_C_INLINE";;
37 *) new_flag="-D$x""_INLINE=ALL_C_INLINE";;
38 esac
39 if test x"$sim_inline" = x""; then
40 sim_inline="$new_flag"
41 else
42 sim_inline="$sim_inline $new_flag"
43 fi
44 done;;
45 esac
46 if test x"$silent" != x"yes" && test x"$sim_inline" != x""; then
47 echo "Setting inline flags = $sim_inline" 6>&1
48 fi])dnl
49 ])
50 AC_SUBST(sim_inline)