From c0c0b19716b49fb49f528e93850bdc38552b8ab7 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Mon, 10 Aug 2015 01:32:12 +0200 Subject: [PATCH] configure: Add --platform and --use-cc-builtins --platform let you set the platform, instead of relying on uname -m --use-cc-builtins force the usage of gcc atomic builtins, instead of using the one provided by CK. --- build/ck.pc.in | 2 +- configure | 21 +++++++++++++++++++-- include/ck_pr.h | 2 ++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/build/ck.pc.in b/build/ck.pc.in index 5f0e97a..5350c9c 100644 --- a/build/ck.pc.in +++ b/build/ck.pc.in @@ -7,4 +7,4 @@ Description: Toolkit for well-specified design and implementation of concurrent URL: http://concurrencykit.org/ Version: @VERSION@ Libs: -L${libdir} -lck -Cflags: -D__@PROFILE@__ -I${includedir} +Cflags: -D__@PROFILE@__ -I${includedir} @PC_CFLAGS diff --git a/configure b/configure index 2fe8d22..e9bc517 100755 --- a/configure +++ b/configure @@ -111,6 +111,7 @@ generate() -e "s#@LDNAME@#$LDNAME#g" \ -e "s#@LDNAME_MAJOR@#$LDNAME_MAJOR#g" \ -e "s#@LDNAME_VERSION@#$LDNAME_VERSION#g" \ + -e "s#@PC_CFLAGS#$PC_CFLAGS#g" \ $1 > $2 } @@ -175,6 +176,8 @@ for option; do echo " --enable-rtm Enable restricted transactional memory (power, x86_64)" echo " --memory-model=N Specify memory model (currently tso, pso or rmo)" echo " --vma-bits=N Specify valid number of VMA bits" + echo " --platform=N Force the platform type, instead of relying on autodetection" + echo " --use-cc-builtins Use the compiler atomic bultin functions, instead of the CK implementation" echo echo "The following options affect regression testing." echo " --cores=N Specify number of cores available on target machine" @@ -241,6 +244,12 @@ for option; do --disable-option-checking) OPTION_CHECKING=0 ;; + --use-cc-builtins) + USE_CC_BUILTINS=1 + ;; + --platform=*) + PLATFORM=$value + ;; --build=*|--host=*|--target=*|--exec-prefix=*|--bindir=*|--sbindir=*|\ --sysconfdir=*|--datadir=*|--libexecdir=*|--localstatedir=*|\ --enable-static|\ @@ -320,7 +329,10 @@ assert "$SYSTEM" "$SYSTEM" "unsupported" CORES=${CORES:-${DCORES}} printf "Detecting machine architecture..." -PLATFORM=`uname -m 2> /dev/null` +if test "x$PLATFORM" = "x"; then + PLATFORM=`uname -m 2> /dev/null` +fi + case $PLATFORM in "macppc"|"Power Macintosh"|"powerpc") RTM_ENABLE="CK_MD_RTM_DISABLE" @@ -413,7 +425,7 @@ case $PLATFORM in ;; arm|armv6l|armv7l) if test "$PLATFORM" = "armv6l"; then - CFLAGS="$CFLAGS -march=armv6"; + CFLAGS="$CFLAGS -march=armv6k"; elif test "$PLATFORM" = "armv7l"; then CFLAGS="$CFLAGS -march=armv7-a"; fi @@ -446,6 +458,11 @@ else VMA_BITS_VALUE_R="${VMA_BITS}ULL" fi +if test "$USE_CC_BUILTINS"; then + CFLAGS="$CFLAGS -DCK_CC_BUILTINS" + PC_CFLAGS="-DCK_CC_BULITINS" +fi + # `which` on Solaris sucks pathsearch() { diff --git a/include/ck_pr.h b/include/ck_pr.h index 00d95a0..5cdc3c3 100644 --- a/include/ck_pr.h +++ b/include/ck_pr.h @@ -34,6 +34,7 @@ #include #include +#ifndef CK_USE_CC_BUILTINS #if defined(__x86_64__) #include "gcc/x86_64/ck_pr.h" #elif defined(__x86__) @@ -49,6 +50,7 @@ #elif !defined(__GNUC__) #error Your platform is unsupported #endif +#endif /* !CK_USE_CC_BUILTINS */ #if defined(__GNUC__) #include "gcc/ck_pr.h"