From 998f4fdab59d7cb77b391b46ddd317deb574e721 Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Fri, 17 Sep 2010 23:40:06 +0200 Subject: Fix --enable-ethread-pre-pentium4-compatibility The `configure' command line argument `--enable-ethread-pre-pentium4-compatibility' had no effect. --- erts/aclocal.m4 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/erts/aclocal.m4 b/erts/aclocal.m4 index 3b1edd7605..82014fe23d 100644 --- a/erts/aclocal.m4 +++ b/erts/aclocal.m4 @@ -1104,10 +1104,10 @@ AC_ARG_ENABLE(ethread-pre-pentium4-compatibility, [enable compatibility with x86 processors before pentium 4 (back to 486) in the ethread library]), [ case "$enableval" in yes) enable_ethread_pre_pentium4_compatibility=yes ;; - *) enable_ethread_pre_pentium4_compatibilit=no ;; - esac ], enable_ethread_pre_pentium4_compatibilit=no) + *) enable_ethread_pre_pentium4_compatibility=no ;; + esac ], enable_ethread_pre_pentium4_compatibility=no) -test $enable_ethread_pre_pentium4_compatibilit = yes && +test $enable_ethread_pre_pentium4_compatibility = yes && AC_DEFINE(ETHR_PRE_PENTIUM4_COMPAT, 1, [Define if you want compatibilty with x86 processors before pentium4.]) AC_ARG_WITH(libatomic_ops, -- cgit v1.2.3 From 3af1a24cb03a5eae1c47efe1dedbef0233e444b0 Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Tue, 21 Sep 2010 16:38:56 +0200 Subject: Add pre pentium 4 compatibilty configure test --- INSTALL.md | 3 ++- erts/aclocal.m4 | 59 +++++++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 2567b791e5..1061c5187a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -277,7 +277,8 @@ Some of the available `configure` options are: x86 processors before pentium 4 (back to 486) in the ethread library. If not passed the ethread library (part of the runtime system) will use instructions that first appeared on the pentium 4 processor when building - for x86. + for x86. This option will be automatically enabled if required on the + build machine. * `--with-libatomic_ops=PATH` - Use the `libatomic_ops` library for atomic memory accesses. If `configure` should inform you about no native atomic implementation available, you typically want to try using the diff --git a/erts/aclocal.m4 b/erts/aclocal.m4 index 82014fe23d..3a951860e5 100644 --- a/erts/aclocal.m4 +++ b/erts/aclocal.m4 @@ -994,8 +994,8 @@ case "$THR_LIB_NAME" in case "$host_cpu" in sun4u | sparc64 | sun4v) - ethr_have_native_atomics=yes;; - i86pc | i386 | i486 | i586 | i686 | x86_64 | amd64) + ethr_have_native_atomics=yes;; + i86pc | i*86 | x86_64 | amd64) ethr_have_native_atomics=yes;; macppc | ppc | "Power Macintosh") ethr_have_native_atomics=yes;; @@ -1099,21 +1099,60 @@ AC_ARG_ENABLE(prefer-gcc-native-ethr-impls, test $enable_prefer_gcc_native_ethr_impls = yes && AC_DEFINE(ETHR_PREFER_GCC_NATIVE_IMPLS, 1, [Define if you prefer gcc native ethread implementations]) +AC_ARG_WITH(libatomic_ops, + AS_HELP_STRING([--with-libatomic_ops=PATH], + [use libatomic_ops with the ethread library])) + AC_ARG_ENABLE(ethread-pre-pentium4-compatibility, AS_HELP_STRING([--enable-ethread-pre-pentium4-compatibility], [enable compatibility with x86 processors before pentium 4 (back to 486) in the ethread library]), -[ case "$enableval" in - yes) enable_ethread_pre_pentium4_compatibility=yes ;; - *) enable_ethread_pre_pentium4_compatibility=no ;; - esac ], enable_ethread_pre_pentium4_compatibility=no) +[ + case "$enable_ethread_pre_pentium4_compatibility" in + yes|no) ;; + *) enable_ethread_pre_pentium4_compatibility=check;; + esac +], +[enable_ethread_pre_pentium4_compatibility=check]) + +test "$cross_compiling" != "yes" || enable_ethread_pre_pentium4_compatibility=no + +case "$enable_ethread_pre_pentium4_compatibility-$host_cpu" in + check-i86pc | check-i*86) + AC_MSG_CHECKING([whether pre pentium 4 compatibility should forced]) + AC_RUN_IFELSE([ +#if defined(__GNUC__) +# if defined(ETHR_PREFER_LIBATOMIC_OPS_NATIVE_IMPLS) +# define CHECK_LIBATOMIC_OPS__ +# else +# define CHECK_GCC_ASM__ +# endif +#elif defined(ETHR_HAVE_LIBATOMIC_OPS) +# define CHECK_LIBATOMIC_OPS__ +#endif +#if defined(CHECK_LIBATOMIC_OPS__) +#include "atomic_ops.h" +#endif +int main(void) +{ +#if defined(CHECK_GCC_ASM__) + __asm__ __volatile__("mfence" : : : "memory"); +#elif defined(CHECK_LIBATOMIC_OPS__) + AO_nop_full(); +#endif + return 0; +} + ], + [enable_ethread_pre_pentium4_compatibility=no], + [enable_ethread_pre_pentium4_compatibility=yes], + [enable_ethread_pre_pentium4_compatibility=no]) + AC_MSG_RESULT([$enable_ethread_pre_pentium4_compatibility]);; + *) + ;; +esac test $enable_ethread_pre_pentium4_compatibility = yes && AC_DEFINE(ETHR_PRE_PENTIUM4_COMPAT, 1, [Define if you want compatibilty with x86 processors before pentium4.]) -AC_ARG_WITH(libatomic_ops, - AS_HELP_STRING([--with-libatomic_ops=PATH], - [use libatomic_ops with the ethread library])) - AC_DEFINE(ETHR_HAVE_ETHREAD_DEFINES, 1, \ [Define if you have all ethread defines]) -- cgit v1.2.3 From af0f99c6f9e59b478e5852336237d56fb8355cca Mon Sep 17 00:00:00 2001 From: Rickard Green Date: Tue, 21 Sep 2010 16:42:12 +0200 Subject: Allow usage of libatomic_ops when other compilers than gcc are used --- erts/include/internal/ethread.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/erts/include/internal/ethread.h b/erts/include/internal/ethread.h index 4a205699bd..931d692908 100644 --- a/erts/include/internal/ethread.h +++ b/erts/include/internal/ethread.h @@ -239,6 +239,8 @@ typedef DWORD ethr_tsd_key; # include "gcc/ethread.h" # include "libatomic_ops/ethread.h" # endif +# elif defined(ETHR_HAVE_LIBATOMIC_OPS) +# include "libatomic_ops/ethread.h" # elif defined(ETHR_WIN32_THREADS) # include "win/ethread.h" # endif -- cgit v1.2.3