You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-cpp/commoncpp2/files/1.6.1-gcc42_atomicity.patch

64 lines
2.1 KiB

diff -Naur commoncpp2-1.6.1.orig/m4/ost_pthread.m4 commoncpp2-1.6.1/m4/ost_pthread.m4
--- commoncpp2-1.6.1.orig/m4/ost_pthread.m4 2008-05-06 10:47:42.000000000 +0200
+++ commoncpp2-1.6.1/m4/ost_pthread.m4 2008-05-06 16:11:05.000000000 +0200
@@ -92,7 +92,9 @@
dnl check for gcc's bits/atomicity and the atomic functions therein
AC_CHECK_HEADERS([bits/atomicity.h],
ost_cv_bits_atomicity=yes,
- ost_cv_bits_atomicity=no)
+ [AC_CHECK_HEADERS([ext/atomicity.h],
+ ost_cv_bits_atomicity=yes,
+ ost_cv_bits_atomicity=no)])
if test $ost_cv_bits_atomicity = yes ; then
AC_MSG_CHECKING([for _Atomic_word])
AC_TRY_COMPILE([#include <bits/atomicity.h>],
@@ -103,7 +105,15 @@
],
[ost_cv_gcc_atomic=yes
AC_DEFINE(HAVE_GCC_BITS_ATOMIC, [1], [has gcc atomic functions])],
- [ost_cv_gcc_atomic=no])
+ [AC_TRY_COMPILE([#include <ext/atomicity.h>],
+ [
+ _Atomic_word i = 0;
+ __atomic_add(&i, 1);
+ __exchange_and_add(&i, 1);
+ ],
+ [ost_cv_gcc_atomic=yes
+ AC_DEFINE(HAVE_GCC_BITS_ATOMIC, [1], [has gcc atomic functions])],
+ [ost_cv_gcc_atomic=no])])
AC_MSG_RESULT($ost_cv_gcc_atomic)
AC_MSG_CHECKING([for __gnu_cxx::_Atomic_word])
@@ -117,7 +127,17 @@
[ost_cv_gcc_cxx_atomic=yes
AC_DEFINE(HAVE_GCC_CXX_BITS_ATOMIC, [1],
[has __gnu_cxx atomic functions])],
- [ost_cv_gcc_cxx_atomic=no])
+ [AC_TRY_COMPILE([#include <ext/atomicity.h>],
+ [
+ using namespace __gnu_cxx;
+ _Atomic_word i = 0;
+ __atomic_add(&i, 1);
+ __exchange_and_add(&i, 1);
+ ],
+ [ost_cv_gcc_cxx_atomic=yes
+ AC_DEFINE(HAVE_GCC_CXX_BITS_ATOMIC, [1],
+ [has __gnu_cxx atomic functions])],
+ [ost_cv_gcc_cxx_atomic=no])])
AC_MSG_RESULT($ost_cv_gcc_cxx_atomic)
fi
@@ -438,7 +458,11 @@
#if defined(__cplusplus)
#if defined(HAVE_GCC_BITS_ATOMIC) || defined(HAVE_GCC_CXX_BITS_ATOMIC)
-#include <bits/atomicity.h>
+#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2))
+ #include <ext/atomicity.h>
+#else
+ #include <bits/atomicity.h>
+#endif
#define HAVE_ATOMIC
#endif
#endif