Re: [PATCH] Fix compilation on Mac OS X 10.4

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

 



Thanks for the patch. BTW was MAC_OS_X_VERSION_X_Y available in 10.4?
will it work on 10.5+ too?

On Sun, May 5, 2013 at 2:11 PM, Misty De Meo <misty@xxxxxxx> wrote:
> fontconfig fails to compile on Mac OS X 10.4 because it uses the
> OSAtomicCompareAndSwapPtrBarrier() function in a macro definition in
> fcatomic.h; this function was first introduced in 10.5.
>
> This is the only function that fontconfig uses which isn't in Tiger,
> and otherwise it compiles and functions perfectly. Tiger does have
> 32-bit and 64-bit specific equivalents to that function.
>
> The patch below defines the macro to use those specific functions on
> Tiger based on the CPU arch for which fontconfig is being used, and
> otherwise uses OSAtomicCompareAndSwapPtrBarrier() on 10.5 and newer.
> I've tested on both 10.4 and 10.7 to ensure that it works.
>
> Misty De Meo
>
> From 7657bd4d690f218ed9f3a43045fc474a935cbe27 Mon Sep 17 00:00:00 2001
> From: Misty De Meo <mistydemeo@xxxxxxxxx>
> Date: Sun, 14 Apr 2013 22:10:21 -0500
> Subject: [PATCH] Fix fc_atomic_ptr_cmpexch on Mac OS X 10.4
>
> The OSAtomicCompareAndSwapPtrBarrier() function was introduced in Mac
> OS X 10.5, but size-specific versions are available in 10.4.
>
> This commit defines the fc_atomic_ptr_cmpexch macro using
> OSAtomicCompareAndSwapPtrBarrier() on 10.5 or newer, and otherwise
> defines it as the 32-bit or 64-bit equivalent based on the CPU
> architecture for which fontconfig is being built.
> ---
>  src/fcatomic.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/fcatomic.h b/src/fcatomic.h
> index a764311..7d2fc7d 100644
> --- a/src/fcatomic.h
> +++ b/src/fcatomic.h
> @@ -69,13 +69,23 @@ typedef LONG fc_atomic_int_t;
>
>  #elif !defined(FC_NO_MT) && defined(__APPLE__)
>
> +#include <AvailabilityMacros.h>
>  #include <libkern/OSAtomic.h>
>
>  typedef int fc_atomic_int_t;
>  #define fc_atomic_int_add(AI, V)    (OSAtomicAdd32Barrier ((V), &(AI)) - (V))
>
>  #define fc_atomic_ptr_get(P)        (OSMemoryBarrier (), (void *) *(P))
> +
> +/* OSAtomicCompareAndSwapPtrBarrier() was introduced in 10.5, but 32-bit
> + * and 64-bit specific functions are available in 10.4. */
> +#ifdef MAC_OS_X_VERSION_10_5
>  #define fc_atomic_ptr_cmpexch(P,O,N)
> OSAtomicCompareAndSwapPtrBarrier ((void *) (O), (void *) (N), (void
> **) (P))
> +#elif defined(__LP64__)
> +#define fc_atomic_ptr_cmpexch(P,O,N)  OSAtomicCompareAndSwap64Barrier
> ((void *) (O), (void *) (N), (void **) (P))
> +#else
> +#define fc_atomic_ptr_cmpexch(P,O,N)  OSAtomicCompareAndSwap32Barrier
> ((void *) (O), (void *) (N), (void **) (P))
> +#endif
>
>
>  #elif !defined(FC_NO_MT) && defined(HAVE_INTEL_ATOMIC_PRIMITIVES)
> --
> 1.8.2
> _______________________________________________
> Fontconfig mailing list
> Fontconfig@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/fontconfig



-- 
Akira TAGOH
_______________________________________________
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