File: st_stacktrace.m4

package info (click to toggle)
strace 6.13%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 71,488 kB
  • sloc: ansic: 176,497; sh: 9,675; makefile: 4,133; cpp: 885; awk: 353; perl: 267; exp: 62; sed: 9
file content (58 lines) | stat: -rw-r--r-- 1,989 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/m4
#
# Copyright (c) 2018-2021 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: LGPL-2.1-or-later

AC_DEFUN([st_STACKTRACE], [dnl

AC_ARG_ENABLE([stacktrace],
	[AS_HELP_STRING([--enable-stacktrace=yes|no|check],
		[whether to enable stack tracing support, default is check])],
	[case "$enableval" in
		yes|no|check) enable_stacktrace="$enableval" ;;
		*) AC_MSG_ERROR([bad value $enableval for enable-stacktrace option.
Valid options are: yes, no, check.])
		;;
	 esac],
	[enable_stacktrace=check])

use_unwinder=
dnl Whether to enable stack tracing support?

AS_IF([test x"$enable_stacktrace" != xno],
      [st_ARG_LIBDW
       st_ARG_LIBUNWIND
       AS_IF([test "x$with_libdw" = xyes && test "x$with_libunwind" = xyes],
	     [AC_MSG_ERROR([--with-libdw=yes and --with-libunwind=yes are mutually exclusive])],
	     [test "x$with_libdw" = xyes], [with_libunwind=no],
	     [test "x$with_libunwind" = xyes], [with_libdw=no]
	    )
       AS_IF([test "x$use_unwinder" = x], [st_LIBDW])
       AS_IF([test "x$use_unwinder" = x], [st_LIBUNWIND])
       AS_IF([test x"$enable_stacktrace$use_unwinder" = xyes],
	     [AC_MSG_ERROR([stack tracing support requires an unwinder])]
	    )
      ]
     )

AC_MSG_CHECKING([whether to enable stack tracing support])
AM_CONDITIONAL([ENABLE_STACKTRACE], [test "x$use_unwinder" != x])
AM_CONDITIONAL([USE_LIBDW], [test "x$use_unwinder" = xlibdw])
AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_unwinder" = xlibunwind])

use_libiberty=
AS_IF([test "x$use_unwinder" != x],
      [AC_DEFINE([ENABLE_STACKTRACE], [1],
			  [Define to enable stack tracing support])
       AC_DEFINE_UNQUOTED([USE_UNWINDER], ["$use_unwinder"],
			  [The unwinder to use for stack tracing support])
       AC_MSG_RESULT([yes, using $use_unwinder])
       dnl As stack tracing support is enabled, check for a demangler.
       st_DEMANGLE],
      [AC_MSG_RESULT([no])])

AM_CONDITIONAL([USE_DEMANGLE], [test "x$use_libiberty" = xyes])

])