From 78d815c9deaf7ce665110d7738482421d25b2ff0 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Sun, 17 Jan 2010 14:06:20 -0800 Subject: [PATCH] Add the --disable-tls configure option. --- jemalloc/INSTALL | 6 ++++ jemalloc/configure.ac | 81 +++++++++++++++++++++++++------------------ 2 files changed, 53 insertions(+), 34 deletions(-) diff --git a/jemalloc/INSTALL b/jemalloc/INSTALL index 5cccb4ec..8d94e179 100644 --- a/jemalloc/INSTALL +++ b/jemalloc/INSTALL @@ -89,6 +89,12 @@ any of the following arguments (not a definitive list) to 'configure': practice, this feature usually has little impact on performance unless thread-specific caching is disabled. +--disable-tls + Disable thread-local storage (TLS), which allows for fast access to + thread-local variables via the __thread keyword. If TLS is available, + jemalloc uses it for several purposes. Not that disabling TLS implies + --disable-tcache. + The following environment variables (not a definitive list) impact configure's behavior: diff --git a/jemalloc/configure.ac b/jemalloc/configure.ac index f37c2e83..f6226824 100644 --- a/jemalloc/configure.ac +++ b/jemalloc/configure.ac @@ -223,7 +223,7 @@ AC_SUBST([RPATH_EXTRA]) dnl Disable rules that do automatic regeneration of configure output by default. AC_ARG_ENABLE([autogen], - [AS_HELP_STRING[--enable-autogen], [Automatically regenerate configure output])], + [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])], if test "x$enable_autogen" = "xno" ; then enable_autogen="0" else @@ -548,39 +548,6 @@ AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"], CPPFLAGS="$CPPFLAGS -D_REENTRANT" -AC_MSG_CHECKING([for TLS]) -AC_RUN_IFELSE([AC_LANG_PROGRAM( -[[ - __thread int x; -]], [[ - x = 42; - - return 0; -]])], - AC_MSG_RESULT([yes]) - have_tls="1", - AC_MSG_RESULT([no]) - have_tls="0" - AC_DEFINE_UNQUOTED([NO_TLS], [ ])) - -dnl Finish tcache-related definitions, now that TLS configuration is done. -if test "x$have_tls" = "x0" ; then - enable_tcache="0" -fi -if test "x$enable_tcache" = "x1" ; then - AC_DEFINE([JEMALLOC_TCACHE], [ ]) -fi -AC_SUBST([enable_tcache]) -if test "x$enable_tcache" = "x0" ; then - roff_tcache=".\\\" " - roff_no_tcache="" -else - roff_tcache="" - roff_no_tcache=".\\\" " -fi -AC_SUBST([roff_tcache]) -AC_SUBST([roff_no_tcache]) - dnl Enable lazy locking by default. AC_ARG_ENABLE([lazy_lock], [AS_HELP_STRING([--disable-lazy-lock], @@ -601,6 +568,52 @@ if test "x$enable_lazy_lock" = "x1" ; then fi AC_SUBST([enable_lazy_lock]) +AC_ARG_ENABLE([tls], + [AS_HELP_STRING([--disable-tls], [Disable thread-local storage (__thread keyword)])], +if test "x$enable_tls" = "xno" ; then + enable_tls="0" +else + enable_tls="1" +fi +, +enable_tls="1" +) +if test "x${enable_tls}" = "x1" ; then +AC_MSG_CHECKING([for TLS]) +AC_RUN_IFELSE([AC_LANG_PROGRAM( +[[ + __thread int x; +]], [[ + x = 42; + + return 0; +]])], + AC_MSG_RESULT([yes]), + AC_MSG_RESULT([no]) + enable_tls="0") +fi +if test "x${enable_tls}" = "x0" ; then + AC_DEFINE_UNQUOTED([NO_TLS], [ ]) +fi + +dnl Finish tcache-related definitions, now that TLS configuration is done. +if test "x$enable_tls" = "x0" ; then + enable_tcache="0" +fi +if test "x$enable_tcache" = "x1" ; then + AC_DEFINE([JEMALLOC_TCACHE], [ ]) +fi +AC_SUBST([enable_tcache]) +if test "x$enable_tcache" = "x0" ; then + roff_tcache=".\\\" " + roff_no_tcache="" +else + roff_tcache="" + roff_no_tcache=".\\\" " +fi +AC_SUBST([roff_tcache]) +AC_SUBST([roff_no_tcache]) + dnl ============================================================================ dnl Configure libgd for mtrgraph. bins="${objroot}bin/jemtr2mtr${install_suffix}"