annotate libbacktrace/configure.ac @ 118:fd00160c1b76

ifdef TARGET_64BIT
author mir3636
date Tue, 27 Feb 2018 15:01:35 +0900
parents 04ced10e8804
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 # configure.ac -- Backtrace configure script.
kono
parents:
diff changeset
2 # Copyright (C) 2012-2017 Free Software Foundation, Inc.
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_PREREQ(2.64)
kono
parents:
diff changeset
33 AC_INIT(package-unused, version-unused,, libbacktrace)
kono
parents:
diff changeset
34 AC_CONFIG_SRCDIR(backtrace.h)
kono
parents:
diff changeset
35 AC_CONFIG_HEADER(config.h)
kono
parents:
diff changeset
36
kono
parents:
diff changeset
37 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
38 AM_ENABLE_MULTILIB(, ..)
kono
parents:
diff changeset
39 fi
kono
parents:
diff changeset
40
kono
parents:
diff changeset
41 AC_CANONICAL_SYSTEM
kono
parents:
diff changeset
42 target_alias=${target_alias-$host_alias}
kono
parents:
diff changeset
43
kono
parents:
diff changeset
44 AC_USE_SYSTEM_EXTENSIONS
kono
parents:
diff changeset
45
kono
parents:
diff changeset
46 libtool_VERSION=1:0:0
kono
parents:
diff changeset
47 AC_SUBST(libtool_VERSION)
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 # 1.11.1: Require that version of automake.
kono
parents:
diff changeset
50 # foreign: Don't require README, INSTALL, NEWS, etc.
kono
parents:
diff changeset
51 # no-define: Don't define PACKAGE and VERSION.
kono
parents:
diff changeset
52 # no-dependencies: Don't generate automatic dependencies.
kono
parents:
diff changeset
53 # (because it breaks when using bootstrap-lean, since some of the
kono
parents:
diff changeset
54 # headers are gone at "make install" time).
kono
parents:
diff changeset
55 # -Wall: Issue all automake warnings.
kono
parents:
diff changeset
56 # -Wno-portability: Don't warn about constructs supported by GNU make.
kono
parents:
diff changeset
57 # (because GCC requires GNU make anyhow).
kono
parents:
diff changeset
58 AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define no-dependencies -Wall -Wno-portability])
kono
parents:
diff changeset
59
kono
parents:
diff changeset
60 AM_MAINTAINER_MODE
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 AC_ARG_WITH(target-subdir,
kono
parents:
diff changeset
63 [ --with-target-subdir=SUBDIR Configuring in a subdirectory for target])
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 # We must force CC to /not/ be precious variables; otherwise
kono
parents:
diff changeset
66 # the wrong, non-multilib-adjusted value will be used in multilibs.
kono
parents:
diff changeset
67 # As a side effect, we have to subst CFLAGS ourselves.
kono
parents:
diff changeset
68 m4_rename([_AC_ARG_VAR_PRECIOUS],[backtrace_PRECIOUS])
kono
parents:
diff changeset
69 m4_define([_AC_ARG_VAR_PRECIOUS],[])
kono
parents:
diff changeset
70 AC_PROG_CC
kono
parents:
diff changeset
71 m4_rename_force([backtrace_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
kono
parents:
diff changeset
72
kono
parents:
diff changeset
73 AC_SUBST(CFLAGS)
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 AC_PROG_RANLIB
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 AC_PROG_AWK
kono
parents:
diff changeset
78 case "$AWK" in
kono
parents:
diff changeset
79 "") AC_MSG_ERROR([can't build without awk]) ;;
kono
parents:
diff changeset
80 esac
kono
parents:
diff changeset
81
kono
parents:
diff changeset
82 LT_INIT
kono
parents:
diff changeset
83 AM_PROG_LIBTOOL
kono
parents:
diff changeset
84
kono
parents:
diff changeset
85 AC_SYS_LARGEFILE
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 backtrace_supported=yes
kono
parents:
diff changeset
88
kono
parents:
diff changeset
89 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
90 # We are compiling a GCC library. We can assume that the unwind
kono
parents:
diff changeset
91 # library exists.
kono
parents:
diff changeset
92 BACKTRACE_FILE="backtrace.lo simple.lo"
kono
parents:
diff changeset
93 else
kono
parents:
diff changeset
94 AC_CHECK_HEADER([unwind.h],
kono
parents:
diff changeset
95 [AC_CHECK_FUNC([_Unwind_Backtrace],
kono
parents:
diff changeset
96 [BACKTRACE_FILE="backtrace.lo simple.lo"],
kono
parents:
diff changeset
97 [BACKTRACE_FILE="nounwind.lo"
kono
parents:
diff changeset
98 backtrace_supported=no])],
kono
parents:
diff changeset
99 [BACKTRACE_FILE="nounwind.lo"
kono
parents:
diff changeset
100 backtrace_supported=no])
kono
parents:
diff changeset
101 fi
kono
parents:
diff changeset
102 AC_SUBST(BACKTRACE_FILE)
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104 EXTRA_FLAGS=
kono
parents:
diff changeset
105 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
106 EXTRA_FLAGS="-funwind-tables -frandom-seed=\$@"
kono
parents:
diff changeset
107 else
kono
parents:
diff changeset
108 AC_CACHE_CHECK([for -funwind-tables option],
kono
parents:
diff changeset
109 [libbacktrace_cv_c_unwind_tables],
kono
parents:
diff changeset
110 [CFLAGS_hold="$CFLAGS"
kono
parents:
diff changeset
111 CFLAGS="$CFLAGS -funwind-tables"
kono
parents:
diff changeset
112 AC_COMPILE_IFELSE(
kono
parents:
diff changeset
113 [AC_LANG_PROGRAM([static int f() { return 0; }], [return f();])],
kono
parents:
diff changeset
114 [libbacktrace_cv_c_unwind_tables=yes],
kono
parents:
diff changeset
115 [libbacktrace_cv_c_unwind_tables=no])
kono
parents:
diff changeset
116 CFLAGS="$CFLAGS_hold"])
kono
parents:
diff changeset
117 if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
kono
parents:
diff changeset
118 EXTRA_FLAGS=-funwind-tables
kono
parents:
diff changeset
119 fi
kono
parents:
diff changeset
120 AC_CACHE_CHECK([for -frandom-seed=string option],
kono
parents:
diff changeset
121 [libbacktrace_cv_c_random_seed_string],
kono
parents:
diff changeset
122 [CFLAGS_hold="$CFLAGS"
kono
parents:
diff changeset
123 CFLAGS="$CFLAGS -frandom-seed=conftest.lo"
kono
parents:
diff changeset
124 AC_COMPILE_IFELSE(
kono
parents:
diff changeset
125 [AC_LANG_PROGRAM([], [return 0;])],
kono
parents:
diff changeset
126 [libbacktrace_cv_c_random_seed_string=yes],
kono
parents:
diff changeset
127 [libbacktrace_cv_c_random_seed_string=no])
kono
parents:
diff changeset
128 CFLAGS="$CFLAGS_hold"])
kono
parents:
diff changeset
129 if test "$libbacktrace_cv_c_random_seed_string" = "yes"; then
kono
parents:
diff changeset
130 EXTRA_FLAGS="$EXTRA_FLAGS -frandom-seed=\$@"
kono
parents:
diff changeset
131 fi
kono
parents:
diff changeset
132 fi
kono
parents:
diff changeset
133 AC_SUBST(EXTRA_FLAGS)
kono
parents:
diff changeset
134
kono
parents:
diff changeset
135 ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
kono
parents:
diff changeset
136 -Wmissing-prototypes -Wold-style-definition \
kono
parents:
diff changeset
137 -Wmissing-format-attribute -Wcast-qual],
kono
parents:
diff changeset
138 [WARN_FLAGS])
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
141 WARN_FLAGS="$WARN_FLAGS -Werror"
kono
parents:
diff changeset
142 fi
kono
parents:
diff changeset
143
kono
parents:
diff changeset
144 AC_SUBST(WARN_FLAGS)
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
147 GCC_CHECK_UNWIND_GETIPINFO
kono
parents:
diff changeset
148 else
kono
parents:
diff changeset
149 ac_save_CFFLAGS="$CFLAGS"
kono
parents:
diff changeset
150 CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
kono
parents:
diff changeset
151 AC_MSG_CHECKING([for _Unwind_GetIPInfo])
kono
parents:
diff changeset
152 AC_LINK_IFELSE(
kono
parents:
diff changeset
153 [AC_LANG_PROGRAM(
kono
parents:
diff changeset
154 [#include "unwind.h"
kono
parents:
diff changeset
155 struct _Unwind_Context *context;
kono
parents:
diff changeset
156 int ip_before_insn = 0;],
kono
parents:
diff changeset
157 [return _Unwind_GetIPInfo (context, &ip_before_insn);])],
kono
parents:
diff changeset
158 [have_unwind_getipinfo=yes], [have_unwind_getipinfo=no])
kono
parents:
diff changeset
159 CFLAGS="$ac_save_CFLAGS"
kono
parents:
diff changeset
160 AC_MSG_RESULT([$have_unwind_getipinfo])
kono
parents:
diff changeset
161 if test "$have_unwind_getipinfo" = "yes"; then
kono
parents:
diff changeset
162 AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
kono
parents:
diff changeset
163 fi
kono
parents:
diff changeset
164 fi
kono
parents:
diff changeset
165
kono
parents:
diff changeset
166 # Enable --enable-host-shared.
kono
parents:
diff changeset
167 AC_ARG_ENABLE(host-shared,
kono
parents:
diff changeset
168 [AS_HELP_STRING([--enable-host-shared],
kono
parents:
diff changeset
169 [build host code as shared libraries])],
kono
parents:
diff changeset
170 [PIC_FLAG=-fPIC], [PIC_FLAG=])
kono
parents:
diff changeset
171 AC_SUBST(PIC_FLAG)
kono
parents:
diff changeset
172
kono
parents:
diff changeset
173 # Test for __sync support.
kono
parents:
diff changeset
174 AC_CACHE_CHECK([__sync extensions],
kono
parents:
diff changeset
175 [libbacktrace_cv_sys_sync],
kono
parents:
diff changeset
176 [if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
177 case "${host}" in
kono
parents:
diff changeset
178 hppa*-*-hpux*) libbacktrace_cv_sys_sync=no ;;
kono
parents:
diff changeset
179 *) libbacktrace_cv_sys_sync=yes ;;
kono
parents:
diff changeset
180 esac
kono
parents:
diff changeset
181 else
kono
parents:
diff changeset
182 AC_LINK_IFELSE(
kono
parents:
diff changeset
183 [AC_LANG_PROGRAM([int i;],
kono
parents:
diff changeset
184 [__sync_bool_compare_and_swap (&i, i, i);
kono
parents:
diff changeset
185 __sync_lock_test_and_set (&i, 1);
kono
parents:
diff changeset
186 __sync_lock_release (&i);])],
kono
parents:
diff changeset
187 [libbacktrace_cv_sys_sync=yes],
kono
parents:
diff changeset
188 [libbacktrace_cv_sys_sync=no])
kono
parents:
diff changeset
189 fi])
kono
parents:
diff changeset
190 BACKTRACE_SUPPORTS_THREADS=0
kono
parents:
diff changeset
191 if test "$libbacktrace_cv_sys_sync" = "yes"; then
kono
parents:
diff changeset
192 BACKTRACE_SUPPORTS_THREADS=1
kono
parents:
diff changeset
193 AC_DEFINE([HAVE_SYNC_FUNCTIONS], 1,
kono
parents:
diff changeset
194 [Define to 1 if you have the __sync functions])
kono
parents:
diff changeset
195 fi
kono
parents:
diff changeset
196 AC_SUBST(BACKTRACE_SUPPORTS_THREADS)
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 # Test for __atomic support.
kono
parents:
diff changeset
199 AC_CACHE_CHECK([__atomic extensions],
kono
parents:
diff changeset
200 [libbacktrace_cv_sys_atomic],
kono
parents:
diff changeset
201 [if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
202 libbacktrace_cv_sys_atomic=yes
kono
parents:
diff changeset
203 else
kono
parents:
diff changeset
204 AC_LINK_IFELSE(
kono
parents:
diff changeset
205 [AC_LANG_PROGRAM([int i;],
kono
parents:
diff changeset
206 [__atomic_load_n (&i, __ATOMIC_ACQUIRE);
kono
parents:
diff changeset
207 __atomic_store_n (&i, 1, __ATOMIC_RELEASE);])],
kono
parents:
diff changeset
208 [libbacktrace_cv_sys_atomic=yes],
kono
parents:
diff changeset
209 [libbacktrace_cv_sys_atomic=no])
kono
parents:
diff changeset
210 fi])
kono
parents:
diff changeset
211 if test "$libbacktrace_cv_sys_atomic" = "yes"; then
kono
parents:
diff changeset
212 AC_DEFINE([HAVE_ATOMIC_FUNCTIONS], 1,
kono
parents:
diff changeset
213 [Define to 1 if you have the __atomic functions])
kono
parents:
diff changeset
214 fi
kono
parents:
diff changeset
215
kono
parents:
diff changeset
216 # The library needs to be able to read the executable itself. Compile
kono
parents:
diff changeset
217 # a file to determine the executable format. The awk script
kono
parents:
diff changeset
218 # filetype.awk prints out the file type.
kono
parents:
diff changeset
219 AC_CACHE_CHECK([output filetype],
kono
parents:
diff changeset
220 [libbacktrace_cv_sys_filetype],
kono
parents:
diff changeset
221 [filetype=
kono
parents:
diff changeset
222 AC_COMPILE_IFELSE(
kono
parents:
diff changeset
223 [AC_LANG_PROGRAM([int i;], [int j;])],
kono
parents:
diff changeset
224 [filetype=`${AWK} -f $srcdir/filetype.awk conftest.$ac_objext`],
kono
parents:
diff changeset
225 [AC_MSG_FAILURE([compiler failed])])
kono
parents:
diff changeset
226 libbacktrace_cv_sys_filetype=$filetype])
kono
parents:
diff changeset
227
kono
parents:
diff changeset
228 # Match the file type to decide what files to compile.
kono
parents:
diff changeset
229 FORMAT_FILE=
kono
parents:
diff changeset
230 backtrace_supports_data=yes
kono
parents:
diff changeset
231 case "$libbacktrace_cv_sys_filetype" in
kono
parents:
diff changeset
232 elf*) FORMAT_FILE="elf.lo" ;;
kono
parents:
diff changeset
233 pecoff) FORMAT_FILE="pecoff.lo"
kono
parents:
diff changeset
234 backtrace_supports_data=no
kono
parents:
diff changeset
235 ;;
kono
parents:
diff changeset
236 xcoff*) FORMAT_FILE="xcoff.lo"
kono
parents:
diff changeset
237 backtrace_supports_data=no
kono
parents:
diff changeset
238 ;;
kono
parents:
diff changeset
239 *) AC_MSG_WARN([could not determine output file type])
kono
parents:
diff changeset
240 FORMAT_FILE="unknown.lo"
kono
parents:
diff changeset
241 backtrace_supported=no
kono
parents:
diff changeset
242 ;;
kono
parents:
diff changeset
243 esac
kono
parents:
diff changeset
244 AC_SUBST(FORMAT_FILE)
kono
parents:
diff changeset
245
kono
parents:
diff changeset
246 # ELF defines.
kono
parents:
diff changeset
247 elfsize=
kono
parents:
diff changeset
248 case "$libbacktrace_cv_sys_filetype" in
kono
parents:
diff changeset
249 elf32) elfsize=32 ;;
kono
parents:
diff changeset
250 elf64) elfsize=64 ;;
kono
parents:
diff changeset
251 *) elfsize=unused
kono
parents:
diff changeset
252 esac
kono
parents:
diff changeset
253 AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64])
kono
parents:
diff changeset
254
kono
parents:
diff changeset
255 # XCOFF defines.
kono
parents:
diff changeset
256 xcoffsize=
kono
parents:
diff changeset
257 case "$libbacktrace_cv_sys_filetype" in
kono
parents:
diff changeset
258 xcoff32) xcoffsize=32 ;;
kono
parents:
diff changeset
259 xcoff64) xcoffsize=64 ;;
kono
parents:
diff changeset
260 *) xcoffsize=unused
kono
parents:
diff changeset
261 esac
kono
parents:
diff changeset
262 AC_DEFINE_UNQUOTED([BACKTRACE_XCOFF_SIZE], [$xcoffsize], [XCOFF size: 32 or 64])
kono
parents:
diff changeset
263
kono
parents:
diff changeset
264 BACKTRACE_SUPPORTED=0
kono
parents:
diff changeset
265 if test "$backtrace_supported" = "yes"; then
kono
parents:
diff changeset
266 BACKTRACE_SUPPORTED=1
kono
parents:
diff changeset
267 fi
kono
parents:
diff changeset
268 AC_SUBST(BACKTRACE_SUPPORTED)
kono
parents:
diff changeset
269
kono
parents:
diff changeset
270 BACKTRACE_SUPPORTS_DATA=0
kono
parents:
diff changeset
271 if test "$backtrace_supports_data" = "yes"; then
kono
parents:
diff changeset
272 BACKTRACE_SUPPORTS_DATA=1
kono
parents:
diff changeset
273 fi
kono
parents:
diff changeset
274 AC_SUBST(BACKTRACE_SUPPORTS_DATA)
kono
parents:
diff changeset
275
kono
parents:
diff changeset
276 GCC_HEADER_STDINT(gstdint.h)
kono
parents:
diff changeset
277
kono
parents:
diff changeset
278 AC_CHECK_HEADERS(sys/mman.h)
kono
parents:
diff changeset
279 if test "$ac_cv_header_sys_mman_h" = "no"; then
kono
parents:
diff changeset
280 have_mmap=no
kono
parents:
diff changeset
281 else
kono
parents:
diff changeset
282 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
283 # When built as a GCC target library, we can't do a link test. We
kono
parents:
diff changeset
284 # simply assume that if we have mman.h, we have mmap.
kono
parents:
diff changeset
285 have_mmap=yes
kono
parents:
diff changeset
286 case "${host}" in
kono
parents:
diff changeset
287 spu-*-*|*-*-msdosdjgpp)
kono
parents:
diff changeset
288 # The SPU does not have mmap, but it has a sys/mman.h header file
kono
parents:
diff changeset
289 # containing "mmap_eaddr" and the mmap flags, confusing the test.
kono
parents:
diff changeset
290 # DJGPP also has sys/man.h, but no mmap
kono
parents:
diff changeset
291 have_mmap=no ;;
kono
parents:
diff changeset
292 esac
kono
parents:
diff changeset
293 else
kono
parents:
diff changeset
294 AC_CHECK_FUNC(mmap, [have_mmap=yes], [have_mmap=no])
kono
parents:
diff changeset
295 fi
kono
parents:
diff changeset
296 fi
kono
parents:
diff changeset
297 if test "$have_mmap" = "no"; then
kono
parents:
diff changeset
298 VIEW_FILE=read.lo
kono
parents:
diff changeset
299 ALLOC_FILE=alloc.lo
kono
parents:
diff changeset
300 else
kono
parents:
diff changeset
301 VIEW_FILE=mmapio.lo
kono
parents:
diff changeset
302 AC_PREPROC_IFELSE([
kono
parents:
diff changeset
303 #include <sys/mman.h>
kono
parents:
diff changeset
304 #if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
kono
parents:
diff changeset
305 #error no MAP_ANONYMOUS
kono
parents:
diff changeset
306 #endif
kono
parents:
diff changeset
307 ], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo])
kono
parents:
diff changeset
308 fi
kono
parents:
diff changeset
309 AC_SUBST(VIEW_FILE)
kono
parents:
diff changeset
310 AC_SUBST(ALLOC_FILE)
kono
parents:
diff changeset
311
kono
parents:
diff changeset
312 BACKTRACE_USES_MALLOC=0
kono
parents:
diff changeset
313 if test "$ALLOC_FILE" = "alloc.lo"; then
kono
parents:
diff changeset
314 BACKTRACE_USES_MALLOC=1
kono
parents:
diff changeset
315 fi
kono
parents:
diff changeset
316 AC_SUBST(BACKTRACE_USES_MALLOC)
kono
parents:
diff changeset
317
kono
parents:
diff changeset
318 # Check for dl_iterate_phdr.
kono
parents:
diff changeset
319 AC_CHECK_HEADERS(link.h)
kono
parents:
diff changeset
320 if test "$ac_cv_header_link_h" = "no"; then
kono
parents:
diff changeset
321 have_dl_iterate_phdr=no
kono
parents:
diff changeset
322 else
kono
parents:
diff changeset
323 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
324 # When built as a GCC target library, we can't do a link test.
kono
parents:
diff changeset
325 AC_EGREP_HEADER([dl_iterate_phdr], [link.h], [have_dl_iterate_phdr=yes],
kono
parents:
diff changeset
326 [have_dl_iterate_phdr=no])
kono
parents:
diff changeset
327 case "${host}" in
kono
parents:
diff changeset
328 *-*-solaris2.10*)
kono
parents:
diff changeset
329 # Avoid dl_iterate_phdr on Solaris 10, where it is in the
kono
parents:
diff changeset
330 # header file but is only in -ldl.
kono
parents:
diff changeset
331 have_dl_iterate_phdr=no ;;
kono
parents:
diff changeset
332 esac
kono
parents:
diff changeset
333 else
kono
parents:
diff changeset
334 AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes],
kono
parents:
diff changeset
335 [have_dl_iterate_phdr=no])
kono
parents:
diff changeset
336 fi
kono
parents:
diff changeset
337 fi
kono
parents:
diff changeset
338 if test "$have_dl_iterate_phdr" = "yes"; then
kono
parents:
diff changeset
339 AC_DEFINE(HAVE_DL_ITERATE_PHDR, 1, [Define if dl_iterate_phdr is available.])
kono
parents:
diff changeset
340 fi
kono
parents:
diff changeset
341
kono
parents:
diff changeset
342 # Check for loadquery.
kono
parents:
diff changeset
343 AC_CHECK_HEADERS(sys/ldr.h)
kono
parents:
diff changeset
344 if test "$ac_cv_header_sys_ldr_h" = "no"; then
kono
parents:
diff changeset
345 have_loadquery=no
kono
parents:
diff changeset
346 else
kono
parents:
diff changeset
347 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
348 # When built as a GCC target library, we can't do a link test.
kono
parents:
diff changeset
349 AC_EGREP_HEADER([loadquery], [sys/ldr.h], [have_loadquery=yes],
kono
parents:
diff changeset
350 [have_loadquery=no])
kono
parents:
diff changeset
351 else
kono
parents:
diff changeset
352 AC_CHECK_FUNC([loadquery], [have_loadquery=yes],
kono
parents:
diff changeset
353 [have_loadquery=no])
kono
parents:
diff changeset
354 fi
kono
parents:
diff changeset
355 fi
kono
parents:
diff changeset
356 if test "$have_loadquery" = "yes"; then
kono
parents:
diff changeset
357 AC_DEFINE(HAVE_LOADQUERY, 1, [Define if AIX loadquery is available.])
kono
parents:
diff changeset
358 fi
kono
parents:
diff changeset
359
kono
parents:
diff changeset
360 # Check for the fcntl function.
kono
parents:
diff changeset
361 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
362 case "${host}" in
kono
parents:
diff changeset
363 *-*-mingw*) have_fcntl=no ;;
kono
parents:
diff changeset
364 spu-*-*) 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"
kono
parents:
diff changeset
411 AC_COMPILE_IFELSE([[int i;]],
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
kono
parents:
diff changeset
423 AC_CHECK_LIB([z], [compress], [])
kono
parents:
diff changeset
424 if test $ac_cv_lib_z_compress = "yes"; then
kono
parents:
diff changeset
425 AC_DEFINE(HAVE_ZLIB, 1, [Define if -lz is available.])
kono
parents:
diff changeset
426 fi
kono
parents:
diff changeset
427 AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_lib_z_compress" = yes)
kono
parents:
diff changeset
428
kono
parents:
diff changeset
429 dnl Test whether the linker supports the --compress_debug_sections option.
kono
parents:
diff changeset
430 AC_CACHE_CHECK([whether --compress-debug-sections is supported],
kono
parents:
diff changeset
431 [libgo_cv_ld_compress],
kono
parents:
diff changeset
432 [LDFLAGS_hold=$LDFLAGS
kono
parents:
diff changeset
433 LDFLAGS="$LDFLAGS -Wl,--compress-debug-sections=zlib-gnu"
kono
parents:
diff changeset
434 AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
kono
parents:
diff changeset
435 [libgo_cv_ld_compress=yes],
kono
parents:
diff changeset
436 [libgo_cv_ld_compress=no])
kono
parents:
diff changeset
437 LDFLAGS=$LDFLAGS_hold])
kono
parents:
diff changeset
438 AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG, test "$libgo_cv_ld_compress" = yes)
kono
parents:
diff changeset
439
kono
parents:
diff changeset
440 AC_ARG_VAR(OBJCOPY, [location of objcopy])
kono
parents:
diff changeset
441 AC_CHECK_PROG(OBJCOPY, objcopy, objcopy,)
kono
parents:
diff changeset
442 AC_CACHE_CHECK([whether objcopy supports debuglink],
kono
parents:
diff changeset
443 [libbacktrace_cv_objcopy_debuglink],
kono
parents:
diff changeset
444 [if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
445 libbacktrace_cv_objcopy_debuglink=no
kono
parents:
diff changeset
446 elif ${OBJCOPY} --add-gnu-debuglink=x /bin/ls /tmp/ls$$; then
kono
parents:
diff changeset
447 rm -f /tmp/ls$$
kono
parents:
diff changeset
448 libbacktrace_cv_objcopy_debuglink=yes
kono
parents:
diff changeset
449 else
kono
parents:
diff changeset
450 libbacktrace_cv_objcopy_debuglink=no
kono
parents:
diff changeset
451 fi])
kono
parents:
diff changeset
452 AM_CONDITIONAL(HAVE_OBJCOPY_DEBUGLINK, test "$libbacktrace_cv_objcopy_debuglink" = yes)
kono
parents:
diff changeset
453
kono
parents:
diff changeset
454 AC_CACHE_CHECK([whether tests can run],
kono
parents:
diff changeset
455 [libbacktrace_cv_sys_native],
kono
parents:
diff changeset
456 [AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
kono
parents:
diff changeset
457 [libbacktrace_cv_sys_native=yes],
kono
parents:
diff changeset
458 [libbacktrace_cv_sys_native=no],
kono
parents:
diff changeset
459 [libbacktrace_cv_sys_native=no])])
kono
parents:
diff changeset
460 AM_CONDITIONAL(NATIVE, test "$libbacktrace_cv_sys_native" = "yes")
kono
parents:
diff changeset
461
kono
parents:
diff changeset
462 if test "${multilib}" = "yes"; then
kono
parents:
diff changeset
463 multilib_arg="--enable-multilib"
kono
parents:
diff changeset
464 else
kono
parents:
diff changeset
465 multilib_arg=
kono
parents:
diff changeset
466 fi
kono
parents:
diff changeset
467
kono
parents:
diff changeset
468 AC_CONFIG_FILES(Makefile backtrace-supported.h)
kono
parents:
diff changeset
469
kono
parents:
diff changeset
470 # We need multilib support, but only if configuring for the target.
kono
parents:
diff changeset
471 AC_CONFIG_COMMANDS([default],
kono
parents:
diff changeset
472 [if test -n "$CONFIG_FILES"; then
kono
parents:
diff changeset
473 if test -n "${with_target_subdir}"; then
kono
parents:
diff changeset
474 # Multilibs need MULTISUBDIR defined correctly in certain makefiles so
kono
parents:
diff changeset
475 # that multilib installs will end up installed in the correct place.
kono
parents:
diff changeset
476 # The testsuite needs it for multilib-aware ABI baseline files.
kono
parents:
diff changeset
477 # To work around this not being passed down from config-ml.in ->
kono
parents:
diff changeset
478 # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually
kono
parents:
diff changeset
479 # append it here. Only modify Makefiles that have just been created.
kono
parents:
diff changeset
480 #
kono
parents:
diff changeset
481 # Also, get rid of this simulated-VPATH thing that automake does.
kono
parents:
diff changeset
482 cat > vpsed << \_EOF
kono
parents:
diff changeset
483 s!`test -f '$<' || echo '$(srcdir)/'`!!
kono
parents:
diff changeset
484 _EOF
kono
parents:
diff changeset
485 for i in $SUBDIRS; do
kono
parents:
diff changeset
486 case $CONFIG_FILES in
kono
parents:
diff changeset
487 *${i}/Makefile*)
kono
parents:
diff changeset
488 #echo "Adding MULTISUBDIR to $i/Makefile"
kono
parents:
diff changeset
489 sed -f vpsed $i/Makefile > tmp
kono
parents:
diff changeset
490 grep '^MULTISUBDIR =' Makefile >> tmp
kono
parents:
diff changeset
491 mv tmp $i/Makefile
kono
parents:
diff changeset
492 ;;
kono
parents:
diff changeset
493 esac
kono
parents:
diff changeset
494 done
kono
parents:
diff changeset
495 rm vpsed
kono
parents:
diff changeset
496 fi
kono
parents:
diff changeset
497 fi
kono
parents:
diff changeset
498 ],
kono
parents:
diff changeset
499 [
kono
parents:
diff changeset
500 # Variables needed in config.status (file generation) which aren't already
kono
parents:
diff changeset
501 # passed by autoconf.
kono
parents:
diff changeset
502 SUBDIRS="$SUBDIRS"
kono
parents:
diff changeset
503 ])
kono
parents:
diff changeset
504
kono
parents:
diff changeset
505 AC_OUTPUT