Re: fontconfig: Branch 'master' - 23 commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Behdad Esfahbod wrote:
Thanks Raimund.  Can you also provide th configure magic for that?

I've attached a new diff against master. Is that OK?

I've basically added a call to __memory_rw_barrier to the existing configure test and applied the modifications from my last mail to fcatomic.h. This works for me now.

Raimund




--
Worringer Str 31 Duesseldorf 40211 DE  home: <rs@xxxxxxxx>
+49-179-2981632 icq 16845346           work: <rs@xxxxxxxxxxxxxxx>
diff --git a/configure.ac b/configure.ac
index 803084c..0e5b1ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -592,8 +592,24 @@ if $fc_cv_have_intel_atomic_primitives; then
 	AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives])
 fi
 
+AC_CACHE_CHECK([for Solaris atomic operations], fc_cv_have_solaris_atomic_ops, [
+	fc_cv_have_solaris_atomic_ops=false
+	AC_TRY_LINK([
+		#include <atomic.h>
+		/* This requires Solaris Studio 12.2 or newer: */
+		#include <mbarrier.h>
+		void memory_barrier (void) { __machine_rw_barrier (); }
+		int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); }
+		void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); }
+		], [], fc_cv_have_solaris_atomic_ops=true
+	)
+])
+if $fc_cv_have_solaris_atomic_ops; then
+	AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations])
+fi
+
 AC_CHECK_HEADERS(sched.h)
-AC_CHECK_FUNCS(sched_yield)
+AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield]))
 
 have_pthread=false
 if test "$os_win32" = no; then
diff --git a/src/fcatomic.h b/src/fcatomic.h
index 72ae372..acbb368 100644
--- a/src/fcatomic.h
+++ b/src/fcatomic.h
@@ -86,6 +86,16 @@ typedef int fc_atomic_int_t;
 #define fc_atomic_ptr_get(P)		(void *) (__sync_synchronize (), *(P))
 #define fc_atomic_ptr_cmpexch(P,O,N)	__sync_bool_compare_and_swap ((P), (O), (N))
 
+#elif !defined(FC_NO_MT) && defined(HAVE_SOLARIS_ATOMIC_OPS)
+
+#include <atomic.h>
+#include <mbarrier.h>
+
+typedef unsigned int fc_atomic_int_t;
+#define fc_atomic_int_add(AI, V)	( ({__machine_rw_barrier ();}), atomic_add_int_nv (&(AI), (V)) - (V))
+
+#define fc_atomic_ptr_get(P)		( ({__machine_rw_barrier ();}), (void *) *(P))
+#define fc_atomic_ptr_cmpexch(P,O,N)	( ({__machine_rw_barrier ();}), atomic_cas_ptr ((P), (O), (N)) == (void *) (O) ? FcTrue : FcFalse)
 
 #elif !defined(FC_NO_MT)
 
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux