summaryrefslogtreecommitdiff
path: root/BUILD/check-cpu
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@mysql.com>2008-12-19 11:46:28 +0100
committerMikael Ronstrom <mikael@mysql.com>2008-12-19 11:46:28 +0100
commit481083d6cab39dc1c8c0c9f34ed142e002b2811c (patch)
treeaec741c854e2604d38847db17381067dfbfe05ac /BUILD/check-cpu
parent55f1722ca41f11316da760ee2cca1721e6578a40 (diff)
downloadmariadb-git-481083d6cab39dc1c8c0c9f34ed142e002b2811c.tar.gz
Made it possible to set CC and CXX on commandline before calling script
for those cases when gcc, cc-5.0, icpc or icc isn't in the path. Fixed handling of 32 and 64 bits. Downgraded Solaris builds on Forte to use -xO2 rather than -xO3. Made it possible to build 64-bits on Mac OS X Fixed some bugs in setting CC, CXX, ASFLAGS, LDFLAGS Fixed bugs relating to use of SunStudio/Forte in check-cpu Reorganized code a bit Removed the use of --with-fast-mutexes since they aren't really fast, rather slow. Added -static-libgcc when using gcc Added optimising compilation flags on BSD Added use of curses library on Solaris Removed the use of MY_ATOMIC_MODE_RWLOCKS which removed use of atomic instructions Added support for Forte on Solaris/x86
Diffstat (limited to 'BUILD/check-cpu')
-rwxr-xr-xBUILD/check-cpu112
1 files changed, 57 insertions, 55 deletions
diff --git a/BUILD/check-cpu b/BUILD/check-cpu
index 33bf857b845..c2ea197bfa4 100755
--- a/BUILD/check-cpu
+++ b/BUILD/check-cpu
@@ -175,67 +175,69 @@ check_cpu () {
cc=$CC
fi
- cc_ver=`$cc --version | sed 1q`
- cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
- set -- `echo $cc_verno | tr '.' ' '`
- cc_major=$1
- cc_minor=$2
- cc_patch=$3
- cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
+ if test "x$compiler" = "x" ; then
+ cc_ver=`$cc --version | sed 1q`
+ cc_verno=`echo $cc_ver | sed -e 's/^.*(GCC)//g; s/[^0-9. ]//g; s/^ *//g; s/ .*//g'`
+ set -- `echo $cc_verno | tr '.' ' '`
+ cc_major=$1
+ cc_minor=$2
+ cc_patch=$3
+ cc_comp=`expr $cc_major '*' 100 '+' $cc_minor`
- case "$cc_ver--$cc_verno" in
- *GCC*)
- # different gcc backends (and versions) have different CPU flags
- case `gcc -dumpmachine` in
- i?86-* | x86_64-*)
- if test "$cc_comp" -lt 304 ; then
- check_cpu_cflags="-mcpu=${cpu_arg}"
- elif test "$cc_comp" -ge 402 ; then
- check_cpu_cflags="-mtune=native"
- else
- check_cpu_cflags="-mtune=${cpu_arg}"
- fi
- ;;
- ppc-*)
- check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}"
- ;;
- *)
- check_cpu_cflags=""
- return
- ;;
- esac
- ;;
- 2.95.*)
- # GCC 2.95 doesn't expose its name in --version output
- check_cpu_cflags="-m${cpu_arg}"
- ;;
- *)
- check_cpu_cflags=""
- return
- ;;
- esac
+ case "$cc_ver--$cc_verno" in
+ *GCC*)
+ # different gcc backends (and versions) have different CPU flags
+ case `gcc -dumpmachine` in
+ i?86-* | x86_64-*)
+ if test "$cc_comp" -lt 304 ; then
+ check_cpu_cflags="-mcpu=${cpu_arg}"
+ elif test "$cc_comp" -ge 402 ; then
+ check_cpu_cflags="-mtune=native"
+ else
+ check_cpu_cflags="-mtune=${cpu_arg}"
+ fi
+ ;;
+ ppc-*)
+ check_cpu_cflags="-mcpu=${cpu_arg} -mtune=${cpu_arg}"
+ ;;
+ *)
+ check_cpu_cflags=""
+ return
+ ;;
+ esac
+ ;;
+ 2.95.*)
+ # GCC 2.95 doesn't expose its name in --version output
+ check_cpu_cflags="-m${cpu_arg}"
+ ;;
+ *)
+ check_cpu_cflags=""
+ return
+ ;;
+ esac
+ # now we check whether the compiler really understands the cpu type
+ touch __test.c
- # now we check whether the compiler really understands the cpu type
- touch __test.c
+ while [ "$cpu_arg" ] ; do
+ printf "testing $cpu_arg ... " >&2
+
+ # compile check
+ eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
+ if test "x$?" = "x0" ; then
+ echo ok >&2
+ break;
+ fi
+ echo failed >&2
+ check_cpu_cflags=""
+ break;
+ done
+ rm __test.*
+ fi
if test "x$core2" = "xyes" ; then
cpu_arg="core2"
fi
- while [ "$cpu_arg" ] ; do
- printf "testing $cpu_arg ... " >&2
-
- # compile check
- eval "$cc -c $check_cpu_cflags __test.c" 2>/dev/null
- if test "x$?" = "x0" ; then
- echo ok >&2
- break;
- fi
-
- echo failed >&2
- check_cpu_cflags=""
- break;
- done
- rm __test.*
+ return 0
}
check_cpu