summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xconfigure227
1 files changed, 158 insertions, 69 deletions
diff --git a/configure b/configure
index e840d41..340e05c 100755
--- a/configure
+++ b/configure
@@ -34,7 +34,7 @@ WANT_PIC=yes
P_PWD=`pwd`
MAINTAINER='sbahra@repnop.org'
-VERSION=${VERSION:-'0.6.0'}
+VERSION=${VERSION:-'0.7.1'}
VERSION_MAJOR='0'
BUILD="$PWD/build/ck.build"
PREFIX=${PREFIX:-"/usr/local"}
@@ -119,6 +119,9 @@ generate()
-e "s#@GZIP_SUFFIX@#$GZIP_SUFFIX#g" \
-e "s#@POINTER_PACK_ENABLE@#$POINTER_PACK_ENABLE#g" \
-e "s#@DISABLE_DOUBLE@#$DISABLE_DOUBLE#g" \
+ -e "s#@DISABLE_STATIC@#$DISABLE_STATIC#g" \
+ -e "s#@SSE_DISABLE@#$SSE_DISABLE#g" \
+ -e "s#@PPC32_LWSYNC_ENABLE@#$PPC32_LWSYNC_ENABLE#g" \
-e "s#@RTM_ENABLE@#$RTM_ENABLE#g" \
-e "s#@LSE_ENABLE@#$LSE_ENABLE#g" \
-e "s#@VMA_BITS@#$VMA_BITS_R#g" \
@@ -144,6 +147,7 @@ generate_stdout()
echo " SRC_DIR = $BUILD_DIR"
echo " SYSTEM = $SYSTEM"
echo " PROFILE = $PROFILE"
+ echo " AR = $AR"
echo " CC = $CC"
echo " COMPILER = $COMPILER"
echo " CFLAGS = $CFLAGS"
@@ -153,13 +157,16 @@ generate_stdout()
echo " LDNAME_VERSION = $LDNAME_VERSION"
echo " LDNAME_MAJOR = $LDNAME_MAJOR"
echo " LDFLAGS = $LDFLAGS"
+ echo " STATIC_LIB = $DISABLE_STATIC"
echo " GZIP = $GZIP"
echo " CORES = $CORES"
echo " POINTER_PACK = $POINTER_PACK_ENABLE"
+ echo " PPC32_LWSYNC = $PPC32_LWSYNC_ENABLE"
echo " VMA_BITS = $VMA_BITS"
echo " MEMORY_MODEL = $MM"
echo " RTM = $RTM_ENABLE"
echo " LSE = $LSE_ENABLE"
+ echo " SSE = $SSE_DISABLE"
echo
echo "Headers will be installed in $HEADERS"
echo "Libraries will be installed in $LIBRARY"
@@ -169,7 +176,8 @@ generate_stdout()
for option; do
case "$option" in
*=?*)
- value=`expr -- "$option" : '[^=]*=\(.*\)'`
+ optname=`echo $option|cut -c 3-`
+ value=`expr "$optname" : '[^=]*=\(.*\)'`
;;
*=)
value=
@@ -194,18 +202,24 @@ for option; do
echo
echo "The following options will affect generated code."
echo " --enable-pointer-packing Assumes address encoding is subset of pointer range"
- echo " --enable-rtm Enable restricted transactional memory (power, x86_64)"
- echo " --enable-lse Enable large system extensions (arm64)"
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 " --use-cc-builtins Use the compiler atomic builtin functions, instead of the CK implementation"
echo " --disable-double Don't generate any of the functions using the \"double\" type"
+ echo " --disable-static Don't compile a static version of the ck lib"
+ echo
+ echo "The following options will affect specific platform-dependent generated code."
+ echo " --disable-sse Do not use any SSE instructions (x86)"
+ echo " --enable-lse Enable large system extensions (arm64)"
+ echo " --enable-ppc32-lwsync Enable lwsync instruction usage (32-bit Power ISA)"
+ echo " --enable-rtm Enable restricted transactional memory (Power ISA, x86_64)"
echo
echo "The following options affect regression testing."
echo " --cores=N Specify number of cores available on target machine"
echo
echo "The following environment variables may be used:"
+ echo " AR AR archiver command"
echo " CC C compiler command"
echo " CFLAGS C compiler flags"
echo " LDFLAGS Linker flags"
@@ -237,12 +251,18 @@ for option; do
--enable-pointer-packing)
POINTER_PACK_ENABLE="CK_MD_POINTER_PACK_ENABLE"
;;
+ --enable-ppc32-lwsync)
+ PPC32_LWSYNC_ENABLE="CK_MD_PPC32_LWSYNC"
+ ;;
--enable-rtm)
RTM_ENABLE_SET="CK_MD_RTM_ENABLE"
;;
--enable-lse)
LSE_ENABLE_SET="CK_MD_LSE_ENABLE"
;;
+ --disable-sse)
+ SSE_DISABLE="CK_MD_SSE_DISABLE"
+ ;;
--cores=*)
CORES=$value
;;
@@ -276,6 +296,9 @@ for option; do
--disable-double)
DISABLE_DOUBLE="CK_PR_DISABLE_DOUBLE"
;;
+ --disable-static)
+ DISABLE_STATIC=1
+ ;;
--platform=*)
PLATFORM=$value
;;
@@ -294,7 +317,8 @@ for option; do
fi
;;
*=*)
- NAME=`expr -- "$option" : '\([^=]*\)='`
+ optname=`echo $option|cut -c 3-`
+ NAME=`expr "$optname" : '\([^=]*\)='`
eval "$NAME='$value'"
export $NAME
;;
@@ -309,10 +333,13 @@ done
HEADERS=${HEADERS:-"${PREFIX}/include"}
LIBRARY=${LIBRARY:-"${PREFIX}/lib"}
MANDIR=${MANDIR:-"${PREFIX}/share/man"}
-GZIP=${GZIP:-"gzip -c"}
+GZIP=${GZIP-"gzip -c"}
POINTER_PACK_ENABLE=${POINTER_PACK_ENABLE:-"CK_MD_POINTER_PACK_DISABLE"}
DISABLE_DOUBLE=${DISABLE_DOUBLE:-"CK_PR_ENABLE_DOUBLE"}
+DISABLE_STATIC=${DISABLE_STATIC:-"0"}
+PPC32_LWSYNC_ENABLE=${PPC32_LWSYNC_ENABLE:-"CK_MD_PPC32_LWSYNC_DISABLE"}
RTM_ENABLE=${RTM_ENABLE_SET:-"CK_MD_RTM_DISABLE"}
+SSE_DISABLE=${SSE_DISABLE:-"CK_MD_SSE_ENABLE"}
LSE_ENABLE=${LSE_ENABLE_SET:-"CK_MD_LSE_DISABLE"}
VMA_BITS=${VMA_BITS:-"unknown"}
@@ -347,14 +374,18 @@ case "$SYSTEM" in
DCORES=`sysctl -n hw.ncpu`
SYSTEM=darwin
;;
- MINGW32*)
+ MINGW32*|MSYS_NT*)
SYSTEM=mingw32
LDFLAGS="-mthreads $LDFLAGS"
;;
- CYGWIN_NT*)
- SYSTEM=cygwin
- LDFLAGS="-mthreads $LDFLAGS"
- ;;
+ MINGW64*)
+ SYSTEM=mingw64
+ LDFLAGS="-mthreads $LDFLAGS"
+ ;;
+ CYGWIN_NT*)
+ SYSTEM=cygwin
+ LDFLAGS="-mthreads $LDFLAGS"
+ ;;
*)
SYSTEM=
;;
@@ -365,11 +396,18 @@ assert "$SYSTEM" "$SYSTEM" "unsupported"
CORES=${CORES:-${DCORES}}
printf "Detecting machine architecture..."
if test "x$PLATFORM" = "x"; then
- PLATFORM=`uname -m 2> /dev/null`
+ case $SYSTEM in
+ "freebsd")
+ PLATFORM=`uname -p 2> /dev/null`
+ ;;
+ *)
+ PLATFORM=`uname -m 2> /dev/null`
+ ;;
+ esac
fi
case $PLATFORM in
- "macppc"|"Power Macintosh"|"powerpc")
+ "macppc"|"Power Macintosh"|"powerpc"|"powerpcspe")
RTM_ENABLE="CK_MD_RTM_DISABLE"
LSE_ENABLE="CK_MD_LSE_DISABLE"
MM="${MM:-"CK_MD_RMO"}"
@@ -457,19 +495,22 @@ case $PLATFORM in
;;
esac
;;
- "ppc64"|"ppc64le")
+ "ppc64"|"ppc64le"|"powerpc64")
RTM_ENABLE="CK_MD_RTM_DISABLE"
LSE_ENABLE="CK_MD_LSE_DISABLE"
MM="${MM:-"CK_MD_RMO"}"
PLATFORM=ppc64
ENVIRONMENT=64
;;
- arm|armv6l|armv7l)
- if test "$PLATFORM" = "armv6l"; then
- CFLAGS="$CFLAGS -march=armv6k";
- elif test "$PLATFORM" = "armv7l"; then
- CFLAGS="$CFLAGS -march=armv7-a";
- fi
+ arm|armv6|armv6l|armv7|armv7l)
+ case "$PLATFORM" in
+ "armv6"|"armv6l")
+ CFLAGS="$CFLAGS -march=armv6k";
+ ;;
+ "armv7"|"armv7l")
+ CFLAGS="$CFLAGS -march=armv7-a";
+ ;;
+ esac
RTM_ENABLE="CK_MD_RTM_DISABLE"
LSE_ENABLE="CK_MD_LSE_DISABLE"
MM="${MM:-"CK_MD_RMO"}"
@@ -482,11 +523,19 @@ case $PLATFORM in
PLATFORM=aarch64
ENVIRONMENT=64
;;
+ "s390x")
+ RTM_ENABLE="CK_MD_RTM_DISABLE"
+ LSE_ENABLE="CK_MD_LSE_DISABLE"
+ MM="${MM:-"CK_MD_RMO"}"
+ PLATFORM=s390x
+ ENVIRONMENT=64
+ ;;
*)
RTM_ENABLE="CK_MD_RTM_DISABLE"
LSE_ENABLE="CK_MD_LSE_DISABLE"
- PLATFORM=
+ PLATFORM=unknown
MM="${MM:-"CK_MD_RMO"}"
+ USE_CC_BUILTINS=1
;;
esac
@@ -543,27 +592,65 @@ else
echo "success [$BUILD_DIR]"
fi
-printf "Finding gzip tool................"
-GZIP=`pathsearch "${GZIP:-gzip}"`
-if test -z "$GZIP" -o ! -x "$GZIP"; then
+if test -n "$GZIP"; then
+ printf "Finding gzip tool................"
GZIP=`pathsearch "${GZIP:-gzip}"`
- GZIP="$GZIP"
+ if test -z "$GZIP" -o ! -x "$GZIP"; then
+ GZIP=`pathsearch "${GZIP:-gzip}"`
+ GZIP="$GZIP"
+ fi
+
+ if test -z "$GZIP"; then
+ echo "not found"
+ else
+ echo "success [$GZIP]"
+ GZIP="$GZIP -c"
+ GZIP_SUFFIX=".gz"
+ fi
fi
if test -z "$GZIP"; then
- echo "not found"
GZIP=cat
GZIP_SUFFIX=""
-else
- echo "success [$GZIP]"
- GZIP="$GZIP -c"
- GZIP_SUFFIX=".gz"
+fi
+
+if test "$PROFILE"; then
+ printf "Using user-specified profile....."
+
+ if test -z "$CC"; then
+ echo "failed [specify compiler]"
+ exit $EXIT_FAILURE
+ fi
+
+ if test ! -f build/ck.build.$PROFILE; then
+ echo "failed [$PROFILE]"
+ exit $EXIT_FAILURE
+ fi
+
+ echo "success [$PROFILE]"
+ printf "Generating header files.........."
+ generate include/ck_md.h.in include/ck_md.h
+ generate include/freebsd/ck_md.h.in include/freebsd/ck_md.h
+ echo "success"
+ printf "Generating build files..........."
+ generate src/Makefile.in src/Makefile
+ generate doc/Makefile.in doc/Makefile
+ generate build/ck.build.in build/ck.build
+ generate build/regressions.build.in build/regressions.build
+ generate build/ck.pc.in build/ck.pc
+ generate build/ck.spec.in build/ck.spec
+ generate Makefile.in Makefile
+ echo "success"
+ generate_stdout
+ exit $EXIT_SUCCESS
fi
printf "Finding suitable compiler........"
-CC=`pathsearch "${CC:-cc}"`
-if test -z "$CC" -o ! -x "$CC"; then
- CC=`pathsearch "${CC:-gcc}"`
+if test ! -x "${CC}"; then
+ CC=`pathsearch "${CC:-cc}"`
+ if test -z "$CC" -o ! -x "$CC"; then
+ CC=`pathsearch "${CC:-gcc}"`
+ fi
fi
assert "$CC" "not found"
@@ -596,7 +683,7 @@ int main(void) {
EOF
$CC -o .1 .1.c
-COMPILER=`./.1`
+COMPILER=`./.1 2> /dev/null`
r=$?
rm -f .1.c .1
@@ -628,13 +715,24 @@ elif test "$COMPILER" = "gcc" || test "$COMPILER" = "clang" || test "$COMPILER"
if test "$WANT_PIC" = "yes"; then
LDFLAGS="$LDFLAGS -shared -fPIC"
CFLAGS="$CFLAGS -fPIC"
- ALL_LIBS="libck.so libck.a"
- INSTALL_LIBS="install-so install-lib"
+
+ if [ "$DISABLE_STATIC" -eq 1 ]; then
+ ALL_LIBS="libck.so"
+ INSTALL_LIBS="install-so"
+ else
+ ALL_LIBS="libck.so libck.a"
+ INSTALL_LIBS="install-so install-lib"
+ fi
else
LDFLAGS="$LDFLAGS -fno-PIC"
CFLAGS="$CFLAGS -fno-PIC"
- ALL_LIBS="libck.a"
- INSTALL_LIBS="install-lib"
+ if [ "$DISABLE_STATIC" -eq 1 ]; then
+ echo "Error: You have choosen to disable PIC, yet you also disabled the static lib." 1>&2
+ exit $EXIT_FAILURE
+ else
+ ALL_LIBS="libck.a"
+ INSTALL_LIBS="install-lib"
+ fi
fi
CFLAGS="-D_XOPEN_SOURCE=600 -D_BSD_SOURCE -D_DEFAULT_SOURCE -std=gnu99 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -fstrict-aliasing -O2 -pipe -Wno-parentheses $CFLAGS"
@@ -647,6 +745,17 @@ else
assert "" "unknown compiler"
fi
+printf "Finding suitable archiver........"
+if test ! -x "${AR}"; then
+ AR=`pathsearch "${AR:-ar}"`
+ if test -z "$AR" -o ! -x "$AR"; then
+ AR=`pathsearch "${AR:-ar}"`
+ else
+ echo "success [$AR]"
+ fi
+fi
+assert "$AR" "not found"
+
printf "Detecting VMA bits..............."
VMA="unknown"
if test "$VMA_BITS" = "unknown"; then
@@ -732,42 +841,13 @@ printf "Detecting git SHA................"
get_git_sha
echo "$GIT_MSG [$GIT_SHA]"
-if test "$PROFILE"; then
- printf "Using user-specified profile....."
-
- if test -z "$CC"; then
- echo "failed [specify compiler]"
- exit $EXIT_FAILURE
- fi
-
- if test ! -f build/ck.build.$PROFILE; then
- echo "failed [$PROFILE]"
- exit $EXIT_FAILURE
- fi
-
- echo "success [$PROFILE]"
- printf "Generating header files.........."
- generate include/ck_md.h.in include/ck_md.h
- echo "success"
- printf "Generating build files..........."
- generate src/Makefile.in src/Makefile
- generate doc/Makefile.in doc/Makefile
- generate build/ck.build.in build/ck.build
- generate build/regressions.build.in build/regressions.build
- generate build/ck.pc.in build/ck.pc
- generate build/ck.spec.in build/ck.spec
- generate Makefile.in Makefile
- echo "success"
- generate_stdout
- exit $EXIT_SUCCESS
-fi
-
# Platform will be used as a macro.
PROFILE="${PROFILE:-$PLATFORM}"
PLATFORM="__${PLATFORM}__"
printf "Generating header files.........."
generate include/ck_md.h.in include/ck_md.h
+generate include/freebsd/ck_md.h.in include/freebsd/ck_md.h
echo "success"
printf "Generating build files..........."
@@ -794,3 +874,12 @@ generate Makefile.in $P_PWD/Makefile
touch src/*.c
echo "success"
generate_stdout
+
+if test "$PROFILE" = "unknown"; then
+ echo
+ echo "WARNING: your target architecture is not a first-class citizen."
+ echo
+ echo "The test suite may not work as intended. Consider reaching out "
+ echo "to the mailing list about having the project add first-class "
+ echo "support for your architecture."
+fi