diff options
author | Haru <haru@dotalux.com> | 2019-12-15 18:04:50 +0100 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2020-03-30 06:35:10 +0300 |
commit | 8578597b71e94cbd599eb211665b1f6a2dbc2bb0 (patch) | |
tree | 8fdad8cc7a8f9a46c0afbef0cd0a5374e78fe88b /configure.ac | |
parent | 960d13887d7e1e4d14ae68d72163d639590673b5 (diff) | |
download | hercules-8578597b71e94cbd599eb211665b1f6a2dbc2bb0.tar.gz hercules-8578597b71e94cbd599eb211665b1f6a2dbc2bb0.tar.bz2 hercules-8578597b71e94cbd599eb211665b1f6a2dbc2bb0.tar.xz hercules-8578597b71e94cbd599eb211665b1f6a2dbc2bb0.zip |
Disable libbacktrace by default
It's currently only tested on linux, and doesn't work yet on macOS (tested on 10.15). Further work is necessary
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 383 |
1 files changed, 214 insertions, 169 deletions
diff --git a/configure.ac b/configure.ac index e85e4463a..e13fc4b6c 100644 --- a/configure.ac +++ b/configure.ac @@ -319,7 +319,7 @@ AC_ARG_ENABLE( AC_HELP_STRING( [--enable-libbacktrace@<:@=ARG@:>@], [ - Compiles with libbacktrace. (yes by default) + Compiles with libbacktrace. (no by default - experimental) ] ), [ @@ -330,7 +330,7 @@ AC_ARG_ENABLE( *) AC_MSG_ERROR([[invalid argument --enable-libbacktrace=$enableval... stopping]]);; esac ], - [enable_libbacktrace="yes"] + [enable_libbacktrace="no"] ) # @@ -1415,188 +1415,233 @@ esac # # libbacktrace # -case $enable_libbacktrace in - "no") - # default value - USE_LIBBACKTRACE="no" - ;; - "yes") - CFLAGS="$CFLAGS " - CPPFLAGS="$CPPFLAGS -DHAVE_LIBBACKTRACE" - USE_LIBBACKTRACE="yes" - AC_CHECK_FLAG(-funwind-tables) - ;; -esac +if test "$enable_libbacktrace" = "no" ; then + USE_LIBBACKTRACE="no" +else + CPPFLAGS="$CPPFLAGS -DHAVE_LIBBACKTRACE" + USE_LIBBACKTRACE="yes" + + # libbacktrace checks + AC_CHECK_FLAG(-funwind-tables) + + AC_PROG_AWK + case "$AWK" in + "") + AC_MSG_ERROR([Libbacktrace requires awk to build]) + ;; + esac + + backtrace_supported=yes + AC_CHECK_HEADER([unwind.h], + [AC_CHECK_FUNC([_Unwind_Backtrace], + [BACKTRACE_FILE="backtrace.lo simple.lo"], + [ + BACKTRACE_FILE="nounwind.lo" + backtrace_supported=no + ] + )], + [ + BACKTRACE_FILE="nounwind.lo" + backtrace_supported=no + ] + ) + AC_SUBST(BACKTRACE_FILE) -# libbacktrace checks + AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.]) -AC_PROG_AWK -case "$AWK" in -"") AC_MSG_ERROR([can't build without awk]) ;; -esac + AC_CACHE_CHECK([__sync extensions], + [libbacktrace_cv_sys_sync], + [ + if test -n "${with_target_subdir}"; then + case "${host}" in + hppa*-*-hpux*) + libbacktrace_cv_sys_sync=no + ;; + *) + libbacktrace_cv_sys_sync=yes + ;; + esac + else + AC_LINK_IFELSE( + [ + AC_LANG_PROGRAM([int i;], + [ + __sync_bool_compare_and_swap(&i, i, i); + __sync_lock_test_and_set(&i, 1); + __sync_lock_release(&i); + ] + ) + ], + [libbacktrace_cv_sys_sync=yes], + [libbacktrace_cv_sys_sync=no] + ) + fi + ] + ) + BACKTRACE_SUPPORTS_THREADS=0 + if test "$libbacktrace_cv_sys_sync" = "yes"; then + BACKTRACE_SUPPORTS_THREADS=1 + AC_DEFINE([HAVE_SYNC_FUNCTIONS], 1, [Define to 1 if you have the __sync functions]) + fi + AC_SUBST(BACKTRACE_SUPPORTS_THREADS) -backtrace_supported=yes -AC_CHECK_HEADER([unwind.h], - [AC_CHECK_FUNC([_Unwind_Backtrace], - [BACKTRACE_FILE="backtrace.lo simple.lo"], - [BACKTRACE_FILE="nounwind.lo" - backtrace_supported=no])], - [BACKTRACE_FILE="nounwind.lo" - backtrace_supported=no] -) -AC_SUBST(BACKTRACE_FILE) - -AC_DEFINE(HAVE_GETIPINFO, 1, [Define if _Unwind_GetIPInfo is available.]) - -AC_CACHE_CHECK([__sync extensions], -[libbacktrace_cv_sys_sync], -[if test -n "${with_target_subdir}"; then - case "${host}" in - hppa*-*-hpux*) libbacktrace_cv_sys_sync=no ;; - *) libbacktrace_cv_sys_sync=yes ;; - esac - else - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([int i;], - [__sync_bool_compare_and_swap (&i, i, i); - __sync_lock_test_and_set (&i, 1); - __sync_lock_release (&i);])], - [libbacktrace_cv_sys_sync=yes], - [libbacktrace_cv_sys_sync=no]) - fi]) -BACKTRACE_SUPPORTS_THREADS=0 -if test "$libbacktrace_cv_sys_sync" = "yes"; then - BACKTRACE_SUPPORTS_THREADS=1 - AC_DEFINE([HAVE_SYNC_FUNCTIONS], 1, - [Define to 1 if you have the __sync functions]) -fi -AC_SUBST(BACKTRACE_SUPPORTS_THREADS) - -# Test for __atomic support. -AC_CACHE_CHECK([__atomic extensions], -[libbacktrace_cv_sys_atomic], -[if test -n "${with_target_subdir}"; then - libbacktrace_cv_sys_atomic=yes - else - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([int i;], - [__atomic_load_n (&i, __ATOMIC_ACQUIRE); - __atomic_store_n (&i, 1, __ATOMIC_RELEASE);])], - [libbacktrace_cv_sys_atomic=yes], - [libbacktrace_cv_sys_atomic=no]) - fi]) -if test "$libbacktrace_cv_sys_atomic" = "yes"; then - AC_DEFINE([HAVE_ATOMIC_FUNCTIONS], 1, - [Define to 1 if you have the __atomic functions]) -fi + # Test for __atomic support. + AC_CACHE_CHECK([__atomic extensions], + [libbacktrace_cv_sys_atomic], + [ + if test -n "${with_target_subdir}"; then + libbacktrace_cv_sys_atomic=yes + else + AC_LINK_IFELSE( + [ + AC_LANG_PROGRAM([int i;], + [ + __atomic_load_n(&i, __ATOMIC_ACQUIRE); + __atomic_store_n(&i, 1, __ATOMIC_RELEASE); + ] + ) + ], + [libbacktrace_cv_sys_atomic=yes], + [libbacktrace_cv_sys_atomic=no] + ) + fi + ] + ) + if test "$libbacktrace_cv_sys_atomic" = "yes"; then + AC_DEFINE([HAVE_ATOMIC_FUNCTIONS], 1, [Define to 1 if you have the __atomic functions]) + fi -# The library needs to be able to read the executable itself. Compile -# a file to determine the executable format. The awk script -# filetype.awk prints out the file type. -AC_CACHE_CHECK([output filetype], -[libbacktrace_cv_sys_filetype], -[filetype= -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([int i;], [int j;])], - [filetype=`${AWK} -f $srcdir/3rdparty/libbacktrace/filetype.awk conftest.$ac_objext`], - [AC_MSG_FAILURE([compiler failed])]) -libbacktrace_cv_sys_filetype=$filetype]) - -# Match the file type to decide what files to compile. -LIBBACKTRACE_FORMAT_FILE= -backtrace_supports_data=yes -case "$libbacktrace_cv_sys_filetype" in -elf*) LIBBACKTRACE_FORMAT_FILE="elf.o" ;; -pecoff) LIBBACKTRACE_FORMAT_FILE="pecoff.o" - backtrace_supports_data=no - ;; -xcoff*) LIBBACKTRACE_FORMAT_FILE="xcoff.o" - backtrace_supports_data=no - ;; -macho*) LIBBACKTRACE_FORMAT_FILE="macho.o" - backtrace_supports_data=no - ;; -*) AC_MSG_WARN([could not determine output file type]) - LIBBACKTRACE_FORMAT_FILE="unknown.o" - backtrace_supported=no - ;; -esac -AC_SUBST(LIBBACKTRACE_FORMAT_FILE) - -# ELF defines. -elfsize= -case "$libbacktrace_cv_sys_filetype" in -elf32) elfsize=32 ;; -elf64) elfsize=64 ;; -*) elfsize=unused -esac -AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64]) - -# XCOFF defines. -xcoffsize= -case "$libbacktrace_cv_sys_filetype" in -xcoff32) xcoffsize=32 ;; -xcoff64) xcoffsize=64 ;; -*) xcoffsize=unused -esac -AC_DEFINE_UNQUOTED([BACKTRACE_XCOFF_SIZE], [$xcoffsize], [XCOFF size: 32 or 64]) + # The library needs to be able to read the executable itself. Compile + # a file to determine the executable format. The awk script + # filetype.awk prints out the file type. + AC_CACHE_CHECK([output filetype], + [libbacktrace_cv_sys_filetype], + [ + filetype= + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([int i;], [int j;])], + [filetype=`${AWK} -f $srcdir/3rdparty/libbacktrace/filetype.awk conftest.$ac_objext`], + [AC_MSG_FAILURE([compiler failed])] + ) + libbacktrace_cv_sys_filetype=$filetype + ] + ) -BACKTRACE_SUPPORTED=0 -if test "$backtrace_supported" = "yes"; then - BACKTRACE_SUPPORTED=1 -fi -AC_SUBST(BACKTRACE_SUPPORTED) + # Match the file type to decide what files to compile. + LIBBACKTRACE_FORMAT_FILE= + backtrace_supports_data=yes + case "$libbacktrace_cv_sys_filetype" in + elf*) + LIBBACKTRACE_FORMAT_FILE="elf.o" + ;; + pecoff) + LIBBACKTRACE_FORMAT_FILE="pecoff.o" + backtrace_supports_data=no + ;; + xcoff*) + LIBBACKTRACE_FORMAT_FILE="xcoff.o" + backtrace_supports_data=no + ;; + macho*) + LIBBACKTRACE_FORMAT_FILE="macho.o" + backtrace_supports_data=no + ;; + *) + AC_MSG_WARN([could not determine output file type]) + LIBBACKTRACE_FORMAT_FILE="unknown.o" + backtrace_supported=no + ;; + esac + AC_SUBST(LIBBACKTRACE_FORMAT_FILE) + + # ELF defines. + elfsize= + case "$libbacktrace_cv_sys_filetype" in + elf32) + elfsize=32 + ;; + elf64) + elfsize=64 + ;; + *) + elfsize=unused + esac + AC_DEFINE_UNQUOTED([BACKTRACE_ELF_SIZE], [$elfsize], [ELF size: 32 or 64]) + + # XCOFF defines. + xcoffsize= + case "$libbacktrace_cv_sys_filetype" in + xcoff32) + xcoffsize=32 + ;; + xcoff64) + xcoffsize=64 + ;; + *) + xcoffsize=unused + esac + AC_DEFINE_UNQUOTED([BACKTRACE_XCOFF_SIZE], [$xcoffsize], [XCOFF size: 32 or 64]) + + BACKTRACE_SUPPORTED=0 + if test "$backtrace_supported" = "yes"; then + BACKTRACE_SUPPORTED=1 + fi + AC_SUBST(BACKTRACE_SUPPORTED) -BACKTRACE_SUPPORTS_DATA=0 -if test "$backtrace_supports_data" = "yes"; then - BACKTRACE_SUPPORTS_DATA=1 -fi -AC_SUBST(BACKTRACE_SUPPORTS_DATA) + BACKTRACE_SUPPORTS_DATA=0 + if test "$backtrace_supports_data" = "yes"; then + BACKTRACE_SUPPORTS_DATA=1 + fi + AC_SUBST(BACKTRACE_SUPPORTS_DATA) -AC_CHECK_FUNC(mmap, [have_mmap=yes], [have_mmap=no]) + AC_CHECK_FUNC(mmap, [have_mmap=yes], [have_mmap=no]) -VIEW_FILE=mmapio.lo -ALLOC_FILE=mmap.lo + VIEW_FILE=mmapio.lo + ALLOC_FILE=mmap.lo -AC_SUBST(VIEW_FILE) -AC_SUBST(ALLOC_FILE) + AC_SUBST(VIEW_FILE) + AC_SUBST(ALLOC_FILE) -BACKTRACE_USES_MALLOC=0 -if test "$ALLOC_FILE" = "alloc.lo"; then - BACKTRACE_USES_MALLOC=1 -fi -AC_SUBST(BACKTRACE_USES_MALLOC) + BACKTRACE_USES_MALLOC=0 + if test "$ALLOC_FILE" = "alloc.lo"; then + BACKTRACE_USES_MALLOC=1 + fi + AC_SUBST(BACKTRACE_USES_MALLOC) -AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes], - [have_dl_iterate_phdr=no]) -if test "$have_dl_iterate_phdr" = "yes"; then - AC_DEFINE(HAVE_DL_ITERATE_PHDR, 1, [Define if dl_iterate_phdr is available.]) -fi + AC_CHECK_FUNC([dl_iterate_phdr], [have_dl_iterate_phdr=yes], [have_dl_iterate_phdr=no]) + if test "$have_dl_iterate_phdr" = "yes"; then + AC_DEFINE(HAVE_DL_ITERATE_PHDR, 1, [Define if dl_iterate_phdr is available.]) + fi -# Check for the fcntl function. -if test -n "${with_target_subdir}"; then - case "${host}" in - *-*-mingw*) have_fcntl=no ;; - spu-*-*) have_fcntl=no ;; - *) have_fcntl=yes ;; - esac -else - AC_CHECK_FUNC(fcntl, [have_fcntl=yes], [have_fcntl=no]) -fi -if test "$have_fcntl" = "yes"; then - AC_DEFINE([HAVE_FCNTL], 1, - [Define to 1 if you have the fcntl function]) -fi + # Check for the fcntl function. + if test -n "${with_target_subdir}"; then + case "${host}" in + *-*-mingw*) + have_fcntl=no + ;; + spu-*-*) + have_fcntl=no + ;; + *) + have_fcntl=yes + ;; + esac + else + AC_CHECK_FUNC(fcntl, [have_fcntl=yes], [have_fcntl=no]) + fi + if test "$have_fcntl" = "yes"; then + AC_DEFINE([HAVE_FCNTL], 1, [Define to 1 if you have the fcntl function]) + fi -AC_CHECK_DECLS(strnlen) -AC_CHECK_FUNCS(lstat readlink) + AC_CHECK_DECLS(strnlen) + AC_CHECK_FUNCS(lstat readlink) -AC_CHECK_FUNC(getexecname, [have_getexecname=yes], [have_getexecname=no]) -if test "$have_getexecname" = "yes"; then - AC_DEFINE(HAVE_GETEXECNAME, 1, [Define if getexecname is available.]) + AC_CHECK_FUNC(getexecname, [have_getexecname=yes], [have_getexecname=no]) + if test "$have_getexecname" = "yes"; then + AC_DEFINE(HAVE_GETEXECNAME, 1, [Define if getexecname is available.]) + fi fi - - +AC_SUBST(USE_LIBBACKTRACE) # # Buildbot |