xref: /netbsd-src/external/gpl3/gdb/dist/sim/m4/sim_ac_option_inline.m4 (revision d16b7486a53dcb8072b60ec6fcb4373a2d0c27b7)
1dnl Copyright (C) 1997-2023 Free Software Foundation, Inc.
2dnl
3dnl This program is free software; you can redistribute it and/or modify
4dnl it under the terms of the GNU General Public License as published by
5dnl the Free Software Foundation; either version 3 of the License, or
6dnl (at your option) any later version.
7dnl
8dnl This program is distributed in the hope that it will be useful,
9dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11dnl GNU General Public License for more details.
12dnl
13dnl You should have received a copy of the GNU General Public License
14dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
15dnl
16dnl --enable-sim-inline is for users that wish to ramp up the simulator's
17dnl performance by inlining functions.
18dnl Default sims to no inlining.
19AC_DEFUN([SIM_AC_OPTION_INLINE],
20[dnl
21AC_MSG_CHECKING([sim inline settings])
22sim_inline="-DDEFAULT_INLINE=m4_ifblank([$1],[0],[$1])"
23AC_ARG_ENABLE(sim-inline,
24[AS_HELP_STRING([--enable-sim-inline=inlines],
25		[Specify which functions should be inlined])],
26[sim_inline=""
27case "$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;;
46esac
47])dnl
48AC_MSG_RESULT([$sim_inline])
49SIM_INLINE=$sim_inline
50AC_SUBST(SIM_INLINE)
51])
52