comparison libbacktrace/configure.ac @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 # configure.ac -- Backtrace configure script. 1 # configure.ac -- Backtrace configure script.
2 # Copyright (C) 2012-2018 Free Software Foundation, Inc. 2 # Copyright (C) 2012-2020 Free Software Foundation, Inc.
3 3
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 7
27 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 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 29 # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 # POSSIBILITY OF SUCH DAMAGE. 30 # POSSIBILITY OF SUCH DAMAGE.
31 31
32 AC_PREREQ(2.64)
33 AC_INIT(package-unused, version-unused,, libbacktrace) 32 AC_INIT(package-unused, version-unused,, libbacktrace)
34 AC_CONFIG_SRCDIR(backtrace.h) 33 AC_CONFIG_SRCDIR(backtrace.h)
35 AC_CONFIG_HEADER(config.h) 34 AC_CONFIG_HEADER(config.h)
36 35
37 if test -n "${with_target_subdir}"; then 36 if test -n "${with_target_subdir}"; then
76 75
77 AC_PROG_AWK 76 AC_PROG_AWK
78 case "$AWK" in 77 case "$AWK" in
79 "") AC_MSG_ERROR([can't build without awk]) ;; 78 "") AC_MSG_ERROR([can't build without awk]) ;;
80 esac 79 esac
80
81 AC_CHECK_PROG(DWZ, dwz, dwz)
82 AM_CONDITIONAL(HAVE_DWZ, test "$DWZ" != "")
81 83
82 LT_INIT 84 LT_INIT
83 AM_PROG_LIBTOOL 85 AM_PROG_LIBTOOL
84 86
85 AC_SYS_LARGEFILE 87 AC_SYS_LARGEFILE
255 elf32) elfsize=32 ;; 257 elf32) elfsize=32 ;;
256 elf64) elfsize=64 ;; 258 elf64) elfsize=64 ;;
257 *) elfsize=unused 259 *) elfsize=unused
258 esac 260 esac
259 AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64]) 261 AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64])
262 AM_CONDITIONAL(HAVE_ELF, test "$FORMAT_FILE" = "elf.lo")
260 263
261 # XCOFF defines. 264 # XCOFF defines.
262 xcoffsize= 265 xcoffsize=
263 case "$libbacktrace_cv_sys_filetype" in 266 case "$libbacktrace_cv_sys_filetype" in
264 xcoff32) xcoffsize=32 ;; 267 xcoff32) xcoffsize=32 ;;
288 if test -n "${with_target_subdir}"; then 291 if test -n "${with_target_subdir}"; then
289 # When built as a GCC target library, we can't do a link test. We 292 # When built as a GCC target library, we can't do a link test. We
290 # simply assume that if we have mman.h, we have mmap. 293 # simply assume that if we have mman.h, we have mmap.
291 have_mmap=yes 294 have_mmap=yes
292 case "${host}" in 295 case "${host}" in
293 spu-*-*|*-*-msdosdjgpp) 296 *-*-msdosdjgpp)
294 # The SPU does not have mmap, but it has a sys/mman.h header file 297 # DJGPP has sys/man.h, but no mmap
295 # containing "mmap_eaddr" and the mmap flags, confusing the test.
296 # DJGPP also has sys/man.h, but no mmap
297 have_mmap=no ;; 298 have_mmap=no ;;
298 esac 299 esac
299 else 300 else
300 AC_CHECK_FUNC(mmap, [have_mmap=yes], [have_mmap=no]) 301 AC_CHECK_FUNC(mmap, [have_mmap=yes], [have_mmap=no])
301 fi 302 fi
303 if test "$have_mmap" = "no"; then 304 if test "$have_mmap" = "no"; then
304 VIEW_FILE=read.lo 305 VIEW_FILE=read.lo
305 ALLOC_FILE=alloc.lo 306 ALLOC_FILE=alloc.lo
306 else 307 else
307 VIEW_FILE=mmapio.lo 308 VIEW_FILE=mmapio.lo
308 AC_PREPROC_IFELSE([ 309 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
309 #include <sys/mman.h> 310 #include <sys/mman.h>
310 #if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON) 311 #if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON)
311 #error no MAP_ANONYMOUS 312 #error no MAP_ANONYMOUS
312 #endif 313 #endif
313 ], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo]) 314 ])], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo])
314 fi 315 fi
315 AC_SUBST(VIEW_FILE) 316 AC_SUBST(VIEW_FILE)
316 AC_SUBST(ALLOC_FILE) 317 AC_SUBST(ALLOC_FILE)
317 318
318 BACKTRACE_USES_MALLOC=0 319 BACKTRACE_USES_MALLOC=0
328 else 329 else
329 if test -n "${with_target_subdir}"; then 330 if test -n "${with_target_subdir}"; then
330 # When built as a GCC target library, we can't do a link test. 331 # When built as a GCC target library, we can't do a link test.
331 AC_EGREP_HEADER([dl_iterate_phdr], [link.h], [have_dl_iterate_phdr=yes], 332 AC_EGREP_HEADER([dl_iterate_phdr], [link.h], [have_dl_iterate_phdr=yes],
332 [have_dl_iterate_phdr=no]) 333 [have_dl_iterate_phdr=no])
333 case "${host}" in
334 *-*-solaris2.10*)
335 # Avoid dl_iterate_phdr on Solaris 10, where it is in the
336 # header file but is only in -ldl.
337 have_dl_iterate_phdr=no ;;
338 esac
339 else 334 else
340 AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes], 335 AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes],
341 [have_dl_iterate_phdr=no]) 336 [have_dl_iterate_phdr=no])
342 fi 337 fi
343 fi 338 fi
365 360
366 # Check for the fcntl function. 361 # Check for the fcntl function.
367 if test -n "${with_target_subdir}"; then 362 if test -n "${with_target_subdir}"; then
368 case "${host}" in 363 case "${host}" in
369 *-*-mingw*) have_fcntl=no ;; 364 *-*-mingw*) have_fcntl=no ;;
370 spu-*-*) have_fcntl=no ;;
371 *) have_fcntl=yes ;; 365 *) have_fcntl=yes ;;
372 esac 366 esac
373 else 367 else
374 AC_CHECK_FUNC(fcntl, [have_fcntl=yes], [have_fcntl=no]) 368 AC_CHECK_FUNC(fcntl, [have_fcntl=yes], [have_fcntl=no])
375 fi 369 fi
412 dnl Test whether the compiler supports the -pthread option. 406 dnl Test whether the compiler supports the -pthread option.
413 AC_CACHE_CHECK([whether -pthread is supported], 407 AC_CACHE_CHECK([whether -pthread is supported],
414 [libgo_cv_lib_pthread], 408 [libgo_cv_lib_pthread],
415 [CFLAGS_hold=$CFLAGS 409 [CFLAGS_hold=$CFLAGS
416 CFLAGS="$CFLAGS -pthread" 410 CFLAGS="$CFLAGS -pthread"
417 AC_COMPILE_IFELSE([[int i;]], 411 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
418 [libgo_cv_lib_pthread=yes], 412 [libgo_cv_lib_pthread=yes],
419 [libgo_cv_lib_pthread=no]) 413 [libgo_cv_lib_pthread=no])
420 CFLAGS=$CFLAGS_hold]) 414 CFLAGS=$CFLAGS_hold])
421 PTHREAD_CFLAGS= 415 PTHREAD_CFLAGS=
422 if test "$libgo_cv_lib_pthread" = yes; then 416 if test "$libgo_cv_lib_pthread" = yes; then
423 PTHREAD_CFLAGS=-pthread 417 PTHREAD_CFLAGS=-pthread
424 fi 418 fi
425 AC_SUBST(PTHREAD_CFLAGS) 419 AC_SUBST(PTHREAD_CFLAGS)
426 420
427 AM_CONDITIONAL(HAVE_PTHREAD, test "$libgo_cv_lib_pthread" = yes) 421 AM_CONDITIONAL(HAVE_PTHREAD, test "$libgo_cv_lib_pthread" = yes)
422
423 dnl Test whether the compiler supports the -gdwarf-5 option.
424 AC_CACHE_CHECK([whether -gdwarf-5 is supported],
425 [libbacktrace_cv_lib_dwarf5],
426 [CFLAGS_hold=$CFLAGS
427 CFLAGS="$CFLAGS -gdwarf-5"
428 AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
429 [libbacktrace_cv_lib_dwarf5=yes],
430 [libbacktrace_cv_lib_dwarf5=no])
431 CFLAGS=$CFLAGS_hold])
432 AM_CONDITIONAL(HAVE_DWARF5, test "$libbacktrace_cv_lib_dwarf5" = yes)
428 433
429 AC_CHECK_LIB([z], [compress], 434 AC_CHECK_LIB([z], [compress],
430 [AC_DEFINE(HAVE_ZLIB, 1, [Define if -lz is available.])]) 435 [AC_DEFINE(HAVE_ZLIB, 1, [Define if -lz is available.])])
431 AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_lib_z_compress" = yes) 436 AM_CONDITIONAL(HAVE_ZLIB, test "$ac_cv_lib_z_compress" = yes)
432 437
441 LDFLAGS=$LDFLAGS_hold]) 446 LDFLAGS=$LDFLAGS_hold])
442 AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG, test "$libgo_cv_ld_compress" = yes) 447 AM_CONDITIONAL(HAVE_COMPRESSED_DEBUG, test "$libgo_cv_ld_compress" = yes)
443 448
444 AC_ARG_VAR(OBJCOPY, [location of objcopy]) 449 AC_ARG_VAR(OBJCOPY, [location of objcopy])
445 AC_CHECK_PROG(OBJCOPY, objcopy, objcopy,) 450 AC_CHECK_PROG(OBJCOPY, objcopy, objcopy,)
451 AC_CHECK_PROG(READELF, readelf, readelf)
446 AC_CACHE_CHECK([whether objcopy supports debuglink], 452 AC_CACHE_CHECK([whether objcopy supports debuglink],
447 [libbacktrace_cv_objcopy_debuglink], 453 [libbacktrace_cv_objcopy_debuglink],
448 [if test -n "${with_target_subdir}"; then 454 [if test -n "${with_target_subdir}"; then
449 libbacktrace_cv_objcopy_debuglink=no 455 libbacktrace_cv_objcopy_debuglink=no
450 elif ${OBJCOPY} --add-gnu-debuglink=x /bin/ls /tmp/ls$$; then 456 elif ${OBJCOPY} --add-gnu-debuglink=x /bin/ls /tmp/ls$$; then
468 else 474 else
469 multilib_arg= 475 multilib_arg=
470 fi 476 fi
471 477
472 AC_CONFIG_FILES(Makefile backtrace-supported.h) 478 AC_CONFIG_FILES(Makefile backtrace-supported.h)
479 AC_CONFIG_FILES(install-debuginfo-for-buildid.sh, chmod +x install-debuginfo-for-buildid.sh)
473 480
474 # We need multilib support, but only if configuring for the target. 481 # We need multilib support, but only if configuring for the target.
475 AC_CONFIG_COMMANDS([default], 482 AC_CONFIG_COMMANDS([default],
476 [if test -n "$CONFIG_FILES"; then 483 [if test -n "$CONFIG_FILES"; then
477 if test -n "${with_target_subdir}"; then 484 if test -n "${with_target_subdir}"; then