From 783653f6a899768d49878311b2c024e437266ef1 Mon Sep 17 00:00:00 2001 From: Nathan Marley Date: Sun, 22 Sep 2019 17:46:45 -0300 Subject: [PATCH] Ensure execinfo.h and linker flags set in autoconf (#3098) * Ensure execinfo.h and linker flags set in autoconf * Only check for backtrace() if not Windows --- configure.ac | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 824732be19..6a8cc20682 100644 --- a/configure.ac +++ b/configure.ac @@ -631,7 +631,7 @@ if test x$TARGET_OS = xdarwin; then AX_CHECK_LINK_FLAG([[-Wl,-dead_strip]], [LDFLAGS="$LDFLAGS -Wl,-dead_strip"]) fi -AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h]) +AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h execinfo.h]) AC_CHECK_DECLS([strnlen]) @@ -735,6 +735,13 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include [ AC_MSG_RESULT(no)] ) +# ensure backtrace() is found, check -lexecinfo if necessary +if test x$TARGET_OS != xwindows; then + AC_SEARCH_LIBS([backtrace], [execinfo], [], [ + AC_MSG_ERROR([Unable to find backtrace()]) + ]) +fi + # Check for reduced exports if test x$use_reduce_exports = xyes; then AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],[RE_CXXFLAGS="-fvisibility=hidden"],