sim_ac_option_trace.m4 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. dnl Copyright (C) 1997-2022 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-trace is for users of the simulator
  17. dnl The argument is either a bitmask of things to enable [exactly what is
  18. dnl up to the simulator], or is a comma separated list of names of tracing
  19. dnl elements to enable. The latter is only supported on simulators that
  20. dnl use WITH_TRACE. Default to all tracing but internal debug.
  21. AC_DEFUN([SIM_AC_OPTION_TRACE],
  22. [dnl
  23. AC_MSG_CHECKING([for sim trace settings])
  24. sim_trace="~TRACE_debug"
  25. AC_ARG_ENABLE(sim-trace,
  26. [AS_HELP_STRING([--enable-sim-trace=opts],
  27. [Enable tracing of simulated programs])],
  28. [case "${enableval}" in
  29. yes) sim_trace="-1";;
  30. no) sim_trace="0";;
  31. [[-0-9]]*)
  32. sim_trace="'(${enableval})'";;
  33. [[[:lower:]]]*)
  34. sim_trace=""
  35. for x in `echo "$enableval" | sed -e "s/,/ /g"`; do
  36. if test x"$sim_trace" = x; then
  37. sim_trace="(TRACE_$x"
  38. else
  39. sim_trace="${sim_trace}|TRACE_$x"
  40. fi
  41. done
  42. sim_trace="$sim_trace)" ;;
  43. esac])dnl
  44. AC_DEFINE_UNQUOTED([WITH_TRACE], [$sim_trace], [Sim trace settings])
  45. AC_MSG_RESULT($sim_trace)
  46. ])