From 1b4d33767fde9c55aa2e32f1a313688dc48a6ad4 Mon Sep 17 00:00:00 2001 From: Haru Date: Thu, 13 Aug 2015 03:40:06 +0200 Subject: Added check for execinfo.h/backtrace() to the configure script - This fixes compilation on systems such as FreeBSD, where -lexecinfo is necessary, or Cygwin, where execinfo.h is not available. Signed-off-by: Haru --- configure | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) (limited to 'configure') diff --git a/configure b/configure index b022ca2d5..2500494c9 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in 3bd5d73. +# From configure.in 08e100e. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # @@ -7988,6 +7988,78 @@ else fi +# execinfo (backtrace) +for ac_header in execinfo.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "execinfo.h" "ac_cv_header_execinfo_h" "$ac_includes_default" +if test "x$ac_cv_header_execinfo_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_EXECINFO_H 1 +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing backtrace" >&5 +$as_echo_n "checking for library containing backtrace... " >&6; } +if ${ac_cv_search_backtrace+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char backtrace (); +int +main () +{ +return backtrace (); + ; + return 0; +} +_ACEOF +for ac_lib in '' execinfo; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_backtrace=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_backtrace+:} false; then : + break +fi +done +if ${ac_cv_search_backtrace+:} false; then : + +else + ac_cv_search_backtrace=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_backtrace" >&5 +$as_echo "$ac_cv_search_backtrace" >&6; } +ac_res=$ac_cv_search_backtrace +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + + CFLAGS="$CFLAGS -DHAVE_EXECINFO" + +fi + + +fi + +done + # # MySQL library -- cgit v1.2.3-70-g09d2