mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 09:31:07 +00:00
tweak and re-enable atomic ops detection
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33179 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ac4b932048
commit
3aa5c524e6
2 changed files with 51 additions and 51 deletions
|
@ -194,14 +194,6 @@ static void GSLogZombie(id o, SEL sel)
|
||||||
#undef GSATOMICREAD
|
#undef GSATOMICREAD
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* FIXME: Refrain from using atomic builtins until we know how to reliably check
|
|
||||||
* whether they do work with GCC.
|
|
||||||
*/
|
|
||||||
#ifdef USE_ATOMIC_BUILTINS
|
|
||||||
#undef USE_ATOMIC_BUILTINS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__MINGW__)
|
#if defined(__MINGW__)
|
||||||
#ifndef _WIN64
|
#ifndef _WIN64
|
||||||
|
|
36
configure.ac
36
configure.ac
|
@ -1013,7 +1013,7 @@ AC_USE_SYSTEM_EXTENSIONS
|
||||||
|
|
||||||
AC_LANG_PUSH(C)
|
AC_LANG_PUSH(C)
|
||||||
AC_MSG_CHECKING([whether the compiler supports atomic operations]);
|
AC_MSG_CHECKING([whether the compiler supports atomic operations]);
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[typedef int atomic;]],
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[typedef int atomic;]],
|
||||||
[[atomic x; atomic y; __sync_bool_compare_and_swap(&x, y, y + 1);]])],
|
[[atomic x; atomic y; __sync_bool_compare_and_swap(&x, y, y + 1);]])],
|
||||||
have_atomic=yes,
|
have_atomic=yes,
|
||||||
have_atomic=no);
|
have_atomic=no);
|
||||||
|
@ -1023,8 +1023,7 @@ AC_MSG_CHECKING([whether the compiler supports atomic operations]);
|
||||||
[Define if the compiler provides builtins for atomic operations])
|
[Define if the compiler provides builtins for atomic operations])
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT([no]);
|
AC_MSG_RESULT([no]);
|
||||||
fi
|
if test "$CC" = "gcc"; then
|
||||||
if test "$CC" = "gcc"; then
|
|
||||||
saved_CFLAGS="$CFLAGS";
|
saved_CFLAGS="$CFLAGS";
|
||||||
ATOMIC_CFLAGS="";
|
ATOMIC_CFLAGS="";
|
||||||
|
|
||||||
|
@ -1036,23 +1035,31 @@ if test "$CC" = "gcc"; then
|
||||||
# be removed.
|
# be removed.
|
||||||
case "$target_cpu" in
|
case "$target_cpu" in
|
||||||
i586*|i686*|i786*)
|
i586*|i686*|i786*)
|
||||||
ATOMIC_CFLAGS="-march=i586";
|
ATOMIC_CFLAGS="-march=i586"
|
||||||
CFLAGS="$saved_CFLAGS $ATOMIC_CFLAGS";
|
CFLAGS="$saved_CFLAGS $ATOMIC_CFLAGS"
|
||||||
OBJCFLAGS="$OBJCFLAGS $ATOMIC_CFLAGS";
|
OBJCFLAGS="$OBJCFLAGS $ATOMIC_CFLAGS"
|
||||||
|
;;
|
||||||
|
x86_64)
|
||||||
|
ATOMIC_CFLAGS="-march=x86-64"
|
||||||
|
CFLAGS="$saved_CFLAGS $ATOMIC_CFLAGS"
|
||||||
|
OBJCFLAGS="$OBJCFLAGS $ATOMIC_CFLAGS"
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
AC_MSG_CHECKING([checking whether atomic operations require an external library]);
|
AC_MSG_CHECKING([whether gcc supports atomic operations by setting -march]);
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[typedef int atomic;]],
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[typedef int atomic;]],
|
||||||
[[atomic x; atomic y; __sync_bool_compare_and_swap(&x, y, y + 1);]])],
|
[[atomic x; atomic y; __sync_bool_compare_and_swap(&x, y, y + 1);]])],
|
||||||
need_linkage=no,
|
need_march=yes,
|
||||||
need_linkage=yes);
|
need_march=no);
|
||||||
|
|
||||||
if test "$need_linkage" = "no"; then
|
if test "$need_march" = "yes"; then
|
||||||
AC_MSG_RESULT([no]);
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([yes]);
|
AC_MSG_RESULT([yes]);
|
||||||
|
AC_DEFINE(USE_ATOMIC_BUILTINS,1,
|
||||||
|
[Define if the compiler provides builtins for atomic operations])
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no]);
|
||||||
saved_LDFLAGS="$LDFLAGS";
|
saved_LDFLAGS="$LDFLAGS";
|
||||||
LDFLAGS="$saved_LDFLAGS -lgcc";
|
LDFLAGS="$saved_LDFLAGS -lgcc";
|
||||||
AC_MSG_CHECKING([checking for atomic operations from libgcc]);
|
AC_MSG_CHECKING([whether gcc supports atomic operations by linikng to libgcc]);
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[typedef int atomic;]],
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([[typedef int atomic;]],
|
||||||
[[atomic x; atomic y; __sync_bool_compare_and_swap(&x, y, y + 1);]])],
|
[[atomic x; atomic y; __sync_bool_compare_and_swap(&x, y, y + 1);]])],
|
||||||
atomic_in_libgcc=yes,
|
atomic_in_libgcc=yes,
|
||||||
|
@ -1067,7 +1074,8 @@ if test "$CC" = "gcc"; then
|
||||||
AC_MSG_RESULT([no]);
|
AC_MSG_RESULT([no]);
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
AC_LANG_POP(C)
|
AC_LANG_POP(C)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue