pf2 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -2
  3. data/Cargo.lock +186 -17
  4. data/Cargo.toml +1 -1
  5. data/README.md +18 -6
  6. data/Rakefile +8 -0
  7. data/crates/backtrace-sys2/.gitignore +1 -0
  8. data/crates/backtrace-sys2/Cargo.toml +9 -0
  9. data/crates/backtrace-sys2/build.rs +48 -0
  10. data/crates/backtrace-sys2/src/lib.rs +5 -0
  11. data/crates/backtrace-sys2/src/libbacktrace/.gitignore +15 -0
  12. data/crates/backtrace-sys2/src/libbacktrace/Isaac.Newton-Opticks.txt +9286 -0
  13. data/crates/backtrace-sys2/src/libbacktrace/LICENSE +29 -0
  14. data/crates/backtrace-sys2/src/libbacktrace/Makefile.am +623 -0
  15. data/crates/backtrace-sys2/src/libbacktrace/Makefile.in +2666 -0
  16. data/crates/backtrace-sys2/src/libbacktrace/README.md +36 -0
  17. data/crates/backtrace-sys2/src/libbacktrace/aclocal.m4 +864 -0
  18. data/crates/backtrace-sys2/src/libbacktrace/alloc.c +167 -0
  19. data/crates/backtrace-sys2/src/libbacktrace/allocfail.c +136 -0
  20. data/crates/backtrace-sys2/src/libbacktrace/allocfail.sh +104 -0
  21. data/crates/backtrace-sys2/src/libbacktrace/atomic.c +113 -0
  22. data/crates/backtrace-sys2/src/libbacktrace/backtrace-supported.h.in +66 -0
  23. data/crates/backtrace-sys2/src/libbacktrace/backtrace.c +129 -0
  24. data/crates/backtrace-sys2/src/libbacktrace/backtrace.h +189 -0
  25. data/crates/backtrace-sys2/src/libbacktrace/btest.c +501 -0
  26. data/crates/backtrace-sys2/src/libbacktrace/compile +348 -0
  27. data/crates/backtrace-sys2/src/libbacktrace/config/enable.m4 +38 -0
  28. data/crates/backtrace-sys2/src/libbacktrace/config/lead-dot.m4 +31 -0
  29. data/crates/backtrace-sys2/src/libbacktrace/config/libtool.m4 +7436 -0
  30. data/crates/backtrace-sys2/src/libbacktrace/config/ltoptions.m4 +369 -0
  31. data/crates/backtrace-sys2/src/libbacktrace/config/ltsugar.m4 +123 -0
  32. data/crates/backtrace-sys2/src/libbacktrace/config/ltversion.m4 +23 -0
  33. data/crates/backtrace-sys2/src/libbacktrace/config/lt~obsolete.m4 +98 -0
  34. data/crates/backtrace-sys2/src/libbacktrace/config/multi.m4 +68 -0
  35. data/crates/backtrace-sys2/src/libbacktrace/config/override.m4 +117 -0
  36. data/crates/backtrace-sys2/src/libbacktrace/config/unwind_ipinfo.m4 +37 -0
  37. data/crates/backtrace-sys2/src/libbacktrace/config/warnings.m4 +227 -0
  38. data/crates/backtrace-sys2/src/libbacktrace/config.guess +1700 -0
  39. data/crates/backtrace-sys2/src/libbacktrace/config.h.in +182 -0
  40. data/crates/backtrace-sys2/src/libbacktrace/config.sub +1885 -0
  41. data/crates/backtrace-sys2/src/libbacktrace/configure +15740 -0
  42. data/crates/backtrace-sys2/src/libbacktrace/configure.ac +613 -0
  43. data/crates/backtrace-sys2/src/libbacktrace/dwarf.c +4402 -0
  44. data/crates/backtrace-sys2/src/libbacktrace/edtest.c +120 -0
  45. data/crates/backtrace-sys2/src/libbacktrace/edtest2.c +43 -0
  46. data/crates/backtrace-sys2/src/libbacktrace/elf.c +7443 -0
  47. data/crates/backtrace-sys2/src/libbacktrace/fileline.c +407 -0
  48. data/crates/backtrace-sys2/src/libbacktrace/filenames.h +52 -0
  49. data/crates/backtrace-sys2/src/libbacktrace/filetype.awk +13 -0
  50. data/crates/backtrace-sys2/src/libbacktrace/install-debuginfo-for-buildid.sh.in +65 -0
  51. data/crates/backtrace-sys2/src/libbacktrace/install-sh +501 -0
  52. data/crates/backtrace-sys2/src/libbacktrace/instrumented_alloc.c +114 -0
  53. data/crates/backtrace-sys2/src/libbacktrace/internal.h +389 -0
  54. data/crates/backtrace-sys2/src/libbacktrace/libtool.m4 +7436 -0
  55. data/crates/backtrace-sys2/src/libbacktrace/ltmain.sh +8636 -0
  56. data/crates/backtrace-sys2/src/libbacktrace/ltoptions.m4 +369 -0
  57. data/crates/backtrace-sys2/src/libbacktrace/ltsugar.m4 +123 -0
  58. data/crates/backtrace-sys2/src/libbacktrace/ltversion.m4 +23 -0
  59. data/crates/backtrace-sys2/src/libbacktrace/lt~obsolete.m4 +98 -0
  60. data/crates/backtrace-sys2/src/libbacktrace/macho.c +1355 -0
  61. data/crates/backtrace-sys2/src/libbacktrace/missing +215 -0
  62. data/crates/backtrace-sys2/src/libbacktrace/mmap.c +331 -0
  63. data/crates/backtrace-sys2/src/libbacktrace/mmapio.c +110 -0
  64. data/crates/backtrace-sys2/src/libbacktrace/move-if-change +83 -0
  65. data/crates/backtrace-sys2/src/libbacktrace/mtest.c +410 -0
  66. data/crates/backtrace-sys2/src/libbacktrace/nounwind.c +66 -0
  67. data/crates/backtrace-sys2/src/libbacktrace/pecoff.c +957 -0
  68. data/crates/backtrace-sys2/src/libbacktrace/posix.c +104 -0
  69. data/crates/backtrace-sys2/src/libbacktrace/print.c +92 -0
  70. data/crates/backtrace-sys2/src/libbacktrace/read.c +110 -0
  71. data/crates/backtrace-sys2/src/libbacktrace/simple.c +108 -0
  72. data/crates/backtrace-sys2/src/libbacktrace/sort.c +108 -0
  73. data/crates/backtrace-sys2/src/libbacktrace/state.c +72 -0
  74. data/crates/backtrace-sys2/src/libbacktrace/stest.c +137 -0
  75. data/crates/backtrace-sys2/src/libbacktrace/test-driver +148 -0
  76. data/crates/backtrace-sys2/src/libbacktrace/test_format.c +55 -0
  77. data/crates/backtrace-sys2/src/libbacktrace/testlib.c +234 -0
  78. data/crates/backtrace-sys2/src/libbacktrace/testlib.h +110 -0
  79. data/crates/backtrace-sys2/src/libbacktrace/ttest.c +161 -0
  80. data/crates/backtrace-sys2/src/libbacktrace/unittest.c +92 -0
  81. data/crates/backtrace-sys2/src/libbacktrace/unknown.c +65 -0
  82. data/crates/backtrace-sys2/src/libbacktrace/xcoff.c +1606 -0
  83. data/crates/backtrace-sys2/src/libbacktrace/xztest.c +508 -0
  84. data/crates/backtrace-sys2/src/libbacktrace/zstdtest.c +523 -0
  85. data/crates/backtrace-sys2/src/libbacktrace/ztest.c +541 -0
  86. data/ext/pf2/Cargo.toml +1 -0
  87. data/ext/pf2/src/backtrace.rs +127 -0
  88. data/ext/pf2/src/lib.rs +3 -0
  89. data/ext/pf2/src/profile.rs +16 -1
  90. data/ext/pf2/src/profile_serializer.rs +95 -21
  91. data/ext/pf2/src/ringbuffer.rs +7 -0
  92. data/ext/pf2/src/ruby_init.rs +18 -6
  93. data/ext/pf2/src/ruby_internal_apis.rs +47 -0
  94. data/ext/pf2/src/sample.rs +22 -1
  95. data/ext/pf2/src/signal_scheduler/configuration.rs +7 -0
  96. data/ext/pf2/src/signal_scheduler/timer_installer.rs +79 -126
  97. data/ext/pf2/src/signal_scheduler.rs +95 -26
  98. data/ext/pf2/src/timer_thread_scheduler.rs +88 -12
  99. data/ext/pf2/src/util.rs +2 -2
  100. data/lib/pf2/reporter.rb +12 -5
  101. data/lib/pf2/version.rb +1 -1
  102. data/lib/pf2.rb +3 -6
  103. metadata +97 -6
