annotate libbacktrace/configure.ac @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 # configure.ac -- Backtrace configure script.
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
2 # Copyright (C) 2012-2020 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 # Redistribution and use in source and binary forms, with or without
kono
parents:
diff changeset
5 # modification, are permitted provided that the following conditions are
kono
parents:
diff changeset
6 # met:
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 # (1) Redistributions of source code must retain the above copyright
kono
parents:
diff changeset
9 # notice, this list of conditions and the following disclaimer.
kono
parents:
diff changeset
10
kono
parents:
diff changeset
11 # (2) Redistributions in binary form must reproduce the above copyright
kono
parents:
diff changeset
12 # notice, this list of conditions and the following disclaimer in
kono
parents:
diff changeset
13 # the documentation and/or other materials provided with the
kono
parents:
diff changeset
14 # distribution.
kono
parents:
diff changeset
15
kono
parents:
diff changeset
16 # (3) The name of the author may not be used to
kono
parents:
diff changeset
17 # endorse or promote products derived from this software without
kono
parents:
diff changeset
18 # specific prior written permission.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
kono
parents:
diff changeset
21 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
kono
parents:
diff changeset
22 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
kono
parents:
diff changeset
23 # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
kono
parents:
diff changeset
24 # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
kono
parents:
diff changeset
25 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
kono
parents:
diff changeset
26 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
kono
parents:
diff changeset
27 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
kono
parents:
diff changeset
28 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
kono
parents:
diff changeset
29 # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
kono
parents:
diff changeset
30 # POSSIBILITY OF SUCH DAMAGE.
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 AC_INIT(package-unused, version-unused,, libbacktrace)
kono
parents:
diff changeset
33 AC_CONFIG_SRCDIR(backtrace.h)
kono
parents:
diff changeset
34 AC_CONFIG_HEADER(config.h)
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
37 AM_ENABLE_MULTILIB(, ..)
kono
parents:
diff changeset
38 fi
kono
parents:
diff changeset
39
kono
parents:
diff changeset
40 AC_CANONICAL_SYSTEM
kono
parents:
diff changeset
41 target_alias=${target_alias-$host_alias}
kono
parents:
diff changeset
42
kono
parents:
diff changeset
43 AC_USE_SYSTEM_EXTENSIONS
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 libtool_VERSION=1:0:0
kono
parents:
diff changeset
46 AC_SUBST(libtool_VERSION)
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 # 1.11.1: Require that version of automake.
kono
parents:
diff changeset
49 # foreign: Don't require README, INSTALL, NEWS, etc.
kono
parents:
diff changeset
50 # no-define: Don't define PACKAGE and VERSION.
kono
parents:
diff changeset
51 # no-dependencies: Don't generate automatic dependencies.
kono
parents:
diff changeset
52 # (because it breaks when using bootstrap-lean, since some of the
kono
parents:
diff changeset
53 # headers are gone at "make install" time).
kono
parents:
diff changeset
54 # -Wall: Issue all automake warnings.
kono
parents:
diff changeset
55 # -Wno-portability: Don't warn about constructs supported by GNU make.
kono
parents:
diff changeset
56 # (because GCC requires GNU make anyhow).
kono
parents:
diff changeset
57 AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define no-dependencies -Wall -Wno-portability])
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 AM_MAINTAINER_MODE
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 AC_ARG_WITH(target-subdir,
kono
parents:
diff changeset
62 [ --with-target-subdir=SUBDIR Configuring in a subdirectory for target])
kono
parents:
diff changeset
63
kono
parents:
diff changeset
64 # We must force CC to /not/ be precious variables; otherwise
kono
parents:
diff changeset
65 # the wrong, non-multilib-adjusted value will be used in multilibs.
kono
parents:
diff changeset
66 # As a side effect, we have to subst CFLAGS ourselves.
kono
parents:
diff changeset
67 m4_rename([_AC_ARG_VAR_PRECIOUS],[backtrace_PRECIOUS])
kono
parents:
diff changeset
68 m4_define([_AC_ARG_VAR_PRECIOUS],[])
kono
parents:
diff changeset
69 AC_PROG_CC
kono
parents:
diff changeset
70 m4_rename_force([backtrace_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 AC_SUBST(CFLAGS)
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 AC_PROG_RANLIB
kono
parents:
diff changeset
75
kono
parents:
diff changeset
76 AC_PROG_AWK
kono
parents:
diff changeset
77 case "$AWK" in
kono
parents:
diff changeset
78 "") AC_MSG_ERROR([can't build without awk]) ;;
kono
parents:
diff changeset
79 esac
kono
parents:
diff changeset
80
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
81 AC_CHECK_PROG(DWZ, dwz, dwz)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
82 AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "")
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
83
111
kono
parents:
diff changeset
84 LT_INIT
kono
parents:
diff changeset
85 AM_PROG_LIBTOOL
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 AC_SYS_LARGEFILE
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 backtrace_supported=yes
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
92 # We are compiling a GCC library. We can assume that the unwind
kono
parents:
diff changeset
93 # library exists.
kono
parents:
diff changeset
94 BACKTRACE_FILE="backtrace.lo simple.lo"
kono
parents:
diff changeset
95 else
kono
parents:
diff changeset
96 AC_CHECK_HEADER([unwind.h],
kono
parents:
diff changeset
97 [AC_CHECK_FUNC([_Unwind_Backtrace],
kono
parents:
diff changeset
98 [BACKTRACE_FILE="backtrace.lo simple.lo"],
kono
parents:
diff changeset
99 [BACKTRACE_FILE="nounwind.lo"
kono
parents:
diff changeset
100 backtrace_supported=no])],
kono
parents:
diff changeset
101 [BACKTRACE_FILE="nounwind.lo"
kono
parents:
diff changeset
102 backtrace_supported=no])
kono
parents:
diff changeset
103 fi
kono
parents:
diff changeset
104 AC_SUBST(BACKTRACE_FILE)
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 EXTRA_FLAGS=
kono
parents:
diff changeset
107 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
108 EXTRA_FLAGS="-funwind-tables -frandom-seed=\$@"
kono
parents:
diff changeset
109 else
kono
parents:
diff changeset
110 AC_CACHE_CHECK([for -funwind-tables option],
kono
parents:
diff changeset
111 [libbacktrace_cv_c_unwind_tables],
kono
parents:
diff changeset
112 [CFLAGS_hold="$CFLAGS"
kono
parents:
diff changeset
113 CFLAGS="$CFLAGS -funwind-tables"
kono
parents:
diff changeset
114 AC_COMPILE_IFELSE(
kono
parents:
diff changeset
115 [AC_LANG_PROGRAM([static int f() { return 0; }], [return f();])],
kono
parents:
diff changeset
116 [libbacktrace_cv_c_unwind_tables=yes],
kono
parents:
diff changeset
117 [libbacktrace_cv_c_unwind_tables=no])
kono
parents:
diff changeset
118 CFLAGS="$CFLAGS_hold"])
kono
parents:
diff changeset
119 if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
kono
parents:
diff changeset
120 EXTRA_FLAGS=-funwind-tables
kono
parents:
diff changeset
121 fi
kono
parents:
diff changeset
122 AC_CACHE_CHECK([for -frandom-seed=string option],
kono
parents:
diff changeset
123 [libbacktrace_cv_c_random_seed_string],
kono
parents:
diff changeset
124 [CFLAGS_hold="$CFLAGS"
kono
parents:
diff changeset
125 CFLAGS="$CFLAGS -frandom-seed=conftest.lo"
kono
parents:
diff changeset
126 AC_COMPILE_IFELSE(
kono
parents:
diff changeset
127 [AC_LANG_PROGRAM([], [return 0;])],
kono
parents:
diff changeset
128 [libbacktrace_cv_c_random_seed_string=yes],
kono
parents:
diff changeset
129 [libbacktrace_cv_c_random_seed_string=no])
kono
parents:
diff changeset
130 CFLAGS="$CFLAGS_hold"])
kono
parents:
diff changeset
131 if test "$libbacktrace_cv_c_random_seed_string" = "yes"; then
kono
parents:
diff changeset
132 EXTRA_FLAGS="$EXTRA_FLAGS -frandom-seed=\$@"
kono
parents:
diff changeset
133 fi
kono
parents:
diff changeset
134 fi
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
135
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
136 if test -n "${with_target_subdir}"; then
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
137 # Add CET specific flags is Intel CET is enabled.
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
138 GCC_CET_FLAGS(CET_FLAGS)
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
139 EXTRA_FLAGS="$EXTRA_FLAGS $CET_FLAGS"
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
140 fi
111
kono
parents:
diff changeset
141 AC_SUBST(EXTRA_FLAGS)
kono
parents:
diff changeset
142
kono
parents:
diff changeset
143 ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
kono
parents:
diff changeset
144 -Wmissing-prototypes -Wold-style-definition \
kono
parents:
diff changeset
145 -Wmissing-format-attribute -Wcast-qual],
kono
parents:
diff changeset
146 [WARN_FLAGS])
kono
parents:
diff changeset
147
kono
parents:
diff changeset
148 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
149 WARN_FLAGS="$WARN_FLAGS -Werror"
kono
parents:
diff changeset
150 fi
kono
parents:
diff changeset
151
kono
parents:
diff changeset
152 AC_SUBST(WARN_FLAGS)
kono
parents:
diff changeset
153
kono
parents:
diff changeset
154 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
155 GCC_CHECK_UNWIND_GETIPINFO
kono
parents:
diff changeset
156 else
kono
parents:
diff changeset
157 ac_save_CFFLAGS="$CFLAGS"
kono
parents:
diff changeset
158 CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
kono
parents:
diff changeset
159 AC_MSG_CHECKING([for _Unwind_GetIPInfo])
kono
parents:
diff changeset
160 AC_LINK_IFELSE(
kono
parents:
diff changeset
161 [AC_LANG_PROGRAM(
kono
parents:
diff changeset
162 [#include "unwind.h"
kono
parents:
diff changeset
163 struct _Unwind_Context *context;
kono
parents:
diff changeset
164 int ip_before_insn = 0;],
kono
parents:
diff changeset
165 [return _Unwind_GetIPInfo (context, &ip_before_insn);])],
kono
parents:
diff changeset
166 [have_unwind_getipinfo=yes], [have_unwind_getipinfo=no])
kono
parents:
diff changeset
167 CFLAGS="$ac_save_CFLAGS"
kono
parents:
diff changeset
168 AC_MSG_RESULT([$have_unwind_getipinfo])
kono
parents:
diff changeset
169 if test "$have_unwind_getipinfo" = "yes"; then
kono
parents:
diff changeset
170 AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
kono
parents:
diff changeset
171 fi
kono
parents:
diff changeset
172 fi
kono
parents:
diff changeset
173
kono
parents:
diff changeset
174 # Enable --enable-host-shared.
kono
parents:
diff changeset
175 AC_ARG_ENABLE(host-shared,
kono
parents:
diff changeset
176 [AS_HELP_STRING([--enable-host-shared],
kono
parents:
diff changeset
177 [build host code as shared libraries])],
kono
parents:
diff changeset
178 [PIC_FLAG=-fPIC], [PIC_FLAG=])
kono
parents:
diff changeset
179 AC_SUBST(PIC_FLAG)
kono
parents:
diff changeset
180
kono
parents:
diff changeset
181 # Test for __sync support.
kono
parents:
diff changeset
182 AC_CACHE_CHECK([__sync extensions],
kono
parents:
diff changeset
183 [libbacktrace_cv_sys_sync],
kono
parents:
diff changeset
184 [if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
185 case "${host}" in
kono
parents:
diff changeset
186 hppa*-*-hpux*) libbacktrace_cv_sys_sync=no ;;
kono
parents:
diff changeset
187 *) libbacktrace_cv_sys_sync=yes ;;
kono
parents:
diff changeset
188 esac
kono
parents:
diff changeset
189 else
kono
parents:
diff changeset
190 AC_LINK_IFELSE(
kono
parents:
diff changeset
191 [AC_LANG_PROGRAM([int i;],
kono
parents:
diff changeset
192 [__sync_bool_compare_and_swap (&i, i, i);
kono
parents:
diff changeset
193 __sync_lock_test_and_set (&i, 1);
kono
parents:
diff changeset
194 __sync_lock_release (&i);])],
kono
parents:
diff changeset
195 [libbacktrace_cv_sys_sync=yes],
kono
parents:
diff changeset
196 [libbacktrace_cv_sys_sync=no])
kono
parents:
diff changeset
197 fi])
kono
parents:
diff changeset
198 BACKTRACE_SUPPORTS_THREADS=0
kono
parents:
diff changeset
199 if test "$libbacktrace_cv_sys_sync" = "yes"; then
kono
parents:
diff changeset
200 BACKTRACE_SUPPORTS_THREADS=1
kono
parents:
diff changeset
201 AC_DEFINE([HAVE_SYNC_FUNCTIONS], 1,
kono
parents:
diff changeset
202 [Define to 1 if you have the __sync functions])
kono
parents:
diff changeset
203 fi
kono
parents:
diff changeset
204 AC_SUBST(BACKTRACE_SUPPORTS_THREADS)
kono
parents:
diff changeset
205
kono
parents:
diff changeset
206 # Test for __atomic support.
kono
parents:
diff changeset
207 AC_CACHE_CHECK([__atomic extensions],
kono
parents:
diff changeset
208 [libbacktrace_cv_sys_atomic],
kono
parents:
diff changeset
209 [if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
210 libbacktrace_cv_sys_atomic=yes
kono
parents:
diff changeset
211 else
kono
parents:
diff changeset
212 AC_LINK_IFELSE(
kono
parents:
diff changeset
213 [AC_LANG_PROGRAM([int i;],
kono
parents:
diff changeset
214 [__atomic_load_n (&i, __ATOMIC_ACQUIRE);
kono
parents:
diff changeset
215 __atomic_store_n (&i, 1, __ATOMIC_RELEASE);])],
kono
parents:
diff changeset
216 [libbacktrace_cv_sys_atomic=yes],
kono
parents:
diff changeset
217 [libbacktrace_cv_sys_atomic=no])
kono
parents:
diff changeset
218 fi])
kono
parents:
diff changeset
219 if test "$libbacktrace_cv_sys_atomic" = "yes"; then
kono
parents:
diff changeset
220 AC_DEFINE([HAVE_ATOMIC_FUNCTIONS], 1,
kono
parents:
diff changeset
221 [Define to 1 if you have the __atomic functions])
kono
parents:
diff changeset
222 fi
kono
parents:
diff changeset
223
kono
parents:
diff changeset
224 # The library needs to be able to read the executable itself. Compile
kono
parents:
diff changeset
225 # a file to determine the executable format. The awk script
kono
parents:
diff changeset
226 # filetype.awk prints out the file type.
kono
parents:
diff changeset
227 AC_CACHE_CHECK([output filetype],
kono
parents:
diff changeset
228 [libbacktrace_cv_sys_filetype],
kono
parents:
diff changeset
229 [filetype=
kono
parents:
diff changeset
230 AC_COMPILE_IFELSE(
kono
parents:
diff changeset
231 [AC_LANG_PROGRAM([int i;], [int j;])],
kono
parents:
diff changeset
232 [filetype=`${AWK} -f $srcdir/filetype.awk conftest.$ac_objext`],
kono
parents:
diff changeset
233 [AC_MSG_FAILURE([compiler failed])])
kono
parents:
diff changeset
234 libbacktrace_cv_sys_filetype=$filetype])
kono
parents:
diff changeset
235
kono
parents:
diff changeset
236 # Match the file type to decide what files to compile.
kono
parents:
diff changeset
237 FORMAT_FILE=
kono
parents:
diff changeset
238 backtrace_supports_data=yes
kono
parents:
diff changeset
239 case "$libbacktrace_cv_sys_filetype" in
kono
parents:
diff changeset
240 elf*) FORMAT_FILE="elf.lo" ;;
kono
parents:
diff changeset
241 pecoff) FORMAT_FILE="pecoff.lo"
kono
parents:
diff changeset
242 backtrace_supports_data=no
kono
parents:
diff changeset
243 ;;
kono
parents:
diff changeset
244 xcoff*) FORMAT_FILE="xcoff.lo"
kono
parents:
diff changeset
245 backtrace_supports_data=no
kono
parents:
diff changeset
246 ;;
kono
parents:
diff changeset
247 *) AC_MSG_WARN([could not determine output file type])
kono
parents:
diff changeset
248 FORMAT_FILE="unknown.lo"
kono
parents:
diff changeset
249 backtrace_supported=no
kono
parents:
diff changeset
250 ;;
kono
parents:
diff changeset
251 esac
kono
parents:
diff changeset
252 AC_SUBST(FORMAT_FILE)
kono
parents:
diff changeset
253
kono
parents:
diff changeset
254 # ELF defines.
kono
parents:
diff changeset
255 elfsize=
kono
parents:
diff changeset
256 case "$libbacktrace_cv_sys_filetype" in
kono
parents:
diff changeset
257 elf32) elfsize=32 ;;
kono
parents:
diff changeset
258 elf64) elfsize=64 ;;
kono
parents:
diff changeset
259 *) elfsize=unused
kono
parents:
diff changeset
260 esac
kono
parents:
diff changeset
261 AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64])
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
262 AM_CONDITIONAL(HAVE_ELF, test "$FORMAT_FILE" = "elf.lo")
111
kono
parents:
diff changeset
263
kono
parents:
diff changeset
264 # XCOFF defines.
kono
parents:
diff changeset
265 xcoffsize=
kono
parents:
diff changeset
266 case "$libbacktrace_cv_sys_filetype" in
kono
parents:
diff changeset
267 xcoff32) xcoffsize=32 ;;
kono
parents:
diff changeset
268 xcoff64) xcoffsize=64 ;;
kono
parents:
diff changeset
269 *) xcoffsize=unused
kono
parents:
diff changeset
270 esac
kono
parents:
diff changeset
271 AC_DEFINE_UNQUOTED([BACKTRACE_XCOFF_SIZE], [$xcoffsize], [XCOFF size: 32 or 64])
kono
parents:
diff changeset
272
kono
parents:
diff changeset
273 BACKTRACE_SUPPORTED=0
kono
parents:
diff changeset
274 if test "$backtrace_supported" = "yes"; then
kono
parents:
diff changeset
275 BACKTRACE_SUPPORTED=1
kono
parents:
diff changeset
276 fi
kono
parents:
diff changeset
277 AC_SUBST(BACKTRACE_SUPPORTED)
kono
parents:
diff changeset
278
kono
parents:
diff changeset
279 BACKTRACE_SUPPORTS_DATA=0
kono
parents:
diff changeset
280 if test "$backtrace_supports_data" = "yes"; then
kono
parents:
diff changeset
281 BACKTRACE_SUPPORTS_DATA=1
kono
parents:
diff changeset
282 fi
kono
parents:
diff changeset
283 AC_SUBST(BACKTRACE_SUPPORTS_DATA)
kono
parents:
diff changeset
284
kono
parents:
diff changeset
285 GCC_HEADER_STDINT(gstdint.h)
kono
parents:
diff changeset
286
kono
parents:
diff changeset
287 AC_CHECK_HEADERS(sys/mman.h)
kono
parents:
diff changeset
288 if test "$ac_cv_header_sys_mman_h" = "no"; then
kono
parents:
diff changeset
289 have_mmap=no
kono
parents:
diff changeset
290 else
kono
parents:
diff changeset
291 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
292 # When built as a GCC target library, we can't do a link test. We
kono
parents:
diff changeset
293 # simply assume that if we have mman.h, we have mmap.
kono
parents:
diff changeset
294 have_mmap=yes
kono
parents:
diff changeset
295 case "${host}" in
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
296 *-*-msdosdjgpp)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
297 # DJGPP has sys/man.h, but no mmap
111
kono
parents:
diff changeset
298 have_mmap=no ;;
kono
parents:
diff changeset
299 esac
kono
parents:
diff changeset
300 else
kono
parents:
diff changeset
301 AC_CHECK_FUNC(mmap, [have_mmap=yes], [have_mmap=no])
kono
parents:
diff changeset
302 fi
kono
parents:
diff changeset
303 fi
kono
parents:
diff changeset
304 if test "$have_mmap" = "no"; then
kono
parents:
diff changeset
305 VIEW_FILE=read.lo
kono
parents:
diff changeset
306 ALLOC_FILE=alloc.lo
kono
parents:
diff changeset
307 else
kono
parents:
diff changeset
308 VIEW_FILE=mmapio.lo
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
309 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
111
kono
parents:
diff changeset
310 #include <sys/mman.h>
kono
parents:
diff changeset
311 #if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
kono
parents:
diff changeset
312 #error no MAP_ANONYMOUS
kono
parents:
diff changeset
313 #endif
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
314 ])], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo])
111
kono
parents:
diff changeset
315 fi
kono
parents:
diff changeset
316 AC_SUBST(VIEW_FILE)
kono
parents:
diff changeset
317 AC_SUBST(ALLOC_FILE)
kono
parents:
diff changeset
318
kono
parents:
diff changeset
319 BACKTRACE_USES_MALLOC=0
kono
parents:
diff changeset
320 if test "$ALLOC_FILE" = "alloc.lo"; then
kono
parents:
diff changeset
321 BACKTRACE_USES_MALLOC=1
kono
parents:
diff changeset
322 fi
kono
parents:
diff changeset
323 AC_SUBST(BACKTRACE_USES_MALLOC)
kono
parents:
diff changeset
324
kono
parents:
diff changeset
325 # Check for dl_iterate_phdr.
kono
parents:
diff changeset
326 AC_CHECK_HEADERS(link.h)
kono
parents:
diff changeset
327 if test "$ac_cv_header_link_h" = "no"; then
kono
parents:
diff changeset
328 have_dl_iterate_phdr=no
kono
parents:
diff changeset
329 else
kono
parents:
diff changeset
330 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
331 # When built as a GCC target library, we can't do a link test.
kono
parents:
diff changeset
332 AC_EGREP_HEADER([dl_iterate_phdr], [link.h], [have_dl_iterate_phdr=yes],
kono
parents:
diff changeset
333 [have_dl_iterate_phdr=no])
kono
parents:
diff changeset
334 else
kono
parents:
diff changeset
335 AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes],
kono
parents:
diff changeset
336 [have_dl_iterate_phdr=no])
kono
parents:
diff changeset
337 fi
kono
parents:
diff changeset
338 fi
kono
parents:
diff changeset
339 if test "$have_dl_iterate_phdr" = "yes"; then
kono
parents:
diff changeset
340 AC_DEFINE(HAVE_DL_ITERATE_PHDR, 1, [Define if dl_iterate_phdr is available.])
kono
parents:
diff changeset
341 fi
kono
parents:
diff changeset
342
kono
parents:
diff changeset
343 # Check for loadquery.
kono
parents:
diff changeset
344 AC_CHECK_HEADERS(sys/ldr.h)
kono
parents:
diff changeset
345 if test "$ac_cv_header_sys_ldr_h" = "no"; then
kono
parents:
diff changeset
346 have_loadquery=no
kono
parents:
diff changeset
347 else
kono
parents:
diff changeset
348 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
349 # When built as a GCC target library, we can't do a link test.
kono
parents:
diff changeset
350 AC_EGREP_HEADER([loadquery], [sys/ldr.h], [have_loadquery=yes],
kono
parents:
diff changeset
351 [have_loadquery=no])
kono
parents:
diff changeset
352 else
kono
parents:
diff changeset
353 AC_CHECK_FUNC([loadquery], [have_loadquery=yes],
kono
parents:
diff changeset
354 [have_loadquery=no])
kono
parents:
diff changeset
355 fi
kono
parents:
diff changeset
356 fi
kono
parents:
diff changeset
357 if test "$have_loadquery" = "yes"; then
kono
parents:
diff changeset
358 AC_DEFINE(HAVE_LOADQUERY, 1, [Define if AIX loadquery is available.])
kono
parents:
diff changeset
359 fi
kono
parents:
diff changeset
360
kono
parents:
diff changeset
361 # Check for the fcntl function.
kono
parents:
diff changeset
362 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
363 case "${host}" in
kono
parents:
diff changeset
364 *-*-mingw*) have_fcntl=no ;;
kono
parents:
diff changeset
365 *) have_fcntl=yes ;;
kono
parents:
diff changeset
366 esac
kono
parents:
diff changeset
367 else
kono
parents:
diff changeset
368 AC_CHECK_FUNC(fcntl, [have_fcntl=yes], [have_fcntl=no])
kono
parents:
diff changeset
369 fi
kono
parents:
diff changeset
370 if test "$have_fcntl" = "yes"; then
kono
parents:
diff changeset
371 AC_DEFINE([HAVE_FCNTL], 1,
kono
parents:
diff changeset
372 [Define to 1 if you have the fcntl function])
kono
parents:
diff changeset
373 fi
kono
parents:
diff changeset
374
kono
parents:
diff changeset
375 AC_CHECK_DECLS(strnlen)
kono
parents:
diff changeset
376 AC_CHECK_FUNCS(lstat readlink)
kono
parents:
diff changeset
377
kono
parents:
diff changeset
378 # Check for getexecname function.
kono
parents:
diff changeset
379 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
380 case "${host}" in
kono
parents:
diff changeset
381 *-*-solaris2*) have_getexecname=yes ;;
kono
parents:
diff changeset
382 *) have_getexecname=no ;;
kono
parents:
diff changeset
383 esac
kono
parents:
diff changeset
384 else
kono
parents:
diff changeset
385 AC_CHECK_FUNC(getexecname, [have_getexecname=yes], [have_getexecname=no])
kono
parents:
diff changeset
386 fi
kono
parents:
diff changeset
387 if test "$have_getexecname" = "yes"; then
kono
parents:
diff changeset
388 AC_DEFINE(HAVE_GETEXECNAME, 1, [Define if getexecname is available.])
kono
parents:
diff changeset
389 fi
kono
parents:
diff changeset
390
kono
parents:
diff changeset
391 # Check for the clock_gettime function.
kono
parents:
diff changeset
392 AC_CHECK_FUNCS(clock_gettime)
kono
parents:
diff changeset
393 clock_gettime_link=
kono
parents:
diff changeset
394 # At least for glibc, clock_gettime is in librt. But don't
kono
parents:
diff changeset
395 # pull that in if it still doesn't give us the function we want. This
kono
parents:
diff changeset
396 # test is copied from libgomp, and modified to not link in -lrt as
kono
parents:
diff changeset
397 # we're using this for test timing only.
kono
parents:
diff changeset
398 if test "$ac_cv_func_clock_gettime" = no; then
kono
parents:
diff changeset
399 AC_CHECK_LIB(rt, clock_gettime,
kono
parents:
diff changeset
400 [CLOCK_GETTIME_LINK=-lrt
kono
parents:
diff changeset
401 AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
kono
parents:
diff changeset
402 [Define to 1 if you have the `clock_gettime' function.])])
kono
parents:
diff changeset
403 fi
kono
parents:
diff changeset
404 AC_SUBST(CLOCK_GETTIME_LINK)
kono
parents:
diff changeset
405
kono
parents:
diff changeset
406 dnl Test whether the compiler supports the -pthread option.
kono
parents:
diff changeset
407 AC_CACHE_CHECK([whether -pthread is supported],
kono
parents:
diff changeset
408 [libgo_cv_lib_pthread],
kono
parents:
diff changeset
409 [CFLAGS_hold=$CFLAGS
kono
parents:
diff changeset
410 CFLAGS="$CFLAGS -pthread"
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
411 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
111
kono
parents:
diff changeset
412 [libgo_cv_lib_pthread=yes],
kono
parents:
diff changeset
413 [libgo_cv_lib_pthread=no])
kono
parents:
diff changeset
414 CFLAGS=$CFLAGS_hold])
kono
parents:
diff changeset
415 PTHREAD_CFLAGS=
kono
parents:
diff changeset
416 if test "$libgo_cv_lib_pthread" = yes; then
kono
parents:
diff changeset
417 PTHREAD_CFLAGS=-pthread
kono
parents:
diff changeset
418 fi
kono
parents:
diff changeset
419 AC_SUBST(PTHREAD_CFLAGS)
kono
parents:
diff changeset
420
kono
parents:
diff changeset
421 AM_CONDITIONAL(HAVE_PTHREAD, test "$libgo_cv_lib_pthread" = yes)
kono
parents:
diff changeset
422
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
423 dnl Test whether the compiler supports the -gdwarf-5 option.
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
424 AC_CACHE_CHECK([whether -gdwarf-5 is supported],
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
425 [libbacktrace_cv_lib_dwarf5],
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
426 [CFLAGS_hold=$CFLAGS
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
427 CFLAGS="$CFLAGS -gdwarf-5"
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
428 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
429 [libbacktrace_cv_lib_dwarf5=yes],
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
430 [libbacktrace_cv_lib_dwarf5=no])
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
431 CFLAGS=$CFLAGS_hold])
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
432 AM_CONDITIONAL(HAVE_DWARF5, test "$libbacktrace_cv_lib_dwarf5" = yes)
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
433
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
434 AC_CHECK_LIB([z], [compress],
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
435 [AC_DEFINE(HAVE_ZLIB, 1, [Define if -lz is available.])])
111
kono
parents:
diff changeset
436 AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_lib_z_compress" = yes)
kono
parents:
diff changeset
437
kono
parents:
diff changeset
438 dnl Test whether the linker supports the --compress_debug_sections option.
kono
parents:
diff changeset
439 AC_CACHE_CHECK([whether --compress-debug-sections is supported],
kono
parents:
diff changeset
440 [libgo_cv_ld_compress],
kono
parents:
diff changeset
441 [LDFLAGS_hold=$LDFLAGS
kono
parents:
diff changeset
442 LDFLAGS="$LDFLAGS -Wl,--compress-debug-sections=zlib-gnu"
kono
parents:
diff changeset
443 AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
kono
parents:
diff changeset
444 [libgo_cv_ld_compress=yes],
kono
parents:
diff changeset
445 [libgo_cv_ld_compress=no])
kono
parents:
diff changeset
446 LDFLAGS=$LDFLAGS_hold])
kono
parents:
diff changeset
447 AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG, test "$libgo_cv_ld_compress" = yes)
kono
parents:
diff changeset
448
kono
parents:
diff changeset
449 AC_ARG_VAR(OBJCOPY, [location of objcopy])
kono
parents:
diff changeset
450 AC_CHECK_PROG(OBJCOPY, objcopy, objcopy,)
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
451 AC_CHECK_PROG(READELF, readelf, readelf)
111
kono
parents:
diff changeset
452 AC_CACHE_CHECK([whether objcopy supports debuglink],
kono
parents:
diff changeset
453 [libbacktrace_cv_objcopy_debuglink],
kono
parents:
diff changeset
454 [if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
455 libbacktrace_cv_objcopy_debuglink=no
kono
parents:
diff changeset
456 elif ${OBJCOPY} --add-gnu-debuglink=x /bin/ls /tmp/ls$$; then
kono
parents:
diff changeset
457 rm -f /tmp/ls$$
kono
parents:
diff changeset
458 libbacktrace_cv_objcopy_debuglink=yes
kono
parents:
diff changeset
459 else
kono
parents:
diff changeset
460 libbacktrace_cv_objcopy_debuglink=no
kono
parents:
diff changeset
461 fi])
kono
parents:
diff changeset
462 AM_CONDITIONAL(HAVE_OBJCOPY_DEBUGLINK, test "$libbacktrace_cv_objcopy_debuglink" = yes)
kono
parents:
diff changeset
463
kono
parents:
diff changeset
464 AC_CACHE_CHECK([whether tests can run],
kono
parents:
diff changeset
465 [libbacktrace_cv_sys_native],
kono
parents:
diff changeset
466 [AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
kono
parents:
diff changeset
467 [libbacktrace_cv_sys_native=yes],
kono
parents:
diff changeset
468 [libbacktrace_cv_sys_native=no],
kono
parents:
diff changeset
469 [libbacktrace_cv_sys_native=no])])
kono
parents:
diff changeset
470 AM_CONDITIONAL(NATIVE, test "$libbacktrace_cv_sys_native" = "yes")
kono
parents:
diff changeset
471
kono
parents:
diff changeset
472 if test "${multilib}" = "yes"; then
kono
parents:
diff changeset
473 multilib_arg="--enable-multilib"
kono
parents:
diff changeset
474 else
kono
parents:
diff changeset
475 multilib_arg=
kono
parents:
diff changeset
476 fi
kono
parents:
diff changeset
477
kono
parents:
diff changeset
478 AC_CONFIG_FILES(Makefile backtrace-supported.h)
145
1830386684a0 gcc-9.2.0
anatofuz
parents: 131
diff changeset
479 AC_CONFIG_FILES(install-debuginfo-for-buildid.sh, chmod +x install-debuginfo-for-buildid.sh)
111
kono
parents:
diff changeset
480
kono
parents:
diff changeset
481 # We need multilib support, but only if configuring for the target.
kono
parents:
diff changeset
482 AC_CONFIG_COMMANDS([default],
kono
parents:
diff changeset
483 [if test -n "$CONFIG_FILES"; then
kono
parents:
diff changeset
484 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
485 # Multilibs need MULTISUBDIR defined correctly in certain makefiles so
kono
parents:
diff changeset
486 # that multilib installs will end up installed in the correct place.
kono
parents:
diff changeset
487 # The testsuite needs it for multilib-aware ABI baseline files.
kono
parents:
diff changeset
488 # To work around this not being passed down from config-ml.in ->
kono
parents:
diff changeset
489 # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually
kono
parents:
diff changeset
490 # append it here. Only modify Makefiles that have just been created.
kono
parents:
diff changeset
491 #
kono
parents:
diff changeset
492 # Also, get rid of this simulated-VPATH thing that automake does.
kono
parents:
diff changeset
493 cat > vpsed << \_EOF
kono
parents:
diff changeset
494 s!`test -f '$<' || echo '$(srcdir)/'`!!
kono
parents:
diff changeset
495 _EOF
kono
parents:
diff changeset
496 for i in $SUBDIRS; do
kono
parents:
diff changeset
497 case $CONFIG_FILES in
kono
parents:
diff changeset
498 *${i}/Makefile*)
kono
parents:
diff changeset
499 #echo "Adding MULTISUBDIR to $i/Makefile"
kono
parents:
diff changeset
500 sed -f vpsed $i/Makefile > tmp
kono
parents:
diff changeset
501 grep '^MULTISUBDIR =' Makefile >> tmp
kono
parents:
diff changeset
502 mv tmp $i/Makefile
kono
parents:
diff changeset
503 ;;
kono
parents:
diff changeset
504 esac
kono
parents:
diff changeset
505 done
kono
parents:
diff changeset
506 rm vpsed
kono
parents:
diff changeset
507 fi
kono
parents:
diff changeset
508 fi
kono
parents:
diff changeset
509 ],
kono
parents:
diff changeset
510 [
kono
parents:
diff changeset
511 # Variables needed in config.status (file generation) which aren't already
kono
parents:
diff changeset
512 # passed by autoconf.
kono
parents:
diff changeset
513 SUBDIRS="$SUBDIRS"
kono
parents:
diff changeset
514 ])
kono
parents:
diff changeset
515
kono
parents:
diff changeset
516 AC_OUTPUT