http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52179

--- Comment #12 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-02-23 
15:07:17 UTC ---
(In reply to comment #11)
> Ah, the better way to do that would be to have:
> 
> AC_CHECK_FUNCS([pthread_get_stackaddr_np])
> 
> in configure.ac, and then just have
> 
> #ifdef HAVE_PTHREAD_GET_STACKADDR_NP
> #define STACKBOTTOM (ptr_t)pthread_get_stackaddr_np(pthread_self())
> #endif
> 
> This should cover all the issues with NO_PTHREAD...

Where do you want the second change made? Should I place that in
include/gc_config.h.in (which only contains #undefs right now) or in
include/gc_config_macros.h or in os_dep.c?  I notice that
HAVE_PTHREAD_GETATTR_NP is only used in pthread_support.c. The rest of the
patch looks like...


Index: configure.ac
===================================================================
--- configure.ac    (revision 184508)
+++ configure.ac    (working copy)
@@ -380,6 +380,7 @@ esac
 oldLIBS="$LIBS"
 LIBS="$LIBS $THREADLIBS"
 AC_CHECK_FUNCS([pthread_getattr_np])
+AC_CHECK_FUNCS([pthread_get_stackaddr_np])
 LIBS="$oldLIBS"

 # Configuration of machine-dependent code
Index: include/gc_config.h.in
===================================================================
--- include/gc_config.h.in    (revision 184508)
+++ include/gc_config.h.in    (working copy)
@@ -87,6 +87,9 @@
 /* Define to 1 if you have the `pthread_getattr_np' function. */
 #undef HAVE_PTHREAD_GETATTR_NP

+/* Define to 1 if you have the `pthread_get_stackaddr_np_np' function. */
+#undef HAVE_PTHREAD_GET_STACKADDR_NP
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H

Index: configure
===================================================================
--- configure    (revision 184508)
+++ configure    (working copy)
@@ -15141,6 +15141,17 @@ _ACEOF
 fi
 done

+for ac_func in pthread_get_stackaddr_np
+do :
+  ac_fn_c_check_func "$LINENO" "pthread_get_stackaddr_np"
"ac_cv_func_pthread_get_stackaddr_np"
+if test "x$ac_cv_func_pthread_get_stackaddr_np" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_PTHREAD_GET_STACKADDR_NP 1
+_ACEOF
+
+fi
+done
+
 LIBS="$oldLIBS"

 # Configuration of machine-dependent code

Reply via email to