@@ -0,0 +1,613 @@
1
+ # configure.ac -- Backtrace configure script.
2
+ # Copyright (C) 2012-2021 Free Software Foundation, Inc.
3
+
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are
6
+ # met:
7
+
8
+ # (1) Redistributions of source code must retain the above copyright
9
+ # notice, this list of conditions and the following disclaimer.
10
+
11
+ # (2) Redistributions in binary form must reproduce the above copyright
12
+ # notice, this list of conditions and the following disclaimer in
13
+ # the documentation and/or other materials provided with the
14
+ # distribution.
15
+
16
+ # (3) The name of the author may not be used to
17
+ # endorse or promote products derived from this software without
18
+ # specific prior written permission.
19
+
20
+ # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21
+ # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
24
+ # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27
+ # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29
+ # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+ # POSSIBILITY OF SUCH DAMAGE.
31
+
32
+ AC_PREREQ(2.69)
33
+ AC_INIT(package-unused, version-unused,, libbacktrace)
34
+ AC_CONFIG_SRCDIR(backtrace.h)
35
+ AC_CONFIG_HEADER(config.h)
36
+ AC_CONFIG_MACRO_DIR(config)
37
+
38
+ # with_target_subdir is used when configured as part of a GCC tree.
39
+ if test -n "${with_target_subdir}"; then
40
+ AM_ENABLE_MULTILIB(, ..)
41
+ fi
42
+
43
+ AC_CANONICAL_SYSTEM
44
+ target_alias=${target_alias-$host_alias}
45
+
46
+ AC_USE_SYSTEM_EXTENSIONS
47
+
48
+ # Default to not building a shared library.
49
+ AC_DISABLE_SHARED
50
+
51
+ libtool_VERSION=1:0:0
52
+ AC_SUBST(libtool_VERSION)
53
+
54
+ # 1.11.1: Require that version of automake.
55
+ # foreign: Don't require README, INSTALL, NEWS, etc.
56
+ # no-define: Don't define PACKAGE and VERSION.
57
+ # no-dependencies: Don't generate automatic dependencies.
58
+ # (because it breaks when using bootstrap-lean, since some of the
59
+ # headers are gone at "make install" time).
60
+ # -Wall: Issue all automake warnings.
61
+ # -Wno-portability: Don't warn about constructs supported by GNU make.
62
+ # (because GCC requires GNU make anyhow).
63
+ AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define no-dependencies -Wall -Wno-portability])
64
+
65
+ AM_MAINTAINER_MODE
66
+
67
+ AC_ARG_WITH(target-subdir,
68
+ [ --with-target-subdir=SUBDIR Configuring in a subdirectory for target])
69
+
70
+ # We must force CC to /not/ be precious variables; otherwise
71
+ # the wrong, non-multilib-adjusted value will be used in multilibs.
72
+ # As a side effect, we have to subst CFLAGS ourselves.
73
+ m4_rename([_AC_ARG_VAR_PRECIOUS],[backtrace_PRECIOUS])
74
+ m4_define([_AC_ARG_VAR_PRECIOUS],[])
75
+ AC_PROG_CC
76
+ m4_rename_force([backtrace_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
77
+
78
+ AC_SUBST(CFLAGS)
79
+
80
+ AC_PROG_RANLIB
81
+
82
+ AC_PROG_AWK
83
+ case "$AWK" in
84
+ "") AC_MSG_ERROR([can't build without awk]) ;;
85
+ esac
86
+
87
+ AC_CHECK_PROG(DWZ, dwz, dwz)
88
+ AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "")
89
+
90
+ LT_INIT
91
+ AM_PROG_LIBTOOL
92
+
93
+ AC_SYS_LARGEFILE
94
+
95
+ backtrace_supported=yes
96
+
97
+ if test -n "${with_target_subdir}"; then
98
+ # We are compiling a GCC library. We can assume that the unwind
99
+ # library exists.
100
+ BACKTRACE_FILE="backtrace.lo simple.lo"
101
+ else
102
+ AC_CHECK_HEADER([unwind.h],
103
+ [AC_CHECK_FUNC([_Unwind_Backtrace],
104
+ [BACKTRACE_FILE="backtrace.lo simple.lo"],
105
+ [BACKTRACE_FILE="nounwind.lo"
106
+ backtrace_supported=no])],
107
+ [BACKTRACE_FILE="nounwind.lo"
108
+ backtrace_supported=no])
109
+ fi
110
+ AC_SUBST(BACKTRACE_FILE)
111
+
112
+ EXTRA_FLAGS=
113
+ if test -n "${with_target_subdir}"; then
114
+ EXTRA_FLAGS="-funwind-tables -frandom-seed=\$@"
115
+ else
116
+ AC_CACHE_CHECK([for -funwind-tables option],
117
+ [libbacktrace_cv_c_unwind_tables],
118
+ [CFLAGS_hold="$CFLAGS"
119
+ CFLAGS="$CFLAGS -funwind-tables"
120
+ AC_COMPILE_IFELSE(
121
+ [AC_LANG_PROGRAM([static int f() { return 0; }], [return f();])],
122
+ [libbacktrace_cv_c_unwind_tables=yes],
123
+ [libbacktrace_cv_c_unwind_tables=no])
124
+ CFLAGS="$CFLAGS_hold"])
125
+ if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
126
+ EXTRA_FLAGS=-funwind-tables
127
+ fi
128
+ AC_CACHE_CHECK([for -frandom-seed=string option],
129
+ [libbacktrace_cv_c_random_seed_string],
130
+ [CFLAGS_hold="$CFLAGS"
131
+ CFLAGS="$CFLAGS -frandom-seed=conftest.lo"
132
+ AC_COMPILE_IFELSE(
133
+ [AC_LANG_PROGRAM([], [return 0;])],
134
+ [libbacktrace_cv_c_random_seed_string=yes],
135
+ [libbacktrace_cv_c_random_seed_string=no])
136
+ CFLAGS="$CFLAGS_hold"])
137
+ if test "$libbacktrace_cv_c_random_seed_string" = "yes"; then
138
+ EXTRA_FLAGS="$EXTRA_FLAGS -frandom-seed=\$@"
139
+ fi
140
+ fi
141
+ AC_SUBST(EXTRA_FLAGS)
142
+
143
+ ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
144
+ -Wmissing-prototypes -Wold-style-definition \
145
+ -Wmissing-format-attribute -Wcast-qual],
146
+ [WARN_FLAGS])
147
+
148
+ AC_ARG_ENABLE([werror],
149
+ [AS_HELP_STRING([--disable-werror], [disable building with -Werror])])
150
+ AS_IF([test "x$enable_werror" != "xno" && test -n "${with_target_subdir}"],
151
+ [WARN_FLAGS="$WARN_FLAGS -Werror"])
152
+
153
+ AC_SUBST(WARN_FLAGS)
154
+
155
+ if test -n "${with_target_subdir}"; then
156
+ GCC_CHECK_UNWIND_GETIPINFO
157
+ else
158
+ ac_save_CFFLAGS="$CFLAGS"
159
+ CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
160
+ AC_MSG_CHECKING([for _Unwind_GetIPInfo])
161
+ AC_LINK_IFELSE(
162
+ [AC_LANG_PROGRAM(
163
+ [#include "unwind.h"
164
+ struct _Unwind_Context *context;
165
+ int ip_before_insn = 0;],
166
+ [return _Unwind_GetIPInfo (context, &ip_before_insn);])],
167
+ [have_unwind_getipinfo=yes], [have_unwind_getipinfo=no])
168
+ CFLAGS="$ac_save_CFLAGS"
169
+ AC_MSG_RESULT([$have_unwind_getipinfo])
170
+ if test "$have_unwind_getipinfo" = "yes"; then
171
+ AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
172
+ fi
173
+ fi
174
+
175
+ # Enable --enable-host-shared.
176
+ AC_ARG_ENABLE(host-shared,
177
+ [AS_HELP_STRING([--enable-host-shared],
178
+ [build host code as shared libraries])],
179
+ [PIC_FLAG=-fPIC], [PIC_FLAG=])
180
+ AC_SUBST(PIC_FLAG)
181
+
182
+ # Test for __sync support.
183
+ AC_CACHE_CHECK([__sync extensions],
184
+ [libbacktrace_cv_sys_sync],
185
+ [if test -n "${with_target_subdir}"; then
186
+ case "${host}" in
187
+ hppa*-*-hpux*) libbacktrace_cv_sys_sync=no ;;
188
+ *) libbacktrace_cv_sys_sync=yes ;;
189
+ esac
190
+ else
191
+ AC_LINK_IFELSE(
192
+ [AC_LANG_PROGRAM([int i;],
193
+ [__sync_bool_compare_and_swap (&i, i, i);
194
+ __sync_lock_test_and_set (&i, 1);
195
+ __sync_lock_release (&i);])],
196
+ [libbacktrace_cv_sys_sync=yes],
197
+ [libbacktrace_cv_sys_sync=no])
198
+ fi])
199
+ BACKTRACE_SUPPORTS_THREADS=0
200
+ if test "$libbacktrace_cv_sys_sync" = "yes"; then
201
+ BACKTRACE_SUPPORTS_THREADS=1
202
+ AC_DEFINE([HAVE_SYNC_FUNCTIONS], 1,
203
+ [Define to 1 if you have the __sync functions])
204
+ fi
205
+ AC_SUBST(BACKTRACE_SUPPORTS_THREADS)
206
+
207
+ # Test for __atomic support.
208
+ AC_CACHE_CHECK([__atomic extensions],
209
+ [libbacktrace_cv_sys_atomic],
210
+ [if test -n "${with_target_subdir}"; then
211
+ libbacktrace_cv_sys_atomic=yes
212
+ else
213
+ AC_LINK_IFELSE(
214
+ [AC_LANG_PROGRAM([int i;],
215
+ [__atomic_load_n (&i, __ATOMIC_ACQUIRE);
216
+ __atomic_store_n (&i, 1, __ATOMIC_RELEASE);])],
217
+ [libbacktrace_cv_sys_atomic=yes],
218
+ [libbacktrace_cv_sys_atomic=no])
219
+ fi])
220
+ if test "$libbacktrace_cv_sys_atomic" = "yes"; then
221
+ AC_DEFINE([HAVE_ATOMIC_FUNCTIONS], 1,
222
+ [Define to 1 if you have the __atomic functions])
223
+ fi
224
+
225
+ # The library needs to be able to read the executable itself. Compile
226
+ # a file to determine the executable format. The awk script
227
+ # filetype.awk prints out the file type.
228
+ AC_CACHE_CHECK([output filetype],
229
+ [libbacktrace_cv_sys_filetype],
230
+ [filetype=
231
+ AC_COMPILE_IFELSE(
232
+ [AC_LANG_PROGRAM([int i;], [int j;])],
233
+ [filetype=`${AWK} -f $srcdir/filetype.awk conftest.$ac_objext`],
234
+ [AC_MSG_FAILURE([compiler failed])])
235
+ libbacktrace_cv_sys_filetype=$filetype])
236
+
237
+ # Match the file type to decide what files to compile.
238
+ FORMAT_FILE=
239
+ backtrace_supports_data=yes
240
+ case "$libbacktrace_cv_sys_filetype" in
241
+ elf*) FORMAT_FILE="elf.lo" ;;
242
+ macho) FORMAT_FILE="macho.lo" ;;
243
+ pecoff) FORMAT_FILE="pecoff.lo"
244
+ backtrace_supports_data=no
245
+ ;;
246
+ xcoff*) FORMAT_FILE="xcoff.lo"
247
+ backtrace_supports_data=no
248
+ ;;
249
+ *) AC_MSG_WARN([could not determine output file type])
250
+ FORMAT_FILE="unknown.lo"
251
+ backtrace_supported=no
252
+ ;;
253
+ esac
254
+ AC_SUBST(FORMAT_FILE)
255
+
256
+ # ELF defines.
257
+ elfsize=
258
+ case "$libbacktrace_cv_sys_filetype" in
259
+ elf32) elfsize=32 ;;
260
+ elf64) elfsize=64 ;;
261
+ *) elfsize=unused
262
+ esac
263
+ AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64])
264
+ AM_CONDITIONAL(HAVE_ELF, test "$FORMAT_FILE" = "elf.lo")
265
+
266
+ # XCOFF defines.
267
+ xcoffsize=
268
+ case "$libbacktrace_cv_sys_filetype" in
269
+ xcoff32) xcoffsize=32 ;;
270
+ xcoff64) xcoffsize=64 ;;
271
+ *) xcoffsize=unused
272
+ esac
273
+ AC_DEFINE_UNQUOTED([BACKTRACE_XCOFF_SIZE], [$xcoffsize], [XCOFF size: 32 or 64])
274
+
275
+ BACKTRACE_SUPPORTED=0
276
+ if test "$backtrace_supported" = "yes"; then
277
+ BACKTRACE_SUPPORTED=1
278
+ fi
279
+ AC_SUBST(BACKTRACE_SUPPORTED)
280
+
281
+ BACKTRACE_SUPPORTS_DATA=0
282
+ if test "$backtrace_supports_data" = "yes"; then
283
+ BACKTRACE_SUPPORTS_DATA=1
284
+ fi
285
+ AC_SUBST(BACKTRACE_SUPPORTS_DATA)
286
+
287
+ AC_CHECK_HEADERS(sys/mman.h)
288
+ if test "$ac_cv_header_sys_mman_h" = "no"; then
289
+ have_mmap=no
290
+ else
291
+ if test -n "${with_target_subdir}"; then
292
+ # When built as a GCC target library, we can't do a link test. We
293
+ # simply assume that if we have mman.h, we have mmap.
294
+ have_mmap=yes
295
+ case "${host}" in
296
+ spu-*-*|*-*-msdosdjgpp)
297
+ # The SPU does not have mmap, but it has a sys/mman.h header file
298
+ # containing "mmap_eaddr" and the mmap flags, confusing the test.
299
+ # DJGPP also has sys/man.h, but no mmap
300
+ have_mmap=no ;;
301
+ esac
302
+ else
303
+ AC_CHECK_FUNC(mmap, [have_mmap=yes], [have_mmap=no])
304
+ fi
305
+ fi
306
+ if test "$have_mmap" = "no"; then
307
+ VIEW_FILE=read.lo
308
+ ALLOC_FILE=alloc.lo
309
+ else
310
+ VIEW_FILE=mmapio.lo
311
+ AC_PREPROC_IFELSE([AC_LANG_SOURCE([
312
+ #include <sys/mman.h>
313
+ #if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
314
+ #error no MAP_ANONYMOUS
315
+ #endif
316
+ ])], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo])
317
+ fi
318
+ AC_SUBST(VIEW_FILE)
319
+ AC_SUBST(ALLOC_FILE)
320
+
321
+ BACKTRACE_USES_MALLOC=0
322
+ if test "$ALLOC_FILE" = "alloc.lo"; then
323
+ BACKTRACE_USES_MALLOC=1
324
+ fi
325
+ AC_SUBST(BACKTRACE_USES_MALLOC)
326
+
327
+ # Check for dl_iterate_phdr.
328
+ AC_CHECK_HEADERS(link.h sys/link.h)
329
+ if test "$ac_cv_header_link_h" = "no" -a "$ac_cv_header_sys_link_h" = "no"; then
330
+ have_dl_iterate_phdr=no
331
+ else
332
+ if test -n "${with_target_subdir}"; then
333
+ link_h=link.h
334
+ if test "$ac_cv_header_link_h" = "no"; then
335
+ link_h=sys/link.h
336
+ fi
337
+ # When built as a GCC target library, we can't do a link test.
338
+ AC_EGREP_HEADER([dl_iterate_phdr], [$link_h], [have_dl_iterate_phdr=yes],
339
+ [have_dl_iterate_phdr=no])
340
+ case "${host}" in
341
+ *-*-solaris2.10*)
342
+ # Avoid dl_iterate_phdr on Solaris 10, where it is in the
343
+ # header file but is only in -ldl.
344
+ have_dl_iterate_phdr=no ;;
345
+ esac
346
+ else
347
+ AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes],
348
+ [have_dl_iterate_phdr=no])
349
+ fi
350
+ fi
351
+ if test "$have_dl_iterate_phdr" = "yes"; then
352
+ AC_DEFINE(HAVE_DL_ITERATE_PHDR, 1, [Define if dl_iterate_phdr is available.])
353
+ fi
354
+
355
+ # Check for header file for Mach-O image functions.
356
+ AC_CHECK_HEADERS(mach-o/dyld.h)
357
+
358
+ # Check for loadquery.
359
+ AC_CHECK_HEADERS(sys/ldr.h)
360
+ if test "$ac_cv_header_sys_ldr_h" = "no"; then
361
+ have_loadquery=no
362
+ else
363
+ if test -n "${with_target_subdir}"; then
364
+ # When built as a GCC target library, we can't do a link test.
365
+ AC_EGREP_HEADER([loadquery], [sys/ldr.h], [have_loadquery=yes],
366
+ [have_loadquery=no])
367
+ else
368
+ AC_CHECK_FUNC([loadquery], [have_loadquery=yes],
369
+ [have_loadquery=no])
370
+ fi
371
+ fi
372
+ if test "$have_loadquery" = "yes"; then
373
+ AC_DEFINE(HAVE_LOADQUERY, 1, [Define if AIX loadquery is available.])
374
+ fi
375
+
376
+ AC_CHECK_HEADERS(windows.h)
377
+
378
+ # Check for the fcntl function.
379
+ if test -n "${with_target_subdir}"; then
380
+ case "${host}" in
381
+ *-*-mingw*) have_fcntl=no ;;
382
+ spu-*-*) have_fcntl=no ;;
383
+ *) have_fcntl=yes ;;
384
+ esac
385
+ else
386
+ AC_CHECK_FUNC(fcntl, [have_fcntl=yes], [have_fcntl=no])
387
+ fi
388
+ if test "$have_fcntl" = "yes"; then
389
+ AC_DEFINE([HAVE_FCNTL], 1,
390
+ [Define to 1 if you have the fcntl function])
391
+ fi
392
+
393
+ AC_CHECK_DECLS([strnlen, getpagesize])
394
+ AC_CHECK_FUNCS(lstat readlink)
395
+
396
+ # Check for getexecname function.
397
+ if test -n "${with_target_subdir}"; then
398
+ case "${host}" in
399
+ *-*-solaris2*) have_getexecname=yes ;;
400
+ *) have_getexecname=no ;;
401
+ esac
402
+ else
403
+ AC_CHECK_FUNC(getexecname, [have_getexecname=yes], [have_getexecname=no])
404
+ fi
405
+ if test "$have_getexecname" = "yes"; then
406
+ AC_DEFINE(HAVE_GETEXECNAME, 1, [Define if getexecname is available.])
407
+ fi
408
+
409
+ # Check for _pgmptr variable, contains the executable filename on windows
410
+ AC_CHECK_DECLS([_pgmptr])
411
+
412
+ # Check for sysctl definitions.
413
+
414
+ AC_CACHE_CHECK([for KERN_PROC],
415
+ [libbacktrace_cv_proc],
416
+ [AC_COMPILE_IFELSE(
417
+ [AC_LANG_PROGRAM([
418
+ #include <sys/types.h>
419
+ #include <sys/sysctl.h>
420
+ ], [int mib0 = CTL_KERN; int mib1 = KERN_PROC; int mib2 = KERN_PROC_PATHNAME;])],
421
+ [libbacktrace_cv_proc=yes],
422
+ [libbacktrace_cv_proc=no])])
423
+ if test "$libbacktrace_cv_proc" = "yes"; then
424
+ AC_DEFINE([HAVE_KERN_PROC], 1,
425
+ [Define to 1 if you have KERN_PROC and KERN_PROC_PATHNAME in <sys/sysctl.h>.])
426
+ fi
427
+
428
+ AC_CACHE_CHECK([for KERN_PROG_ARGS],
429
+ [libbacktrace_cv_procargs],
430
+ [AC_COMPILE_IFELSE(
431
+ [AC_LANG_PROGRAM([
432
+ #include <sys/types.h>
433
+ #include <sys/sysctl.h>
434
+ ], [int mib0 = CTL_KERN; int mib1 = KERN_PROC_ARGS; int mib2 = KERN_PROC_PATHNAME;])],
435
+ [libbacktrace_cv_procargs=yes],
436
+ [libbacktrace_cv_procargs=no])])
437
+ if test "$libbacktrace_cv_procargs" = "yes"; then
438
+ AC_DEFINE([HAVE_KERN_PROC_ARGS], 1,
439
+ [Define to 1 if you have KERN_PROCARGS and KERN_PROC_PATHNAME in <sys/sysctl.h>.])
440
+ fi
441
+
442
+ # Check for the clock_gettime function.
443
+ AC_CHECK_FUNCS(clock_gettime)
444
+ clock_gettime_link=
445
+ # At least for glibc, clock_gettime is in librt. But don't
446
+ # pull that in if it still doesn't give us the function we want. This
447
+ # test is copied from libgomp, and modified to not link in -lrt as
448
+ # we're using this for test timing only.
449
+ if test "$ac_cv_func_clock_gettime" = no; then
450
+ AC_CHECK_LIB(rt, clock_gettime,
451
+ [CLOCK_GETTIME_LINK=-lrt
452
+ AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
453
+ [Define to 1 if you have the `clock_gettime' function.])])
454
+ fi
455
+ AC_SUBST(CLOCK_GETTIME_LINK)
456
+
457
+ dnl Test whether the compiler supports the -pthread option.
458
+ AC_CACHE_CHECK([whether -pthread is supported],
459
+ [libgo_cv_lib_pthread],
460
+ [CFLAGS_hold=$CFLAGS
461
+ CFLAGS="$CFLAGS -pthread"
462
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
463
+ [libgo_cv_lib_pthread=yes],
464
+ [libgo_cv_lib_pthread=no])
465
+ CFLAGS=$CFLAGS_hold])
466
+ PTHREAD_CFLAGS=
467
+ if test "$libgo_cv_lib_pthread" = yes; then
468
+ PTHREAD_CFLAGS=-pthread
469
+ fi
470
+ AC_SUBST(PTHREAD_CFLAGS)
471
+
472
+ AM_CONDITIONAL(HAVE_PTHREAD, test "$libgo_cv_lib_pthread" = yes)
473
+
474
+ dnl Test whether the compiler and the linker support the -gdwarf-5 option.
475
+ AC_CACHE_CHECK([whether -gdwarf-5 is supported],
476
+ [libbacktrace_cv_lib_dwarf5],
477
+ [CFLAGS_hold=$CFLAGS
478
+ CFLAGS="$CFLAGS -gdwarf-5"
479
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;], [return 0;])],
480
+ [libbacktrace_cv_lib_dwarf5=yes],
481
+ [libbacktrace_cv_lib_dwarf5=no])
482
+ CFLAGS=$CFLAGS_hold])
483
+ AM_CONDITIONAL(HAVE_DWARF5, test "$libbacktrace_cv_lib_dwarf5" = yes)
484
+
485
+ AC_CHECK_LIB([z], [compress],
486
+ [AC_DEFINE(HAVE_ZLIB, 1, [Define if -lz is available.])])
487
+ AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_lib_z_compress" = yes)
488
+
489
+ dnl Test whether the linker supports the --build-id option.
490
+ AC_CACHE_CHECK([whether --build-id is supported],
491
+ [libbacktrace_cv_ld_buildid],
492
+ [LDFLAGS_hold=$LDFLAGS
493
+ LDFLAGS="$LDFLAGS -Wl,--build-id"
494
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
495
+ [libbacktrace_cv_ld_buildid=yes],
496
+ [libbacktrace_cv_ld_buildid=no])
497
+ LDFLAGS=$LDFLAGS_hold])
498
+ AM_CONDITIONAL(HAVE_BUILDID, test "$libbacktrace_cv_ld_buildid" = yes)
499
+
500
+ dnl Test whether the linker supports the --compress-debug-sections option.
501
+ AC_CACHE_CHECK([whether --compress-debug-sections is supported],
502
+ [libgo_cv_ld_compress],
503
+ [LDFLAGS_hold=$LDFLAGS
504
+ LDFLAGS="$LDFLAGS -Wl,--compress-debug-sections=zlib-gnu"
505
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
506
+ [libgo_cv_ld_compress=yes],
507
+ [libgo_cv_ld_compress=no])
508
+ LDFLAGS=$LDFLAGS_hold])
509
+ AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG, test "$libgo_cv_ld_compress" = yes)
510
+
511
+ AC_CHECK_LIB([zstd], [ZSTD_compress],
512
+ [AC_DEFINE(HAVE_ZSTD, 1, [Define if -lzstd is available.])])
513
+ AM_CONDITIONAL(HAVE_ZSTD, test "$ac_cv_lib_zstd_ZSTD_compress" = yes)
514
+
515
+ dnl Test whether the linker supports --compress-debug-sections=zstd option.
516
+ AC_CACHE_CHECK([whether --compress-debug-sections=zstd is supported],
517
+ [libgo_cv_ld_compress_zstd],
518
+ [LDFLAGS_hold=$LDFLAGS
519
+ LDFLAGS="$LDFLAGS -Wl,--compress-debug-sections=zstd"
520
+ AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
521
+ [libgo_cv_ld_compress_zstd=yes],
522
+ [libgo_cv_ld_compress_zstd=no])
523
+ LDFLAGS=$LDFLAGS_hold])
524
+ AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG_ZSTD, test "$libgo_cv_ld_compress_zstd" = yes)
525
+
526
+ AC_ARG_VAR(OBJCOPY, [location of objcopy])
527
+ AC_CHECK_PROG(OBJCOPY, objcopy, objcopy,)
528
+ AC_CHECK_PROG(READELF, readelf, readelf)
529
+ AC_CACHE_CHECK([whether objcopy supports debuglink],
530
+ [libbacktrace_cv_objcopy_debuglink],
531
+ [if test -n "${with_target_subdir}"; then
532
+ libbacktrace_cv_objcopy_debuglink=no
533
+ elif ! test -n "${OBJCOPY}"; then
534
+ libbacktrace_cv_objcopy_debuglink=no
535
+ elif ${OBJCOPY} --help | grep add-gnu-debuglink >/dev/null 2>&1; then
536
+ libbacktrace_cv_objcopy_debuglink=yes
537
+ else
538
+ libbacktrace_cv_objcopy_debuglink=no
539
+ fi])
540
+ AM_CONDITIONAL(HAVE_OBJCOPY_DEBUGLINK, test "$libbacktrace_cv_objcopy_debuglink" = yes)
541
+
542
+ AC_ARG_VAR(DSYMUTIL, [location of dsymutil])
543
+ AC_CHECK_PROG(DSYMUTIL, dsymutil, dsymutil)
544
+ AM_CONDITIONAL(USE_DSYMUTIL, test -n "${DSYMUTIL}" -a "$FORMAT_FILE" = "macho.lo")
545
+
546
+ AC_ARG_VAR(NM, [location of nm])
547
+ AC_CHECK_PROG(NM, nm, nm)
548
+
549
+ AC_CHECK_PROG(XZ, xz, xz)
550
+ AM_CONDITIONAL(HAVE_XZ, test "$XZ" != "")
551
+ AC_CHECK_PROG(COMM, comm, comm)
552
+ AM_CONDITIONAL(HAVE_COMM, test "$COMM" != "")
553
+
554
+ AM_CONDITIONAL(HAVE_MINIDEBUG,
555
+ test "${with_target_subdir}" = "" -a "$FORMAT_FILE" = "elf.lo" -a "${OBJCOPY}" != "" -a "${NM}" != "" -a "${XZ}" != "" -a "${COMM}" != "")
556
+
557
+ AC_CHECK_LIB([lzma], [lzma_auto_decoder],
558
+ [AC_DEFINE(HAVE_LIBLZMA, 1, [Define if -llzma is available.])])
559
+ AM_CONDITIONAL(HAVE_LIBLZMA, test "$ac_cv_lib_lzma_lzma_auto_decoder" = yes)
560
+
561
+ AC_CACHE_CHECK([whether tests can run],
562
+ [libbacktrace_cv_sys_native],
563
+ [AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
564
+ [libbacktrace_cv_sys_native=yes],
565
+ [libbacktrace_cv_sys_native=no],
566
+ [libbacktrace_cv_sys_native=no])])
567
+ AM_CONDITIONAL(NATIVE, test "$libbacktrace_cv_sys_native" = "yes")
568
+
569
+ if test "${multilib}" = "yes"; then
570
+ multilib_arg="--enable-multilib"
571
+ else
572
+ multilib_arg=
573
+ fi
574
+
575
+ AC_CONFIG_FILES(Makefile backtrace-supported.h)
576
+ AC_CONFIG_FILES(install-debuginfo-for-buildid.sh, chmod +x install-debuginfo-for-buildid.sh)
577
+
578
+ # We need multilib support, but only if configuring for the target.
579
+ AC_CONFIG_COMMANDS([default],
580
+ [if test -n "$CONFIG_FILES"; then
581
+ if test -n "${with_target_subdir}"; then
582
+ # Multilibs need MULTISUBDIR defined correctly in certain makefiles so
583
+ # that multilib installs will end up installed in the correct place.
584
+ # The testsuite needs it for multilib-aware ABI baseline files.
585
+ # To work around this not being passed down from config-ml.in ->
586
+ # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually
587
+ # append it here. Only modify Makefiles that have just been created.
588
+ #
589
+ # Also, get rid of this simulated-VPATH thing that automake does.
590
+ cat > vpsed << \_EOF
591
+ s!`test -f '$<' || echo '$(srcdir)/'`!!
592
+ _EOF
593
+ for i in $SUBDIRS; do
594
+ case $CONFIG_FILES in
595
+ *${i}/Makefile*)
596
+ #echo "Adding MULTISUBDIR to $i/Makefile"
597
+ sed -f vpsed $i/Makefile > tmp
598
+ grep '^MULTISUBDIR =' Makefile >> tmp
599
+ mv tmp $i/Makefile
600
+ ;;
601
+ esac
602
+ done
603
+ rm vpsed
604
+ fi
605
+ fi
606
+ ],
607
+ [
608
+ # Variables needed in config.status (file generation) which aren't already
609
+ # passed by autoconf.
610
+ SUBDIRS="$SUBDIRS"
611
+ ])
612
+
613
+ AC_OUTPUT