Changeset: de8b9c009644 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=de8b9c009644
Modified Files:
        MonetDB.spec
        configure.ag
        gdk/gdk_atomic.h
Branch: Apr2019
Log Message:

Use atomic_ops on RHEL 6.


diffs (78 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -141,9 +141,8 @@ BuildRequires: geos-devel >= 3.4.0
 BuildRequires: liblas-devel >= 1.8.0
 BuildRequires: pkgconfig(gdal)
 %endif
-%if 0%{?rhel} >= 7
-# On RHEL 7, use the atomic_ops package for atomic operation.
-# On RHEL 6 the package is not available.
+%if %{?rhel:1}%{!?rhel:0}
+# On RHEL, use the atomic_ops package for atomic operation.
 # On Fedora, we use <stdatomic.h> from C11.
 BuildRequires: pkgconfig(atomic_ops)
 %endif
@@ -213,8 +212,8 @@ Summary: MonetDB development files
 Group: Applications/Databases
 Requires: %{name}%{?_isa} = %{version}-%{release}
 Requires: %{name}-stream-devel%{?_isa} = %{version}-%{release}
-%if 0%{?rhel} >= 7
-# RHEL >= 7
+%if %{?rhel:1}%{!?rhel:0}
+# RHEL
 Requires: libatomic_ops-devel
 %endif
 
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2345,8 +2345,34 @@ AC_ARG_WITH([atomic-ops],
                [use atomic_ops library (default=auto)])],
        [have_atomic_ops=$withval])
 AS_VAR_IF([have_atomic_ops], [no], [], [
-       PKG_CHECK_MODULES([atomic_ops], [atomic_ops], [have_atomic_ops=yes],
-               [have_atomic_ops=no; why_not_atomic_ops="(atomic_ops library 
not found)"])
+       PKG_CHECK_MODULES([atomic_ops], [atomic_ops], [have_atomic_ops=yes], [
+               dnl  RHEL 6 doesn't have a pkgconfig file for atomic_ops,
+               dnl  so we also do it the old-fashioned way.
+               dnl  When we drop support for RHEL 6, this whole "not found"
+               dnl  section can be replaced with
+               dnl  [have_atomic_ops=no; why_not_atomic_ops="(atomic_ops 
library not found)"]
+               atomic_ops_CFLAGS=""
+               atomic_ops_LIBS="-latomic_ops"
+               save_CPPFLAGS="$CPPFLAGS"
+               CPPFLAGS="$CPPFLAGS $atomic_ops_CFLAGS"
+               save_LDFLAGS="$LDFLAGS"
+               LDFLAGS="$LDFLAGS $atomic_ops_LIBS"
+               AC_CHECK_HEADER([atomic_ops.h],
+                       [AC_CHECK_LIB([atomic_ops], [AO_pause],
+                               [have_atomic_ops=yes],
+                               [AS_VAR_IF([have_atomic_ops], [auto], [],
+                                       [AC_MSG_ERROR([atomic_ops library not 
found])])
+                                have_atomic_ops=no
+                                atomic_ops_LIBS=
+                                atomic_ops_CFLAGS=
+                                why_not_atomic_ops="(atomic_ops library not 
found)"])],
+                       [AS_VAR_IF([have_atomic_ops], [auto], [],
+                               [AC_MSG_ERROR([atomic_ops.h header not found])])
+                        have_atomic_ops=no
+                        bzip2_LIBS=
+                        why_not_atomic_ops="(atomic_ops.h header not found)"])
+               LDFLAGS="$save_LDFLAGS"
+               CPPFLAGS="$save_CPPFLAGS"])
        AS_VAR_IF([have_atomic_ops], [yes], [
                AS_CASE([$GCC-$CC],
                [-*icc*], [
diff --git a/gdk/gdk_atomic.h b/gdk/gdk_atomic.h
--- a/gdk/gdk_atomic.h
+++ b/gdk/gdk_atomic.h
@@ -149,7 +149,7 @@
 #define ATOMIC_TAS(var)                _InterlockedCompareExchange(var, 1, 0)
 #pragma intrinsic(_InterlockedCompareExchange)
 
-#elif (defined(__GNUC__) || defined(__INTEL_COMPILER)) && !(defined(__sun__) 
&& SIZEOF_SIZE_T == 8) && !defined(_MSC_VER) && !defined(NO_ATOMIC_INSTRUCTIONS)
+#elif (defined(__GNUC__) || defined(__INTEL_COMPILER))  && 
defined(__ATOMIC_SEQ_CST) && !(defined(__sun__) && SIZEOF_SIZE_T == 8) && 
!defined(_MSC_VER) && !defined(NO_ATOMIC_INSTRUCTIONS)
 
 /* the new way of doing this according to GCC (the old way, using
  * __sync_* primitives is not supported) */
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to