build: Add VMA bits detection for Mac OS X and Linux on x86*.

ck_pring
Samy Al Bahra 12 years ago
parent 67895cb87e
commit 7a04c368ff

41
configure vendored

@ -93,6 +93,8 @@ generate()
-e "s#@GZIP@#$GZIP#g" \ -e "s#@GZIP@#$GZIP#g" \
-e "s#@GZIP_SUFFIX@#$GZIP_SUFFIX#g" \ -e "s#@GZIP_SUFFIX@#$GZIP_SUFFIX#g" \
-e "s#@POINTER_PACK_ENABLE@#$POINTER_PACK_ENABLE#g" \ -e "s#@POINTER_PACK_ENABLE@#$POINTER_PACK_ENABLE#g" \
-e "s#@VMA_BITS@#$VMA_BITS_R#g" \
-e "s#@VMA_BITS_VALUE@#$VMA_BITS_VALUE_R#g" \
$1 > $2 $1 > $2
} }
@ -109,8 +111,9 @@ generate_stdout()
echo " LD = $LD" echo " LD = $LD"
echo " LDFLAGS = $LDFLAGS" echo " LDFLAGS = $LDFLAGS"
echo " GZIP = $GZIP" echo " GZIP = $GZIP"
echo " POINTER_PACK = $POINTER_PACK_ENABLE"
echo " CORES = $CORES" echo " CORES = $CORES"
echo " POINTER_PACK = $POINTER_PACK_ENABLE"
echo " VMA_BITS = $VMA_BITS"
echo echo
echo "Headers will be installed in $HEADERS" echo "Headers will be installed in $HEADERS"
echo "Libraries will be installed in $LIBRARY" echo "Libraries will be installed in $LIBRARY"
@ -136,6 +139,7 @@ for option in $*; do
echo "The following options will modify code generation." echo "The following options will modify code generation."
echo " --cores=N Specify number of cores available on target machine" echo " --cores=N Specify number of cores available on target machine"
echo " --enable-pointer-packing Assumes 48-bit address encoding" echo " --enable-pointer-packing Assumes 48-bit address encoding"
echo " --vma-bits=N Specify valid number of VMA bits"
echo echo
echo "The following environment variables may be used:" echo "The following environment variables may be used:"
echo " CC C compiler command" echo " CC C compiler command"
@ -146,6 +150,9 @@ for option in $*; do
echo "Report bugs to ${MAINTAINER}." echo "Report bugs to ${MAINTAINER}."
exit $EXIT_SUCCESS exit $EXIT_SUCCESS
;; ;;
--vma-bits=*)
VMA_BITS=$value
;;
--enable-pointer-packing) --enable-pointer-packing)
POINTER_PACK_ENABLE="CK_MD_POINTER_PACK_ENABLE" POINTER_PACK_ENABLE="CK_MD_POINTER_PACK_ENABLE"
;; ;;
@ -336,6 +343,37 @@ esac
assert "$PLATFORM" "$PLATFORM" "unsupported" assert "$PLATFORM" "$PLATFORM" "unsupported"
printf "Detecting VMA bits..............."
if test "$VMA_BITS" = ""; then
if test "$PLATFORM" = "x86" || test $PLATFORM = "x86_64"; then
case $SYSTEM in
darwin)
VMA=`sysctl -n machdep.cpu.address_bits.virtual`
;;
linux)
VMA=`awk '/address sizes/ {print $7;exit}' /proc/cpuinfo`
;;
*)
VMA="unknown"
;;
esac
fi
VMA_BITS=$VMA
else
VMA=$VMA_BITS
fi
if test "$VMA" = "unknown"; then
echo "unknown"
VMA_BITS_R="CK_MD_VMA_BITS_UNKNOWN"
VMA_BITS_VALUE_R=""
else
echo "success [$VMA]"
VMA_BITS_R="CK_MD_VMA_BITS"
VMA_BITS_VALUE_R="${VMA_BITS}ULL"
fi
# Platform will be used as a macro. # Platform will be used as a macro.
PROFILE="${PROFILE:-$PLATFORM}" PROFILE="${PROFILE:-$PLATFORM}"
PLATFORM="__${PLATFORM}__" PLATFORM="__${PLATFORM}__"
@ -380,7 +418,6 @@ if test -z "$CC" -o ! -x "$CC"; then
fi fi
assert "$CC" "not found" assert "$CC" "not found"
# Make sure GCC 4.X, the only supported compiler, is being used.
cat << EOF > .1.c cat << EOF > .1.c
#include <stdio.h> #include <stdio.h>
int main(void) { int main(void) {

@ -39,4 +39,8 @@
#define @POINTER_PACK_ENABLE@ #define @POINTER_PACK_ENABLE@
#endif #endif
#ifndef @VMA_BITS@
#define @VMA_BITS@ @VMA_BITS_VALUE@
#endif
#endif /* _CK_MD_H */ #endif /* _CK_MD_H */

Loading…
Cancel
Save