|
|
e3d4ae |
Patch by Shawn Landden <shawnlandden@gmail.com> for kyotocabinet >= 1.2.76, which fixes
|
|
|
e3d4ae |
the configure test to handle lack of 8 byte atomics correctly as is the case with ARM 32
|
|
|
e3d4ae |
bit on all Fedora releases, Intel 32 bit on RHEL 5 and PowerPC 32 bit on RHEL 5 and all
|
|
|
e3d4ae |
Fedora releases.
|
|
|
e3d4ae |
|
|
|
e3d4ae |
--- kyotocabinet-1.2.76/configure.in 2012-05-24 13:31:42.000000000 +0200
|
|
|
e3d4ae |
+++ kyotocabinet-1.2.76/configure.in.8-byte-atomics 2013-03-01 00:21:21.000000000 +0100
|
|
|
e3d4ae |
@@ -238,9 +238,22 @@
|
|
|
e3d4ae |
# Atomic operations
|
|
|
e3d4ae |
if test "$enable_atomic" != "no"
|
|
|
e3d4ae |
then
|
|
|
e3d4ae |
- printf 'checking for atomic operations... '
|
|
|
e3d4ae |
- AC_TRY_COMPILE([], [__sync_fetch_and_add], [MYGCCATOMIC=yes], [MYGCCATOMIC=no])
|
|
|
e3d4ae |
- if test "$MYGCCATOMIC" = "yes"
|
|
|
e3d4ae |
+ printf 'checking for 8 byte atomic operations... '
|
|
|
e3d4ae |
+ if printf '
|
|
|
e3d4ae |
+/* Some targets support 4 byte atomics, but not 8 byte atomics,
|
|
|
e3d4ae |
+ * and will fail at link time if they are used.
|
|
|
e3d4ae |
+ *
|
|
|
e3d4ae |
+ * http://gcc.gnu.org/onlinedocs/gcc-4.6.3/gcc/Atomic-Builtins.html
|
|
|
e3d4ae |
+ * http://gcc.gnu.org/wiki/Atomic
|
|
|
e3d4ae |
+ */
|
|
|
e3d4ae |
+#include <stdint.h>
|
|
|
e3d4ae |
+int
|
|
|
e3d4ae |
+main ()
|
|
|
e3d4ae |
+{
|
|
|
e3d4ae |
+uint64_t n = 0xdeadbeaf;
|
|
|
e3d4ae |
+__sync_bool_compare_and_swap(&n, 0xdeadbeaf, 0);
|
|
|
e3d4ae |
+return n;
|
|
|
e3d4ae |
+}' | $CC -xc -o config.tmp - >/dev/null 2>&1
|
|
|
e3d4ae |
then
|
|
|
e3d4ae |
MYCPPFLAGS="$MYCPPFLAGS -D_MYGCCATOMIC"
|
|
|
e3d4ae |
printf 'yes\n'
|
|
|
e3d4ae |
--- kyotocabinet-1.2.76/configure 2012-05-24 13:31:45.000000000 +0200
|
|
|
e3d4ae |
+++ kyotocabinet-1.2.76/configure.8-byte-atomics 2013-03-01 00:22:37.000000000 +0100
|
|
|
e3d4ae |
@@ -4012,25 +4012,22 @@
|
|
|
e3d4ae |
# Atomic operations
|
|
|
e3d4ae |
if test "$enable_atomic" != "no"
|
|
|
e3d4ae |
then
|
|
|
e3d4ae |
- printf 'checking for atomic operations... '
|
|
|
e3d4ae |
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
|
|
e3d4ae |
-/* end confdefs.h. */
|
|
|
e3d4ae |
-
|
|
|
e3d4ae |
+ printf 'checking for 8 byte atomic operations... '
|
|
|
e3d4ae |
+ if printf '
|
|
|
e3d4ae |
+/* Some targets support 4 byte atomics, but not 8 byte atomics,
|
|
|
e3d4ae |
+ * and will fail at link time if they are used.
|
|
|
e3d4ae |
+ *
|
|
|
e3d4ae |
+ * http://gcc.gnu.org/onlinedocs/gcc-4.6.3/gcc/Atomic-Builtins.html
|
|
|
e3d4ae |
+ * http://gcc.gnu.org/wiki/Atomic
|
|
|
e3d4ae |
+ */
|
|
|
e3d4ae |
+#include <stdint.h>
|
|
|
e3d4ae |
int
|
|
|
e3d4ae |
main ()
|
|
|
e3d4ae |
{
|
|
|
e3d4ae |
-__sync_fetch_and_add
|
|
|
e3d4ae |
- ;
|
|
|
e3d4ae |
- return 0;
|
|
|
e3d4ae |
-}
|
|
|
e3d4ae |
-_ACEOF
|
|
|
e3d4ae |
-if ac_fn_cxx_try_compile "$LINENO"; then :
|
|
|
e3d4ae |
- MYGCCATOMIC=yes
|
|
|
e3d4ae |
-else
|
|
|
e3d4ae |
- MYGCCATOMIC=no
|
|
|
e3d4ae |
-fi
|
|
|
e3d4ae |
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
|
|
e3d4ae |
- if test "$MYGCCATOMIC" = "yes"
|
|
|
e3d4ae |
+uint64_t n = 0xdeadbeaf;
|
|
|
e3d4ae |
+__sync_bool_compare_and_swap(&n, 0xdeadbeaf, 0);
|
|
|
e3d4ae |
+return n;
|
|
|
e3d4ae |
+}' | $CC -xc -o config.tmp - >/dev/null 2>&1
|
|
|
e3d4ae |
then
|
|
|
e3d4ae |
MYCPPFLAGS="$MYCPPFLAGS -D_MYGCCATOMIC"
|
|
|
e3d4ae |
printf 'yes\n'
|