]>
Commit | Line | Data |
---|---|---|
ecd3459e | 1 | # configure.ac -- Backtrace configure script. |
fbd26352 | 2 | # Copyright (C) 2012-2019 Free Software Foundation, Inc. |
ecd3459e | 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 | |
75c399ef | 9 | # notice, this list of conditions and the following disclaimer. |
ecd3459e | 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 | |
75c399ef | 14 | # distribution. |
15 | ||
ecd3459e | 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 | ||
ecd3459e | 32 | AC_INIT(package-unused, version-unused,, libbacktrace) |
33 | AC_CONFIG_SRCDIR(backtrace.h) | |
34 | AC_CONFIG_HEADER(config.h) | |
35 | ||
8df488f9 | 36 | if test -n "${with_target_subdir}"; then |
37 | AM_ENABLE_MULTILIB(, ..) | |
38 | fi | |
39 | ||
ecd3459e | 40 | AC_CANONICAL_SYSTEM |
41 | target_alias=${target_alias-$host_alias} | |
42 | ||
30bd8e8b | 43 | AC_USE_SYSTEM_EXTENSIONS |
44 | ||
ecd3459e | 45 | libtool_VERSION=1:0:0 |
46 | AC_SUBST(libtool_VERSION) | |
47 | ||
451b8929 | 48 | # 1.11.1: Require that version of automake. |
49 | # foreign: Don't require README, INSTALL, NEWS, etc. | |
50 | # no-define: Don't define PACKAGE and VERSION. | |
51 | # no-dependencies: Don't generate automatic dependencies. | |
52 | # (because it breaks when using bootstrap-lean, since some of the | |
53 | # headers are gone at "make install" time). | |
54 | # -Wall: Issue all automake warnings. | |
55 | # -Wno-portability: Don't warn about constructs supported by GNU make. | |
56 | # (because GCC requires GNU make anyhow). | |
57 | AM_INIT_AUTOMAKE([1.11.1 foreign no-dist no-define no-dependencies -Wall -Wno-portability]) | |
ecd3459e | 58 | |
59 | AM_MAINTAINER_MODE | |
60 | ||
61 | AC_ARG_WITH(target-subdir, | |
62 | [ --with-target-subdir=SUBDIR Configuring in a subdirectory for target]) | |
63 | ||
64 | # We must force CC to /not/ be precious variables; otherwise | |
65 | # the wrong, non-multilib-adjusted value will be used in multilibs. | |
66 | # As a side effect, we have to subst CFLAGS ourselves. | |
67 | m4_rename([_AC_ARG_VAR_PRECIOUS],[backtrace_PRECIOUS]) | |
68 | m4_define([_AC_ARG_VAR_PRECIOUS],[]) | |
69 | AC_PROG_CC | |
70 | m4_rename_force([backtrace_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) | |
71 | ||
72 | AC_SUBST(CFLAGS) | |
73 | ||
74 | AC_PROG_RANLIB | |
75 | ||
76 | AC_PROG_AWK | |
77 | case "$AWK" in | |
78 | "") AC_MSG_ERROR([can't build without awk]) ;; | |
79 | esac | |
80 | ||
555388b4 | 81 | AC_CHECK_PROG(DWZ, dwz, dwz) |
82 | AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "") | |
83 | ||
d0724418 | 84 | LT_INIT |
ecd3459e | 85 | AM_PROG_LIBTOOL |
86 | ||
772d73b0 | 87 | AC_SYS_LARGEFILE |
88 | ||
ecd3459e | 89 | backtrace_supported=yes |
90 | ||
91 | if test -n "${with_target_subdir}"; then | |
92 | # We are compiling a GCC library. We can assume that the unwind | |
93 | # library exists. | |
ecd3459e | 94 | BACKTRACE_FILE="backtrace.lo simple.lo" |
95 | else | |
96 | AC_CHECK_HEADER([unwind.h], | |
97 | [AC_CHECK_FUNC([_Unwind_Backtrace], | |
98 | [BACKTRACE_FILE="backtrace.lo simple.lo"], | |
99 | [BACKTRACE_FILE="nounwind.lo" | |
100 | backtrace_supported=no])], | |
101 | [BACKTRACE_FILE="nounwind.lo" | |
102 | backtrace_supported=no]) | |
103 | fi | |
104 | AC_SUBST(BACKTRACE_FILE) | |
105 | ||
536b8dd3 | 106 | EXTRA_FLAGS= |
ff2fe13c | 107 | if test -n "${with_target_subdir}"; then |
a7ebc02e | 108 | EXTRA_FLAGS="-funwind-tables -frandom-seed=\$@" |
ff2fe13c | 109 | else |
110 | AC_CACHE_CHECK([for -funwind-tables option], | |
111 | [libbacktrace_cv_c_unwind_tables], | |
112 | [CFLAGS_hold="$CFLAGS" | |
113 | CFLAGS="$CFLAGS -funwind-tables" | |
114 | AC_COMPILE_IFELSE( | |
115 | [AC_LANG_PROGRAM([static int f() { return 0; }], [return f();])], | |
116 | [libbacktrace_cv_c_unwind_tables=yes], | |
117 | [libbacktrace_cv_c_unwind_tables=no]) | |
118 | CFLAGS="$CFLAGS_hold"]) | |
a7ebc02e | 119 | if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then |
120 | EXTRA_FLAGS=-funwind-tables | |
121 | fi | |
122 | AC_CACHE_CHECK([for -frandom-seed=string option], | |
123 | [libbacktrace_cv_c_random_seed_string], | |
124 | [CFLAGS_hold="$CFLAGS" | |
125 | CFLAGS="$CFLAGS -frandom-seed=conftest.lo" | |
126 | AC_COMPILE_IFELSE( | |
127 | [AC_LANG_PROGRAM([], [return 0;])], | |
128 | [libbacktrace_cv_c_random_seed_string=yes], | |
129 | [libbacktrace_cv_c_random_seed_string=no]) | |
130 | CFLAGS="$CFLAGS_hold"]) | |
131 | if test "$libbacktrace_cv_c_random_seed_string" = "yes"; then | |
132 | EXTRA_FLAGS="$EXTRA_FLAGS -frandom-seed=\$@" | |
133 | fi | |
536b8dd3 | 134 | fi |
b2a9aeb7 | 135 | |
136 | if test -n "${with_target_subdir}"; then | |
137 | # Add CET specific flags is Intel CET is enabled. | |
138 | GCC_CET_FLAGS(CET_FLAGS) | |
139 | EXTRA_FLAGS="$EXTRA_FLAGS $CET_FLAGS" | |
140 | fi | |
536b8dd3 | 141 | AC_SUBST(EXTRA_FLAGS) |
142 | ||
ecd3459e | 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 | ||
47b4f489 | 148 | if test -n "${with_target_subdir}"; then |
ecd3459e | 149 | WARN_FLAGS="$WARN_FLAGS -Werror" |
150 | fi | |
151 | ||
152 | AC_SUBST(WARN_FLAGS) | |
153 | ||
837eabff | 154 | if test -n "${with_target_subdir}"; then |
155 | GCC_CHECK_UNWIND_GETIPINFO | |
156 | else | |
a4a5a77a | 157 | ac_save_CFFLAGS="$CFLAGS" |
158 | CFLAGS="$CFLAGS -Werror-implicit-function-declaration" | |
159 | AC_MSG_CHECKING([for _Unwind_GetIPInfo]) | |
2ee407b0 | 160 | AC_LINK_IFELSE( |
a4a5a77a | 161 | [AC_LANG_PROGRAM( |
162 | [#include "unwind.h" | |
163 | struct _Unwind_Context *context; | |
164 | int ip_before_insn = 0;], | |
165 | [return _Unwind_GetIPInfo (context, &ip_before_insn);])], | |
166 | [have_unwind_getipinfo=yes], [have_unwind_getipinfo=no]) | |
167 | CFLAGS="$ac_save_CFLAGS" | |
168 | AC_MSG_RESULT([$have_unwind_getipinfo]) | |
837eabff | 169 | if test "$have_unwind_getipinfo" = "yes"; then |
170 | AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.]) | |
171 | fi | |
172 | fi | |
ecd3459e | 173 | |
d0724418 | 174 | # Enable --enable-host-shared. |
2bd17377 | 175 | AC_ARG_ENABLE(host-shared, |
176 | [AS_HELP_STRING([--enable-host-shared], | |
177 | [build host code as shared libraries])], | |
d0724418 | 178 | [PIC_FLAG=-fPIC], [PIC_FLAG=]) |
ecd3459e | 179 | AC_SUBST(PIC_FLAG) |
180 | ||
181 | # Test for __sync support. | |
182 | AC_CACHE_CHECK([__sync extensions], | |
183 | [libbacktrace_cv_sys_sync], | |
184 | [if test -n "${with_target_subdir}"; then | |
ab861c80 | 185 | case "${host}" in |
186 | hppa*-*-hpux*) libbacktrace_cv_sys_sync=no ;; | |
187 | *) libbacktrace_cv_sys_sync=yes ;; | |
188 | esac | |
ecd3459e | 189 | else |
190 | AC_LINK_IFELSE( | |
191 | [AC_LANG_PROGRAM([int i;], | |
192 | [__sync_bool_compare_and_swap (&i, i, i); | |
193 | __sync_lock_test_and_set (&i, 1); | |
194 | __sync_lock_release (&i);])], | |
195 | [libbacktrace_cv_sys_sync=yes], | |
196 | [libbacktrace_cv_sys_sync=no]) | |
197 | fi]) | |
198 | BACKTRACE_SUPPORTS_THREADS=0 | |
199 | if test "$libbacktrace_cv_sys_sync" = "yes"; then | |
200 | BACKTRACE_SUPPORTS_THREADS=1 | |
201 | AC_DEFINE([HAVE_SYNC_FUNCTIONS], 1, | |
202 | [Define to 1 if you have the __sync functions]) | |
203 | fi | |
204 | AC_SUBST(BACKTRACE_SUPPORTS_THREADS) | |
205 | ||
bcafb4a8 | 206 | # Test for __atomic support. |
207 | AC_CACHE_CHECK([__atomic extensions], | |
208 | [libbacktrace_cv_sys_atomic], | |
209 | [if test -n "${with_target_subdir}"; then | |
210 | libbacktrace_cv_sys_atomic=yes | |
211 | else | |
212 | AC_LINK_IFELSE( | |
213 | [AC_LANG_PROGRAM([int i;], | |
214 | [__atomic_load_n (&i, __ATOMIC_ACQUIRE); | |
215 | __atomic_store_n (&i, 1, __ATOMIC_RELEASE);])], | |
216 | [libbacktrace_cv_sys_atomic=yes], | |
217 | [libbacktrace_cv_sys_atomic=no]) | |
218 | fi]) | |
219 | if test "$libbacktrace_cv_sys_atomic" = "yes"; then | |
220 | AC_DEFINE([HAVE_ATOMIC_FUNCTIONS], 1, | |
221 | [Define to 1 if you have the __atomic functions]) | |
222 | fi | |
223 | ||
ecd3459e | 224 | # The library needs to be able to read the executable itself. Compile |
225 | # a file to determine the executable format. The awk script | |
226 | # filetype.awk prints out the file type. | |
227 | AC_CACHE_CHECK([output filetype], | |
228 | [libbacktrace_cv_sys_filetype], | |
229 | [filetype= | |
230 | AC_COMPILE_IFELSE( | |
231 | [AC_LANG_PROGRAM([int i;], [int j;])], | |
232 | [filetype=`${AWK} -f $srcdir/filetype.awk conftest.$ac_objext`], | |
233 | [AC_MSG_FAILURE([compiler failed])]) | |
234 | libbacktrace_cv_sys_filetype=$filetype]) | |
235 | ||
236 | # Match the file type to decide what files to compile. | |
237 | FORMAT_FILE= | |
48ee217e | 238 | backtrace_supports_data=yes |
ecd3459e | 239 | case "$libbacktrace_cv_sys_filetype" in |
240 | elf*) FORMAT_FILE="elf.lo" ;; | |
48ee217e | 241 | pecoff) FORMAT_FILE="pecoff.lo" |
242 | backtrace_supports_data=no | |
243 | ;; | |
0a83c23a | 244 | xcoff*) FORMAT_FILE="xcoff.lo" |
245 | backtrace_supports_data=no | |
246 | ;; | |
ecd3459e | 247 | *) AC_MSG_WARN([could not determine output file type]) |
248 | FORMAT_FILE="unknown.lo" | |
249 | backtrace_supported=no | |
250 | ;; | |
251 | esac | |
252 | AC_SUBST(FORMAT_FILE) | |
253 | ||
254 | # ELF defines. | |
255 | elfsize= | |
256 | case "$libbacktrace_cv_sys_filetype" in | |
257 | elf32) elfsize=32 ;; | |
258 | elf64) elfsize=64 ;; | |
48ee217e | 259 | *) elfsize=unused |
ecd3459e | 260 | esac |
261 | AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64]) | |
5c1bcc1b | 262 | AM_CONDITIONAL(HAVE_ELF, test "$FORMAT_FILE" = "elf.lo") |
ecd3459e | 263 | |
0a83c23a | 264 | # XCOFF defines. |
265 | xcoffsize= | |
266 | case "$libbacktrace_cv_sys_filetype" in | |
267 | xcoff32) xcoffsize=32 ;; | |
268 | xcoff64) xcoffsize=64 ;; | |
269 | *) xcoffsize=unused | |
270 | esac | |
271 | AC_DEFINE_UNQUOTED([BACKTRACE_XCOFF_SIZE], [$xcoffsize], [XCOFF size: 32 or 64]) | |
272 | ||
ecd3459e | 273 | BACKTRACE_SUPPORTED=0 |
274 | if test "$backtrace_supported" = "yes"; then | |
275 | BACKTRACE_SUPPORTED=1 | |
276 | fi | |
277 | AC_SUBST(BACKTRACE_SUPPORTED) | |
278 | ||
48ee217e | 279 | BACKTRACE_SUPPORTS_DATA=0 |
280 | if test "$backtrace_supports_data" = "yes"; then | |
281 | BACKTRACE_SUPPORTS_DATA=1 | |
282 | fi | |
283 | AC_SUBST(BACKTRACE_SUPPORTS_DATA) | |
284 | ||
b945b61c | 285 | GCC_HEADER_STDINT(gstdint.h) |
286 | ||
ecd3459e | 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 | |
de04a87e | 295 | case "${host}" in |
b767924b | 296 | spu-*-*|*-*-msdosdjgpp) |
de04a87e | 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. | |
b767924b | 299 | # DJGPP also has sys/man.h, but no mmap |
de04a87e | 300 | have_mmap=no ;; |
301 | esac | |
ecd3459e | 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 | |
f00f02a3 | 311 | AC_PREPROC_IFELSE([AC_LANG_SOURCE([ |
ecd3459e | 312 | #include <sys/mman.h> |
313 | #if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON) | |
314 | #error no MAP_ANONYMOUS | |
315 | #endif | |
f00f02a3 | 316 | ])], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo]) |
ecd3459e | 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 | ||
1bfb5d87 | 327 | # Check for dl_iterate_phdr. |
328 | AC_CHECK_HEADERS(link.h) | |
329 | if test "$ac_cv_header_link_h" = "no"; then | |
330 | have_dl_iterate_phdr=no | |
331 | else | |
332 | if test -n "${with_target_subdir}"; then | |
333 | # When built as a GCC target library, we can't do a link test. | |
334 | AC_EGREP_HEADER([dl_iterate_phdr], [link.h], [have_dl_iterate_phdr=yes], | |
335 | [have_dl_iterate_phdr=no]) | |
336 | else | |
337 | AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes], | |
338 | [have_dl_iterate_phdr=no]) | |
339 | fi | |
340 | fi | |
341 | if test "$have_dl_iterate_phdr" = "yes"; then | |
342 | AC_DEFINE(HAVE_DL_ITERATE_PHDR, 1, [Define if dl_iterate_phdr is available.]) | |
343 | fi | |
344 | ||
0a83c23a | 345 | # Check for loadquery. |
346 | AC_CHECK_HEADERS(sys/ldr.h) | |
347 | if test "$ac_cv_header_sys_ldr_h" = "no"; then | |
348 | have_loadquery=no | |
349 | else | |
350 | if test -n "${with_target_subdir}"; then | |
351 | # When built as a GCC target library, we can't do a link test. | |
352 | AC_EGREP_HEADER([loadquery], [sys/ldr.h], [have_loadquery=yes], | |
353 | [have_loadquery=no]) | |
354 | else | |
355 | AC_CHECK_FUNC([loadquery], [have_loadquery=yes], | |
356 | [have_loadquery=no]) | |
357 | fi | |
358 | fi | |
359 | if test "$have_loadquery" = "yes"; then | |
360 | AC_DEFINE(HAVE_LOADQUERY, 1, [Define if AIX loadquery is available.]) | |
361 | fi | |
362 | ||
7341e544 | 363 | # Check for the fcntl function. |
364 | if test -n "${with_target_subdir}"; then | |
365 | case "${host}" in | |
366 | *-*-mingw*) have_fcntl=no ;; | |
b2d409ee | 367 | spu-*-*) have_fcntl=no ;; |
7341e544 | 368 | *) have_fcntl=yes ;; |
369 | esac | |
370 | else | |
371 | AC_CHECK_FUNC(fcntl, [have_fcntl=yes], [have_fcntl=no]) | |
372 | fi | |
373 | if test "$have_fcntl" = "yes"; then | |
374 | AC_DEFINE([HAVE_FCNTL], 1, | |
375 | [Define to 1 if you have the fcntl function]) | |
376 | fi | |
377 | ||
5f7c240f | 378 | AC_CHECK_DECLS(strnlen) |
7b3574e4 | 379 | AC_CHECK_FUNCS(lstat readlink) |
5f7c240f | 380 | |
686b3772 | 381 | # Check for getexecname function. |
382 | if test -n "${with_target_subdir}"; then | |
383 | case "${host}" in | |
384 | *-*-solaris2*) have_getexecname=yes ;; | |
385 | *) have_getexecname=no ;; | |
386 | esac | |
387 | else | |
388 | AC_CHECK_FUNC(getexecname, [have_getexecname=yes], [have_getexecname=no]) | |
389 | fi | |
390 | if test "$have_getexecname" = "yes"; then | |
391 | AC_DEFINE(HAVE_GETEXECNAME, 1, [Define if getexecname is available.]) | |
392 | fi | |
393 | ||
c476d11e | 394 | # Check for the clock_gettime function. |
395 | AC_CHECK_FUNCS(clock_gettime) | |
0b986d3d | 396 | clock_gettime_link= |
397 | # At least for glibc, clock_gettime is in librt. But don't | |
398 | # pull that in if it still doesn't give us the function we want. This | |
399 | # test is copied from libgomp, and modified to not link in -lrt as | |
400 | # we're using this for test timing only. | |
401 | if test "$ac_cv_func_clock_gettime" = no; then | |
402 | AC_CHECK_LIB(rt, clock_gettime, | |
bf821bfd | 403 | [CLOCK_GETTIME_LINK=-lrt |
0b986d3d | 404 | AC_DEFINE(HAVE_CLOCK_GETTIME, 1, |
405 | [Define to 1 if you have the `clock_gettime' function.])]) | |
406 | fi | |
bf821bfd | 407 | AC_SUBST(CLOCK_GETTIME_LINK) |
c476d11e | 408 | |
3be33b09 | 409 | dnl Test whether the compiler supports the -pthread option. |
410 | AC_CACHE_CHECK([whether -pthread is supported], | |
411 | [libgo_cv_lib_pthread], | |
412 | [CFLAGS_hold=$CFLAGS | |
413 | CFLAGS="$CFLAGS -pthread" | |
f00f02a3 | 414 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], |
3be33b09 | 415 | [libgo_cv_lib_pthread=yes], |
416 | [libgo_cv_lib_pthread=no]) | |
417 | CFLAGS=$CFLAGS_hold]) | |
418 | PTHREAD_CFLAGS= | |
419 | if test "$libgo_cv_lib_pthread" = yes; then | |
420 | PTHREAD_CFLAGS=-pthread | |
421 | fi | |
422 | AC_SUBST(PTHREAD_CFLAGS) | |
423 | ||
424 | AM_CONDITIONAL(HAVE_PTHREAD, test "$libgo_cv_lib_pthread" = yes) | |
425 | ||
c7e50530 | 426 | AC_CHECK_LIB([z], [compress], |
427 | [AC_DEFINE(HAVE_ZLIB, 1, [Define if -lz is available.])]) | |
1fffcf69 | 428 | AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_lib_z_compress" = yes) |
429 | ||
430 | dnl Test whether the linker supports the --compress_debug_sections option. | |
431 | AC_CACHE_CHECK([whether --compress-debug-sections is supported], | |
432 | [libgo_cv_ld_compress], | |
433 | [LDFLAGS_hold=$LDFLAGS | |
434 | LDFLAGS="$LDFLAGS -Wl,--compress-debug-sections=zlib-gnu" | |
435 | AC_LINK_IFELSE([AC_LANG_PROGRAM(,)], | |
436 | [libgo_cv_ld_compress=yes], | |
437 | [libgo_cv_ld_compress=no]) | |
438 | LDFLAGS=$LDFLAGS_hold]) | |
439 | AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG, test "$libgo_cv_ld_compress" = yes) | |
440 | ||
b919941e | 441 | AC_ARG_VAR(OBJCOPY, [location of objcopy]) |
442 | AC_CHECK_PROG(OBJCOPY, objcopy, objcopy,) | |
5c1bcc1b | 443 | AC_CHECK_PROG(READELF, readelf, readelf) |
b919941e | 444 | AC_CACHE_CHECK([whether objcopy supports debuglink], |
445 | [libbacktrace_cv_objcopy_debuglink], | |
446 | [if test -n "${with_target_subdir}"; then | |
447 | libbacktrace_cv_objcopy_debuglink=no | |
448 | elif ${OBJCOPY} --add-gnu-debuglink=x /bin/ls /tmp/ls$$; then | |
449 | rm -f /tmp/ls$$ | |
450 | libbacktrace_cv_objcopy_debuglink=yes | |
451 | else | |
452 | libbacktrace_cv_objcopy_debuglink=no | |
453 | fi]) | |
454 | AM_CONDITIONAL(HAVE_OBJCOPY_DEBUGLINK, test "$libbacktrace_cv_objcopy_debuglink" = yes) | |
455 | ||
ecd3459e | 456 | AC_CACHE_CHECK([whether tests can run], |
457 | [libbacktrace_cv_sys_native], | |
458 | [AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])], | |
459 | [libbacktrace_cv_sys_native=yes], | |
460 | [libbacktrace_cv_sys_native=no], | |
461 | [libbacktrace_cv_sys_native=no])]) | |
462 | AM_CONDITIONAL(NATIVE, test "$libbacktrace_cv_sys_native" = "yes") | |
463 | ||
464 | if test "${multilib}" = "yes"; then | |
465 | multilib_arg="--enable-multilib" | |
466 | else | |
467 | multilib_arg= | |
468 | fi | |
469 | ||
470 | AC_CONFIG_FILES(Makefile backtrace-supported.h) | |
5c1bcc1b | 471 | AC_CONFIG_FILES(install-debuginfo-for-buildid.sh, chmod +x install-debuginfo-for-buildid.sh) |
ecd3459e | 472 | |
473 | # We need multilib support, but only if configuring for the target. | |
474 | AC_CONFIG_COMMANDS([default], | |
475 | [if test -n "$CONFIG_FILES"; then | |
476 | if test -n "${with_target_subdir}"; then | |
477 | # Multilibs need MULTISUBDIR defined correctly in certain makefiles so | |
478 | # that multilib installs will end up installed in the correct place. | |
479 | # The testsuite needs it for multilib-aware ABI baseline files. | |
480 | # To work around this not being passed down from config-ml.in -> | |
481 | # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually | |
482 | # append it here. Only modify Makefiles that have just been created. | |
483 | # | |
484 | # Also, get rid of this simulated-VPATH thing that automake does. | |
485 | cat > vpsed << \_EOF | |
486 | s!`test -f '$<' || echo '$(srcdir)/'`!! | |
487 | _EOF | |
488 | for i in $SUBDIRS; do | |
489 | case $CONFIG_FILES in | |
490 | *${i}/Makefile*) | |
491 | #echo "Adding MULTISUBDIR to $i/Makefile" | |
492 | sed -f vpsed $i/Makefile > tmp | |
493 | grep '^MULTISUBDIR =' Makefile >> tmp | |
494 | mv tmp $i/Makefile | |
495 | ;; | |
496 | esac | |
497 | done | |
498 | rm vpsed | |
499 | fi | |
500 | fi | |
501 | ], | |
502 | [ | |
503 | # Variables needed in config.status (file generation) which aren't already | |
504 | # passed by autoconf. | |
505 | SUBDIRS="$SUBDIRS" | |
506 | ]) | |
507 | ||
508 | AC_OUTPUT |