From 69bc814ab18fb85a02eb4e883397317aae79ec13 Mon Sep 17 00:00:00 2001 From: jjgarcia Date: Mon, 24 Oct 2005 08:31:39 +0000 Subject: [PATCH] Check for __thread attribute, but do not use it since it slows down ECL a lot. --- src/aclocal.m4 | 12 ++++++++++ src/configure | 58 ++++++++++++++++++++++++++++++++++++++++++++++-- src/configure.in | 3 ++- 3 files changed, 70 insertions(+), 3 deletions(-) diff --git a/src/aclocal.m4 b/src/aclocal.m4 index 17454b70b..6fb7122fc 100644 --- a/src/aclocal.m4 +++ b/src/aclocal.m4 @@ -519,3 +519,15 @@ if test "$dynamic_ffi" = "yes" ; then AC_DEFINE(ECL_DYNAMIC_FFI, 1, [we can build calls to foreign functions]) fi ]) + +dnl -------------------------------------------------------------- +dnl Provides a test for the existance of the __thread declaration and +dnl defines WITH___THREAD if it is found +AC_DEFUN([ECL___THREAD], +[AC_CACHE_CHECK(for __thread local data, ac_cv_ecl___thread, +AC_TRY_COMPILE(,[static __thread void *data;], + ac_cv_ecl___thread=yes, + ac_cv_ecl___thread=no)) +dnl We deactivate this test because it seems to slow down ECL A LOT!!! +ac_cv_ecl___thread=no +]) diff --git a/src/configure b/src/configure index 9647092a8..ea5bc6456 100755 --- a/src/configure +++ b/src/configure @@ -3605,6 +3605,61 @@ echo $ECHO_N "checking for software type... $ECHO_C" >&6 echo "$as_me:$LINENO: result: ${SOFTWARE_TYPE}" >&5 echo "${ECHO_T}${SOFTWARE_TYPE}" >&6 +echo "$as_me:$LINENO: checking for __thread local data" >&5 +echo $ECHO_N "checking for __thread local data... $ECHO_C" >&6 +if test "${ac_cv_ecl___thread+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +static __thread void *data; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_ecl___thread=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_ecl___thread=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_ecl___thread" >&5 +echo "${ECHO_T}$ac_cv_ecl___thread" >&6 +ac_cv_ecl___thread=no + @@ -3658,7 +3713,6 @@ fi LIBS="${LIBS} -lm" - echo "$as_me:$LINENO: checking for getpwnam in -lsun" >&5 echo $ECHO_N "checking for getpwnam in -lsun... $ECHO_C" >&6 if test "${ac_cv_lib_sun_getpwnam+set}" = set; then @@ -3885,7 +3939,7 @@ cat >>confdefs.h <<\_ACEOF #define ECL_THREADS 1 _ACEOF - if test "${with___thread}" = "yes" ; then + if test "${ac_cv_ecl___thread}" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define WITH___THREAD 1 diff --git a/src/configure.in b/src/configure.in index e9d45d368..cbef8e716 100644 --- a/src/configure.in +++ b/src/configure.in @@ -190,6 +190,7 @@ dnl Checks which do not come with autoconf (must be after AC_PROG_CC) ECL_MAKE_ABSOLUTE_SRCDIR ECL_CROSS_CONFIG ECL_GUESS_HOST_OS +ECL___THREAD AC_SUBST(INFOEXT) AC_SUBST(INSTALL_INFO) @@ -229,7 +230,7 @@ if test "${enable_threads}" = "yes" ; then LIBS="${THREAD_LIBS} ${LIBS}" CFLAGS="${CFLAGS} ${THREAD_CFLAGS}" AC_DEFINE( [ECL_THREADS], [1], [Userland threads?]) - if test "${with___thread}" = "yes" ; then + if test "${ac_cv_ecl___thread}" = "yes" ; then AC_DEFINE( [WITH___THREAD], [1], [__thread thread-local variables?] ) fi fi