diff mbox

[PING] boehm-gc: check for execinfo.h directly

Message ID 1465839643-24779-1-git-send-email-vapier@gentoo.org
State New
Headers show

Commit Message

Mike Frysinger June 13, 2016, 5:40 p.m. UTC
The current header depends on glibc version checks to determine whether
execinfo.h exists which breaks uClibc.  Instead, add an explicit configure
check for it.

2015-08-29  Mike Frysinger  <vapier@gentoo.org>

	* configure.ac: Call AC_CHECK_HEADERS([execinfo.h]).
	* configure: Regenerated.
	* include/gc.h [HAVE_EXECINFO_H]: Define GC_HAVE_BUILTIN_BACKTRACE.
	* include/gc_config.h.in: Regenerated.
---
 boehm-gc/configure              | 105 +++++++++++++++++++++++++++++++++++++++-
 boehm-gc/configure.ac           |   3 ++
 boehm-gc/include/gc.h           |   2 +-
 boehm-gc/include/gc_config.h.in |   3 ++
 4 files changed, 110 insertions(+), 3 deletions(-)

Comments

Jeff Law June 21, 2016, 9:46 p.m. UTC | #1
On 06/13/2016 11:40 AM, Mike Frysinger wrote:
> The current header depends on glibc version checks to determine whether
> execinfo.h exists which breaks uClibc.  Instead, add an explicit configure
> check for it.
>
> 2015-08-29  Mike Frysinger  <vapier@gentoo.org>
>
> 	* configure.ac: Call AC_CHECK_HEADERS([execinfo.h]).
> 	* configure: Regenerated.
> 	* include/gc.h [HAVE_EXECINFO_H]: Define GC_HAVE_BUILTIN_BACKTRACE.
> 	* include/gc_config.h.in: Regenerated.
Shouldn't this be going to the upstream Boehm-GC project?  You should be 
able to find information here on how to get the patch into the official 
Boehm-GC project:


http://hboehm.info/gc/

If accepted into upstream Boehm-GC, then this is obviously acceptable in 
GCC's copy.

jeff
Mike Frysinger June 22, 2016, 12:59 a.m. UTC | #2
On 21 Jun 2016 15:46, Jeff Law wrote:
> On 06/13/2016 11:40 AM, Mike Frysinger wrote:
> > The current header depends on glibc version checks to determine whether
> > execinfo.h exists which breaks uClibc.  Instead, add an explicit configure
> > check for it.
> >
> > 2015-08-29  Mike Frysinger  <vapier@gentoo.org>
> >
> > 	* configure.ac: Call AC_CHECK_HEADERS([execinfo.h]).
> > 	* configure: Regenerated.
> > 	* include/gc.h [HAVE_EXECINFO_H]: Define GC_HAVE_BUILTIN_BACKTRACE.
> > 	* include/gc_config.h.in: Regenerated.
> 
> Shouldn't this be going to the upstream Boehm-GC project?  You should be 
> able to find information here on how to get the patch into the official 
> Boehm-GC project:

thanks ... didn't realize this was an embedded upstream project.
i've sent my patch there now:
	https://github.com/ivmai/bdwgc/pull/123

> If accepted into upstream Boehm-GC, then this is obviously acceptable in 
> GCC's copy.

so changes can be pushed directly if it's already in upstream ?
my original goal is already fixed in upstream, but it's not in
gcc's copy ...
-mike
Jeff Law June 22, 2016, 3:10 a.m. UTC | #3
On 06/21/2016 06:59 PM, Mike Frysinger wrote:
> On 21 Jun 2016 15:46, Jeff Law wrote:
>
>> If accepted into upstream Boehm-GC, then this is obviously acceptable in
>> GCC's copy.
>
> so changes can be pushed directly if it's already in upstream ?
> my original goal is already fixed in upstream, but it's not in
> gcc's copy ...
Yes.  Ideally we'd just resync at some point in the near future, but if 
you want to cherry-pick a fix from upstream so it gets fixed sooner, 
that's fine.

jeff
diff mbox

Patch

diff --git a/boehm-gc/configure b/boehm-gc/configure
index a8e11dab41b3..7d2b1f7401f7 100755
--- a/boehm-gc/configure
+++ b/boehm-gc/configure
@@ -1945,6 +1945,93 @@  $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
 
 } # ac_fn_c_check_member
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_mongrel
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -11322,7 +11409,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11325 "configure"
+#line 11412 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11428,7 +11515,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11431 "configure"
+#line 11518 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15053,6 +15140,20 @@  fi
     ;;
 esac
 
+# Check for various headers.
+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" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_EXECINFO_H 1
+_ACEOF
+
+fi
+
+done
+
+
 # extra LD Flags which are required for targets
 case "${host}" in
   *-*-darwin*)
diff --git a/boehm-gc/configure.ac b/boehm-gc/configure.ac
index 1ccfe37e9d86..ea90ab205b53 100644
--- a/boehm-gc/configure.ac
+++ b/boehm-gc/configure.ac
@@ -317,6 +317,9 @@  case "$host" in
     ;;
 esac
 
+# Check for various headers.
+AC_CHECK_HEADERS([execinfo.h])
+
 # extra LD Flags which are required for targets
 case "${host}" in
   *-*-darwin*)
diff --git a/boehm-gc/include/gc.h b/boehm-gc/include/gc.h
index 6b38f2d0e6ca..bf50b294a3a7 100644
--- a/boehm-gc/include/gc.h
+++ b/boehm-gc/include/gc.h
@@ -503,7 +503,7 @@  GC_API GC_PTR GC_malloc_atomic_ignore_off_page GC_PROTO((size_t lb));
 #if defined(__linux__) || defined(__GLIBC__)
 # include <features.h>
 # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1 || __GLIBC__ > 2) \
-     && !defined(__ia64__)
+     && !defined(__ia64__) && defined(HAVE_EXECINFO_H)
 #   ifndef GC_HAVE_BUILTIN_BACKTRACE
 #     define GC_HAVE_BUILTIN_BACKTRACE
 #   endif
diff --git a/boehm-gc/include/gc_config.h.in b/boehm-gc/include/gc_config.h.in
index 7ef9822c578e..818ce0999553 100644
--- a/boehm-gc/include/gc_config.h.in
+++ b/boehm-gc/include/gc_config.h.in
@@ -75,6 +75,9 @@ 
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define to 1 if you have the <execinfo.h> header file. */
+#undef HAVE_EXECINFO_H
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H