libstdc++: Remove unused alias template in std::optional
[official-gcc.git] / libbacktrace / configure.ac
blob69eb2023677a61ac7202199323b938329e24cfeb
1 # configure.ac -- Backtrace configure script.
2 # Copyright (C) 2012-2024 Free Software Foundation, Inc.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met:
8 #     (1) Redistributions of source code must retain the above copyright
9 #     notice, this list of conditions and the following disclaimer.
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.
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.
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.
32 AC_INIT(package-unused, version-unused,, libbacktrace)
33 AC_CONFIG_SRCDIR(backtrace.h)
34 AC_CONFIG_HEADER(config.h)
36 if test -n "${with_target_subdir}"; then
37   AM_ENABLE_MULTILIB(, ..)
40 AC_CANONICAL_SYSTEM
41 target_alias=${target_alias-$host_alias}
43 AC_USE_SYSTEM_EXTENSIONS
45 libtool_VERSION=1:0:0
46 AC_SUBST(libtool_VERSION)
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])
59 AM_MAINTAINER_MODE
61 AC_ARG_WITH(target-subdir,
62 [  --with-target-subdir=SUBDIR      Configuring in a subdirectory for target])
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])
72 AC_SUBST(CFLAGS)
74 AC_PROG_RANLIB
76 AC_PROG_AWK
77 case "$AWK" in
78 "") AC_MSG_ERROR([can't build without awk]) ;;
79 esac
81 AC_CHECK_PROG(DWZ, dwz, dwz)
82 AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "")
84 LT_INIT
85 AM_PROG_LIBTOOL
87 AM_CONDITIONAL([ENABLE_DARWIN_AT_RPATH], [test x$enable_darwin_at_rpath = xyes])
89 AC_SYS_LARGEFILE
91 backtrace_supported=yes
93 if test -n "${with_target_subdir}"; then
94   # We are compiling a GCC library.  We can assume that the unwind
95   # library exists.
96   BACKTRACE_FILE="backtrace.lo simple.lo"
97 else
98   AC_CHECK_HEADER([unwind.h],
99     [AC_CHECK_FUNC([_Unwind_Backtrace],
100                    [BACKTRACE_FILE="backtrace.lo simple.lo"],
101                    [BACKTRACE_FILE="nounwind.lo"
102                     backtrace_supported=no])],
103     [BACKTRACE_FILE="nounwind.lo"
104      backtrace_supported=no])
106 AC_SUBST(BACKTRACE_FILE)
108 EXTRA_FLAGS=
109 if test -n "${with_target_subdir}"; then
110   EXTRA_FLAGS="-funwind-tables -frandom-seed=\$@"
111 else
112   AC_CACHE_CHECK([for -funwind-tables option],
113     [libbacktrace_cv_c_unwind_tables],
114     [CFLAGS_hold="$CFLAGS"
115      CFLAGS="$CFLAGS -funwind-tables"
116      AC_COMPILE_IFELSE(
117        [AC_LANG_PROGRAM([static int f() { return 0; }], [return f();])],
118        [libbacktrace_cv_c_unwind_tables=yes],
119        [libbacktrace_cv_c_unwind_tables=no])
120      CFLAGS="$CFLAGS_hold"])
121   if test "$libbacktrace_cv_c_unwind_tables" = "yes"; then
122     EXTRA_FLAGS=-funwind-tables
123   fi
124   AC_CACHE_CHECK([for -frandom-seed=string option],
125     [libbacktrace_cv_c_random_seed_string],
126     [CFLAGS_hold="$CFLAGS"
127      CFLAGS="$CFLAGS -frandom-seed=conftest.lo"
128      AC_COMPILE_IFELSE(
129        [AC_LANG_PROGRAM([], [return 0;])],
130        [libbacktrace_cv_c_random_seed_string=yes],
131        [libbacktrace_cv_c_random_seed_string=no])
132      CFLAGS="$CFLAGS_hold"])
133   if test "$libbacktrace_cv_c_random_seed_string" = "yes"; then
134     EXTRA_FLAGS="$EXTRA_FLAGS -frandom-seed=\$@"
135   fi
138 if test -n "${with_target_subdir}"; then
139   # Add CET specific flags is Intel CET is enabled.
140   GCC_CET_FLAGS(CET_FLAGS)
141   EXTRA_FLAGS="$EXTRA_FLAGS $CET_FLAGS"
143 AC_SUBST(EXTRA_FLAGS)
145 ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
146                           -Wmissing-prototypes -Wold-style-definition \
147                           -Wmissing-format-attribute -Wcast-qual \
148                           -Wno-attributes -Wno-unknown-attributes \
149                           -Wpointer-arith],
150                           [WARN_FLAGS])
152 AC_ARG_ENABLE([werror],
153   [AS_HELP_STRING([--disable-werror], [disable building with -Werror])])
154 AS_IF([test "x$enable_werror" != "xno" && test -n "${with_target_subdir}"],
155   [WARN_FLAGS="$WARN_FLAGS -Werror"])
156 AC_SUBST(WARN_FLAGS)
158 if test -n "${with_target_subdir}"; then
159   GCC_CHECK_UNWIND_GETIPINFO
160 else
161   ac_save_CFFLAGS="$CFLAGS"
162   CFLAGS="$CFLAGS -Werror-implicit-function-declaration"
163   AC_MSG_CHECKING([for _Unwind_GetIPInfo])
164   AC_LINK_IFELSE(
165     [AC_LANG_PROGRAM(
166        [#include "unwind.h"
167         struct _Unwind_Context *context;
168         int ip_before_insn = 0;],
169         [return _Unwind_GetIPInfo (context, &ip_before_insn);])],
170         [have_unwind_getipinfo=yes], [have_unwind_getipinfo=no])
171   CFLAGS="$ac_save_CFLAGS"
172   AC_MSG_RESULT([$have_unwind_getipinfo])
173   if test "$have_unwind_getipinfo" = "yes"; then
174     AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.])
175   fi
178 # Enable --enable-host-shared.
179 AC_ARG_ENABLE(host-shared,
180 [AS_HELP_STRING([--enable-host-shared],
181                 [build host code as shared libraries])],
182 [PIC_FLAG=-fPIC], [PIC_FLAG=])
183 AC_SUBST(PIC_FLAG)
185 # Enable Intel CET on Intel CET enabled host if jit is enabled.
186 GCC_CET_HOST_FLAGS(CET_HOST_FLAGS)
187 case x$enable_languages in
188 *jit*)
189   ;;
191   CET_HOST_FLAGS=
192   ;;
193 esac
194 AC_SUBST(CET_HOST_FLAGS)
196 # Test for __sync support.
197 AC_CACHE_CHECK([__sync extensions],
198 [libbacktrace_cv_sys_sync],
199 [if test -n "${with_target_subdir}"; then
200    case "${host}" in
201    hppa*-*-hpux*) libbacktrace_cv_sys_sync=no ;;
202    *) libbacktrace_cv_sys_sync=yes ;;
203    esac
204  else
205    AC_LINK_IFELSE(
206      [AC_LANG_PROGRAM([int i;],
207                       [__sync_bool_compare_and_swap (&i, i, i);
208                        __sync_lock_test_and_set (&i, 1);
209                        __sync_lock_release (&i);])],
210      [libbacktrace_cv_sys_sync=yes],
211      [libbacktrace_cv_sys_sync=no])
212  fi])
213 BACKTRACE_SUPPORTS_THREADS=0
214 if test "$libbacktrace_cv_sys_sync" = "yes"; then
215   BACKTRACE_SUPPORTS_THREADS=1
216   AC_DEFINE([HAVE_SYNC_FUNCTIONS], 1,
217             [Define to 1 if you have the __sync functions])
219 AC_SUBST(BACKTRACE_SUPPORTS_THREADS)
221 # Test for __atomic support.
222 AC_CACHE_CHECK([__atomic extensions],
223 [libbacktrace_cv_sys_atomic],
224 [if test -n "${with_target_subdir}"; then
225    libbacktrace_cv_sys_atomic=yes
226  else
227    AC_LINK_IFELSE(
228      [AC_LANG_PROGRAM([int i;],
229                       [__atomic_load_n (&i, __ATOMIC_ACQUIRE);
230                        __atomic_store_n (&i, 1, __ATOMIC_RELEASE);])],
231      [libbacktrace_cv_sys_atomic=yes],
232      [libbacktrace_cv_sys_atomic=no])
233  fi])
234 if test "$libbacktrace_cv_sys_atomic" = "yes"; then
235   AC_DEFINE([HAVE_ATOMIC_FUNCTIONS], 1,
236             [Define to 1 if you have the __atomic functions])
239 # The library needs to be able to read the executable itself.  Compile
240 # a file to determine the executable format.  The awk script
241 # filetype.awk prints out the file type.
242 AC_CACHE_CHECK([output filetype],
243 [libbacktrace_cv_sys_filetype],
244 [filetype=
245 AC_COMPILE_IFELSE(
246   [AC_LANG_PROGRAM([int i;], [int j;])],
247   [filetype=`${AWK} -f $srcdir/filetype.awk conftest.$ac_objext`],
248   [AC_MSG_FAILURE([compiler failed])])
249 libbacktrace_cv_sys_filetype=$filetype])
251 # Match the file type to decide what files to compile.
252 FORMAT_FILE=
253 backtrace_supports_data=yes
254 case "$libbacktrace_cv_sys_filetype" in
255 elf*) FORMAT_FILE="elf.lo" ;;
256 macho) FORMAT_FILE="macho.lo" ;;
257 pecoff) FORMAT_FILE="pecoff.lo"
258         backtrace_supports_data=no
259         ;;
260 xcoff*) FORMAT_FILE="xcoff.lo"
261         backtrace_supports_data=no
262         ;;
263 *) AC_MSG_WARN([could not determine output file type])
264    FORMAT_FILE="unknown.lo"
265    backtrace_supported=no
266    ;;
267 esac
268 AC_SUBST(FORMAT_FILE)
270 # ELF defines.
271 elfsize=
272 case "$libbacktrace_cv_sys_filetype" in
273 elf32) elfsize=32 ;;
274 elf64) elfsize=64 ;;
275 *)     elfsize=unused
276 esac
277 AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64])
278 AM_CONDITIONAL(HAVE_ELF, test "$FORMAT_FILE" = "elf.lo")
280 # XCOFF defines.
281 xcoffsize=
282 case "$libbacktrace_cv_sys_filetype" in
283 xcoff32) xcoffsize=32 ;;
284 xcoff64) xcoffsize=64 ;;
285 *)       xcoffsize=unused
286 esac
287 AC_DEFINE_UNQUOTED([BACKTRACE_XCOFF_SIZE], [$xcoffsize], [XCOFF size: 32 or 64])
289 BACKTRACE_SUPPORTED=0
290 if test "$backtrace_supported" = "yes"; then
291   BACKTRACE_SUPPORTED=1
293 AC_SUBST(BACKTRACE_SUPPORTED)
295 BACKTRACE_SUPPORTS_DATA=0
296 if test "$backtrace_supports_data" = "yes"; then
297   BACKTRACE_SUPPORTS_DATA=1
299 AC_SUBST(BACKTRACE_SUPPORTS_DATA)
301 GCC_HEADER_STDINT(gstdint.h)
303 AC_CHECK_HEADERS(sys/mman.h)
304 if test "$ac_cv_header_sys_mman_h" = "no"; then
305   have_mmap=no
306 else
307   if test -n "${with_target_subdir}"; then
308     # When built as a GCC target library, we can't do a link test.  We
309     # simply assume that if we have mman.h, we have mmap.
310     have_mmap=yes
311     case "${host}" in
312     *-*-msdosdjgpp)
313         # DJGPP has sys/man.h, but no mmap
314         have_mmap=no ;;
315     esac
316   else
317     AC_CHECK_FUNC(mmap, [have_mmap=yes], [have_mmap=no])
318   fi
320 if test "$have_mmap" = "no"; then
321   VIEW_FILE=read.lo
322   ALLOC_FILE=alloc.lo
323 else
324   VIEW_FILE=mmapio.lo
325   AC_PREPROC_IFELSE([AC_LANG_SOURCE([
326 #include <sys/mman.h>
327 #if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
328   #error no MAP_ANONYMOUS
329 #endif
330 ])], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo])
332 AC_SUBST(VIEW_FILE)
333 AC_SUBST(ALLOC_FILE)
335 BACKTRACE_USES_MALLOC=0
336 if test "$ALLOC_FILE" = "alloc.lo"; then
337   BACKTRACE_USES_MALLOC=1
339 AC_SUBST(BACKTRACE_USES_MALLOC)
341 # Check for dl_iterate_phdr.
342 AC_CHECK_HEADERS(link.h sys/link.h)
343 if test "$ac_cv_header_link_h" = "no" -a "$ac_cv_header_sys_link_h" = "no"; then
344   have_dl_iterate_phdr=no
345 else
346   if test -n "${with_target_subdir}"; then
347     link_h=link.h
348     if test "$ac_cv_header_link_h" = "no"; then
349        link_h=sys/link.h
350     fi
351     # When built as a GCC target library, we can't do a link test.
352     AC_EGREP_HEADER([dl_iterate_phdr], [$link_h], [have_dl_iterate_phdr=yes],
353                     [have_dl_iterate_phdr=no])
354   else
355     AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes],
356                   [have_dl_iterate_phdr=no])
357   fi
359 if test "$have_dl_iterate_phdr" = "yes"; then
360   AC_DEFINE(HAVE_DL_ITERATE_PHDR, 1, [Define if dl_iterate_phdr is available.])
363 # Check for header file for Mach-O image functions.
364 AC_CHECK_HEADERS(mach-o/dyld.h)
366 # Check for loadquery.
367 AC_CHECK_HEADERS(sys/ldr.h)
368 if test "$ac_cv_header_sys_ldr_h" = "no"; then
369   have_loadquery=no
370 else
371   if test -n "${with_target_subdir}"; then
372     # When built as a GCC target library, we can't do a link test.
373     AC_EGREP_HEADER([loadquery], [sys/ldr.h], [have_loadquery=yes],
374                     [have_loadquery=no])
375   else
376     AC_CHECK_FUNC([loadquery], [have_loadquery=yes],
377                   [have_loadquery=no])
378   fi
380 if test "$have_loadquery" = "yes"; then
381   AC_DEFINE(HAVE_LOADQUERY, 1, [Define if AIX loadquery is available.])
384 AC_CHECK_HEADERS(windows.h)
385 AC_CHECK_HEADERS(tlhelp32.h, [], [],
386 [#ifdef HAVE_WINDOWS_H
387 #  include <windows.h>
388 #endif])
390 # Check for the fcntl function.
391 if test -n "${with_target_subdir}"; then
392    case "${host}" in
393    *-*-mingw*) have_fcntl=no ;;
394    *) have_fcntl=yes ;;
395    esac
396 else
397   AC_CHECK_FUNC(fcntl, [have_fcntl=yes], [have_fcntl=no])
399 if test "$have_fcntl" = "yes"; then
400   AC_DEFINE([HAVE_FCNTL], 1,
401             [Define to 1 if you have the fcntl function])
404 AC_CHECK_DECLS([strnlen, getpagesize])
405 AC_CHECK_FUNCS(lstat readlink)
407 # Check for getexecname function.
408 if test -n "${with_target_subdir}"; then
409    case "${host}" in
410    *-*-solaris2*) have_getexecname=yes ;;
411    *) have_getexecname=no ;;
412    esac
413 else
414   AC_CHECK_FUNC(getexecname, [have_getexecname=yes], [have_getexecname=no])
416 if test "$have_getexecname" = "yes"; then
417   AC_DEFINE(HAVE_GETEXECNAME, 1, [Define if getexecname is available.])
420 # Check for _pgmptr variable, contains the executable filename on windows
421 AC_CHECK_DECLS([_pgmptr])
423 # Check for sysctl definitions.
425 AC_CACHE_CHECK([for KERN_PROC],
426 [libbacktrace_cv_proc],
427 [AC_COMPILE_IFELSE(
428   [AC_LANG_PROGRAM([
429 #include <sys/types.h>
430 #include <sys/sysctl.h>
431 ], [int mib0 = CTL_KERN; int mib1 = KERN_PROC; int mib2 = KERN_PROC_PATHNAME;])],
432   [libbacktrace_cv_proc=yes],
433   [libbacktrace_cv_proc=no])])
434 if test "$libbacktrace_cv_proc" = "yes"; then
435   AC_DEFINE([HAVE_KERN_PROC], 1,
436             [Define to 1 if you have KERN_PROC and KERN_PROC_PATHNAME in <sys/sysctl.h>.])
439 AC_CACHE_CHECK([for KERN_PROG_ARGS],
440 [libbacktrace_cv_procargs],
441 [AC_COMPILE_IFELSE(
442   [AC_LANG_PROGRAM([
443 #include <sys/types.h>
444 #include <sys/sysctl.h>
445 ], [int mib0 = CTL_KERN; int mib1 = KERN_PROC_ARGS; int mib2 = KERN_PROC_PATHNAME;])],
446   [libbacktrace_cv_procargs=yes],
447   [libbacktrace_cv_procargs=no])])
448 if test "$libbacktrace_cv_procargs" = "yes"; then
449   AC_DEFINE([HAVE_KERN_PROC_ARGS], 1,
450             [Define to 1 if you have KERN_PROCARGS and KERN_PROC_PATHNAME in <sys/sysctl.h>.])
453 # Check for the clock_gettime function.
454 AC_CHECK_FUNCS(clock_gettime)
455 clock_gettime_link=
456 # At least for glibc, clock_gettime is in librt.  But don't
457 # pull that in if it still doesn't give us the function we want.  This
458 # test is copied from libgomp, and modified to not link in -lrt as
459 # we're using this for test timing only.
460 if test "$ac_cv_func_clock_gettime" = no; then
461   AC_CHECK_LIB(rt, clock_gettime,
462     [CLOCK_GETTIME_LINK=-lrt
463      AC_DEFINE(HAVE_CLOCK_GETTIME, 1,
464                [Define to 1 if you have the `clock_gettime' function.])])
466 AC_SUBST(CLOCK_GETTIME_LINK)
468 dnl Test whether the compiler supports the -pthread option.
469 AC_CACHE_CHECK([whether -pthread is supported],
470 [libgo_cv_lib_pthread],
471 [CFLAGS_hold=$CFLAGS
472 CFLAGS="$CFLAGS -pthread"
473 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
474 [libgo_cv_lib_pthread=yes],
475 [libgo_cv_lib_pthread=no])
476 CFLAGS=$CFLAGS_hold])
477 PTHREAD_CFLAGS=
478 if test "$libgo_cv_lib_pthread" = yes; then
479   PTHREAD_CFLAGS=-pthread
481 AC_SUBST(PTHREAD_CFLAGS)
483 AM_CONDITIONAL(HAVE_PTHREAD, test "$libgo_cv_lib_pthread" = yes)
485 dnl Test whether the compiler and the linker support the -gdwarf-5 option.
486 AC_CACHE_CHECK([whether -gdwarf-5 is supported],
487 [libbacktrace_cv_lib_dwarf5],
488 [CFLAGS_hold=$CFLAGS
489 CFLAGS="$CFLAGS -gdwarf-5"
490 AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;], [return 0;])],
491 [libbacktrace_cv_lib_dwarf5=yes],
492 [libbacktrace_cv_lib_dwarf5=no])
493 CFLAGS=$CFLAGS_hold])
494 AM_CONDITIONAL(HAVE_DWARF5, test "$libbacktrace_cv_lib_dwarf5" = yes)
496 AC_CHECK_LIB([z], [compress],
497     [AC_DEFINE(HAVE_ZLIB, 1, [Define if -lz is available.])])
498 AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_lib_z_compress" = yes)
500 dnl Test whether the linker supports the --build-id option.
501 AC_CACHE_CHECK([whether --build-id is supported],
502 [libbacktrace_cv_ld_buildid],
503 [LDFLAGS_hold=$LDFLAGS
504 LDFLAGS="$LDFLAGS -Wl,--build-id"
505 AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
506 [libbacktrace_cv_ld_buildid=yes],
507 [libbacktrace_cv_ld_buildid=no])
508 LDFLAGS=$LDFLAGS_hold])
509 AM_CONDITIONAL(HAVE_BUILDID, test "$libbacktrace_cv_ld_buildid" = yes)
511 dnl Test whether the linker supports the --compress-debug-sections=zlib-gnu
512 dnl option.
513 AC_CACHE_CHECK([whether --compress-debug-sections=zlib-gnu is supported],
514 [libgo_cv_ld_compress_zlib_gnu],
515 [LDFLAGS_hold=$LDFLAGS
516 LDFLAGS="$LDFLAGS -Wl,--compress-debug-sections=zlib-gnu"
517 AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
518 [libgo_cv_ld_compress_zlib_gnu=yes],
519 [libgo_cv_ld_compress_zlib_gnu=no])
520 LDFLAGS=$LDFLAGS_hold])
521 AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG_ZLIB_GNU, test "$libgo_cv_ld_compress_zlib_gnu" = yes)
523 AC_CACHE_CHECK([whether --compress-debug-sections=zlib-gabi is supported],
524 [libgo_cv_ld_compress_zlib_gabi],
525 [LDFLAGS_hold=$LDFLAGS
526 LDFLAGS="$LDFLAGS -Wl,--compress-debug-sections=zlib-gabi"
527 AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
528 [libgo_cv_ld_compress_zlib_gabi=yes],
529 [libgo_cv_ld_compress_zlib_gabi=no])
530 LDFLAGS=$LDFLAGS_hold])
531 AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG_ZLIB_GABI, test "$libgo_cv_ld_compress_zlib_gabi" = yes)
533 AC_CHECK_LIB([zstd], [ZSTD_compress],
534     [AC_DEFINE(HAVE_ZSTD, 1, [Define if -lzstd is available.])])
535 AM_CONDITIONAL(HAVE_ZSTD, test "$ac_cv_lib_zstd_ZSTD_compress" = yes)
537 dnl Test whether the linker supports --compress-debug-sections=zstd option.
538 AC_CACHE_CHECK([whether --compress-debug-sections=zstd is supported],
539 [libgo_cv_ld_compress_zstd],
540 [LDFLAGS_hold=$LDFLAGS
541 LDFLAGS="$LDFLAGS -Wl,--compress-debug-sections=zstd"
542 AC_LINK_IFELSE([AC_LANG_PROGRAM(,)],
543 [libgo_cv_ld_compress_zstd=yes],
544 [libgo_cv_ld_compress_zstd=no])
545 LDFLAGS=$LDFLAGS_hold])
546 AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG_ZSTD, test "$libgo_cv_ld_compress_zstd" = yes)
548 AC_ARG_VAR(OBJCOPY, [location of objcopy])
549 AC_CHECK_PROG(OBJCOPY, objcopy, objcopy,)
550 AC_CHECK_PROG(READELF, readelf, readelf)
551 AC_CACHE_CHECK([whether objcopy supports debuglink],
552 [libbacktrace_cv_objcopy_debuglink],
553 [if test -n "${with_target_subdir}"; then
554   libbacktrace_cv_objcopy_debuglink=no
555 elif ! test -n "${OBJCOPY}"; then
556   libbacktrace_cv_objcopy_debuglink=no
557 elif ${OBJCOPY} --help | grep add-gnu-debuglink >/dev/null 2>&1; then
558   libbacktrace_cv_objcopy_debuglink=yes
559 else
560   libbacktrace_cv_objcopy_debuglink=no
561 fi])
562 AM_CONDITIONAL(HAVE_OBJCOPY_DEBUGLINK, test "$libbacktrace_cv_objcopy_debuglink" = yes)
564 AC_ARG_VAR(DSYMUTIL, [location of dsymutil])
565 AC_CHECK_PROG(DSYMUTIL, dsymutil, dsymutil)
566 AM_CONDITIONAL(USE_DSYMUTIL, test -n "${DSYMUTIL}" -a "$FORMAT_FILE" = "macho.lo")
568 AC_ARG_VAR(NM, [location of nm])
569 AC_CHECK_PROG(NM, nm, nm)
571 AC_CHECK_PROG(XZ, xz, xz)
572 AM_CONDITIONAL(HAVE_XZ, test "$XZ" != "")
573 AC_CHECK_PROG(COMM, comm, comm)
574 AM_CONDITIONAL(HAVE_COMM, test "$COMM" != "")
576 AM_CONDITIONAL(HAVE_MINIDEBUG,
577   test "${with_target_subdir}" = "" -a "$FORMAT_FILE" = "elf.lo" -a "${OBJCOPY}" != "" -a "${NM}" != "" -a "${XZ}" != "" -a "${COMM}" != "")
579 AC_CHECK_LIB([lzma], [lzma_auto_decoder],
580     [AC_DEFINE(HAVE_LIBLZMA, 1, [Define if -llzma is available.])])
581 AM_CONDITIONAL(HAVE_LIBLZMA, test "$ac_cv_lib_lzma_lzma_auto_decoder" = yes)
583 AC_CACHE_CHECK([whether tests can run],
584   [libbacktrace_cv_sys_native],
585   [AC_RUN_IFELSE([AC_LANG_PROGRAM([], [return 0;])],
586      [libbacktrace_cv_sys_native=yes],
587      [libbacktrace_cv_sys_native=no],
588      [libbacktrace_cv_sys_native=no])])
589 AM_CONDITIONAL(NATIVE, test "$libbacktrace_cv_sys_native" = "yes")
591 if test "${multilib}" = "yes"; then
592   multilib_arg="--enable-multilib"
593 else
594   multilib_arg=
597 AC_CONFIG_FILES(Makefile backtrace-supported.h)
598 AC_CONFIG_FILES(install-debuginfo-for-buildid.sh, chmod +x install-debuginfo-for-buildid.sh)
600 # We need multilib support, but only if configuring for the target.
601 AC_CONFIG_COMMANDS([default],
602 [if test -n "$CONFIG_FILES"; then
603    if test -n "${with_target_subdir}"; then
604      # Multilibs need MULTISUBDIR defined correctly in certain makefiles so
605      # that multilib installs will end up installed in the correct place.
606      # The testsuite needs it for multilib-aware ABI baseline files.
607      # To work around this not being passed down from config-ml.in ->
608      # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually
609      # append it here.  Only modify Makefiles that have just been created.
610      #
611      # Also, get rid of this simulated-VPATH thing that automake does.
612      cat > vpsed << \_EOF
613   s!`test -f '$<' || echo '$(srcdir)/'`!!
614 _EOF
615      for i in $SUBDIRS; do
616       case $CONFIG_FILES in
617        *${i}/Makefile*)
618          #echo "Adding MULTISUBDIR to $i/Makefile"
619          sed -f vpsed $i/Makefile > tmp
620          grep '^MULTISUBDIR =' Makefile >> tmp
621          mv tmp $i/Makefile
622          ;;
623       esac
624      done
625      rm vpsed
626    fi
627  fi
630 # Variables needed in config.status (file generation) which aren't already
631 # passed by autoconf.
632 SUBDIRS="$SUBDIRS"
635 AC_OUTPUT