AC_LANG_RESTORE
])dnl ACX_PTHREAD
+dnl GUILE_GNU_LD_RELRO
+dnl
dnl Check whether GNU ld's read-only relocations (the `PT_GNU_RELRO'
dnl ELF segment header) are supported. This allows things like
dnl statically allocated cells (1) to eventually be remapped read-only
dnl by the loader, and (2) to be identified as pointerless by the
-dnl garbage collector.
+dnl garbage collector. Substitute `GNU_LD_FLAGS' with the relevant
+dnl flags.
AC_DEFUN([GUILE_GNU_LD_RELRO], [
AC_MSG_CHECKING([whether the linker understands `-z relro'])
+ GNU_LD_FLAGS="-Wl,-z -Wl,relro"
+
save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -Wl,-z -Wl,relro"
+ LDFLAGS="$LDFLAGS $GNU_LD_FLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
- LDFLAGS="$save_LDFLAGS"])
+ GNU_LD_FLAGS=""])
+ LDFLAGS="$save_LDFLAGS"
+
+ AC_SUBST([GNU_LD_FLAGS])
+])
+
+dnl GUILE_THREAD_LOCAL_STORAGE
+dnl
+dnl Check for compiler thread-local storage (TLS) support.
+AC_DEFUN([GUILE_THREAD_LOCAL_STORAGE], [
+ AC_CACHE_CHECK([whether the `__thread' storage class is available],
+ [ac_cv_have_thread_storage_class],
+ [dnl On some systems, e.g., NetBSD 5.0 with GCC 4.1, `__thread' is
+ dnl properly compiled but fails to link due to the lack of TLS
+ dnl support in the C library. Thus we try to link, not just
+ dnl compile. Unfortunately, this test is not enough, so we
+ dnl explicitly check for known-broken systems. See
+ dnl http://lists.gnu.org/archive/html/guile-devel/2009-10/msg00138.html
+ dnl for details.
+ case "x$enable_shared--$host" in
+ xyes--*netbsd[0-5].[0-9])
+ ac_cv_have_thread_storage_class="no"
+ ;;
+ *)
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([__thread int tls_integer;],
+ [tls_integer = 123;])],
+ [ac_cv_have_thread_storage_class="yes"],
+ [ac_cv_have_thread_storage_class="no"])
+ ;;
+ esac])
+
+ if test "x$ac_cv_have_thread_storage_class" = "xyes"; then
+ SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS=1
+ else
+ SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS=0
+ fi
+
+ AC_SUBST([SCM_I_GSC_HAVE_THREAD_STORAGE_CLASS])
])
dnl GUILE_READLINE