Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
a49387a1
Commit
a49387a1
authored
Jun 03, 2005
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
parents
29fd1f2f
03056a28
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
126 additions
and
42 deletions
+126
-42
BUILD/check-cpu
BUILD/check-cpu
+126
-42
No files found.
BUILD/check-cpu
View file @
a49387a1
...
@@ -6,113 +6,197 @@
...
@@ -6,113 +6,197 @@
#
#
if
test
-r
/proc/cpuinfo
;
then
if
test
-r
/proc/cpuinfo
;
then
# on Linux (and others?) we can get detailed CPU information out of /proc
cpuinfo
=
"cat /proc/cpuinfo"
cpuinfo
=
"cat /proc/cpuinfo"
# detect CPU family
cpu_family
=
`
$cpuinfo
|
grep
'family'
|
cut
-d
':'
-f
2 |
cut
-d
' '
-f
2 |
head
-1
`
cpu_family
=
`
$cpuinfo
|
grep
'family'
|
cut
-d
':'
-f
2 |
cut
-d
' '
-f
2 |
head
-1
`
if
test
-z
"
$cpu_family
"
;
then
if
test
-z
"
$cpu_family
"
;
then
cpu_family
=
`
$cpuinfo
|
grep
'cpu'
|
cut
-d
':'
-f
2 |
cut
-d
' '
-f
2 |
head
-1
`
cpu_family
=
`
$cpuinfo
|
grep
'cpu'
|
cut
-d
':'
-f
2 |
cut
-d
' '
-f
2 |
head
-1
`
fi
fi
# detect CPU vendor and model
cpu_vendor
=
`
$cpuinfo
|
grep
'vendor_id'
|
cut
-d
':'
-f
2 |
cut
-d
' '
-f
2 |
head
-1
`
cpu_vendor
=
`
$cpuinfo
|
grep
'vendor_id'
|
cut
-d
':'
-f
2 |
cut
-d
' '
-f
2 |
head
-1
`
model_name
=
`
$cpuinfo
|
grep
'model name'
|
cut
-d
':'
-f
2 |
head
-1
`
model_name
=
`
$cpuinfo
|
grep
'model name'
|
cut
-d
':'
-f
2 |
head
-1
`
if
test
-z
"
$model_name
"
;
then
if
test
-z
"
$model_name
"
;
then
model_name
=
`
$cpuinfo
|
grep
'cpu model'
|
cut
-d
':'
-f
2 |
head
-1
`
model_name
=
`
$cpuinfo
|
grep
'cpu model'
|
cut
-d
':'
-f
2 |
head
-1
`
fi
fi
# fallback: get CPU model from uname output
if
test
-z
"
$model_name
"
;
then
if
test
-z
"
$model_name
"
;
then
model_name
=
`
uname
-m
`
model_name
=
`
uname
-m
`
fi
fi
# parse CPU flags
for
flag
in
`
$cpuinfo
|
grep
'flags'
|
sed
-e
's/^flags.*: //'
`
;
do
eval
cpu_flag_
$flag
=
yes
done
else
else
# Fallback when there is no /proc/cpuinfo
# Fallback when there is no /proc/cpuinfo
case
"
`
uname
-s
`
"
in
case
"
`
uname
-s
`
"
in
FreeBSD
)
FreeBSD
|OpenBSD
)
cpu_family
=
`
uname
-m
`
;
cpu_family
=
`
uname
-m
`
;
model_name
=
`
sysctl
-b
hw.model
`
model_name
=
`
sysctl
-n
hw.model
`
;;
Darwin
)
cpu_family
=
`
uname
-p
`
model_name
=
`
machine
`
;;
;;
*
)
*
)
cpu_family
=
`
uname
-m
`
;
cpu_family
=
`
uname
-m
`
;
model_name
=
"unknown"
;
model_name
=
`
uname
-p
`
;
;;
;;
esac
esac
fi
fi
cpu_flag
=
""
# detect CPU shortname as used by gcc options
cpu_flag_old
=
""
# this list is not complete, feel free to add further entries
cpu_arg
=
""
case
"
$cpu_family
--
$model_name
"
in
case
"
$cpu_family
--
$model_name
"
in
# DEC Alpha
Alpha
*
EV6
*
)
Alpha
*
EV6
*
)
cpu_
fla
g
=
"ev6"
;
cpu_
ar
g
=
"ev6"
;
;;
;;
# Intel ia32
*
Xeon
*
)
*
Xeon
*
)
cpu_flag
=
"nocona"
;
# a Xeon is just another pentium4 ...
# ... unless it has the "lm" (long-mode) flag set,
# in that case it's a Xeon with EM64T support
if
[
-z
"
$cpu_flag_lm
"
]
;
then
cpu_arg
=
"pentium4"
;
else
cpu_arg
=
"nocona"
;
fi
;;
;;
*
Pentium
*
4
*
Mobile
*
CPU
*
)
*
Pentium
*
4
*
Mobile
*
)
cpu_
fla
g
=
"pentium4m"
;
cpu_
ar
g
=
"pentium4m"
;
;;
;;
*
Pentium
*
4
*
CPU
*
)
*
Pentium
*
4
*
)
cpu_
fla
g
=
"pentium4"
;
cpu_
ar
g
=
"pentium4"
;
;;
;;
*
Pentium
*
III
*
Mobile
*
CPU
*
)
*
Pentium
*
III
*
Mobile
*
)
cpu_
fla
g
=
"pentium3m"
;
cpu_
ar
g
=
"pentium3m"
;
;;
;;
*
Pentium
*
III
*
CPU
*
)
*
Pentium
*
III
*
)
cpu_
fla
g
=
"pentium3"
;
cpu_
ar
g
=
"pentium3"
;
;;
;;
*
Pentium
*
M
*
pro
*
)
*
Pentium
*
M
*
pro
*
)
cpu_flag
=
"pentium-m"
;
cpu_arg
=
"pentium-m"
;
cpu_flag_old
=
"pentium"
;
;;
;;
*
Athlon
*
64
*
)
*
Athlon
*
64
*
)
cpu_flag
=
"athlon64"
;
cpu_arg
=
"athlon64"
;
cpu_flag_old
=
"athlon"
;
;;
;;
*
Athlon
*
)
*
Athlon
*
)
cpu_
fla
g
=
"athlon"
;
cpu_
ar
g
=
"athlon"
;
;;
;;
# Intel ia64
*
Itanium
*
)
*
Itanium
*
)
# Don't need to set any flags for itanium(at the moment)
# Don't need to set any flags for itanium(at the moment)
cpu_
fla
g
=
""
;
cpu_
ar
g
=
""
;
;;
;;
*
ppc
)
cpu_flag
=
"powerpc"
;
#
no_march
=
1
;
*
powerpc
*
)
cpu_arg
=
`
echo
$model_name
|
sed
-e
"s/ppc//g"
`
;;
;;
# unknown
*
)
*
)
cpu_
fla
g
=
""
;
cpu_
ar
g
=
""
;
;;
;;
esac
esac
if
test
-z
"
$cpu_flag
"
;
then
if
test
-z
"
$cpu_arg
"
;
then
echo
"BUILD/check-cpu: Oops, could not findout what kind of cpu this machine is using."
echo
"BUILD/check-cpu: Oops, could not findout what kind of cpu this machine is using."
check_cpu_flags
=
""
check_cpu_
c
flags
=
""
return
return
fi
fi
echo
"cpu_flag:
$cpu_flag
"
# different compiler versions have different option names
# for CPU specific command line options
if
test
-z
"
$CC
"
;
then
if
test
-z
"
$CC
"
;
then
cc
=
"gcc"
;
cc
=
"gcc"
;
else
else
cc
=
$CC
cc
=
$CC
fi
fi
cc_ver
=
`
$cc
--version
|
sed
1q
`
cc_ver
=
`
$cc
--version
|
sed
1q
`
cc_verno
=
`
echo
$cc_ver
|
sed
-e
's/[^0-9. ]//g; s/^ *//g; s/ .*//g'
`
cc_verno
=
`
echo
$cc_ver
|
sed
-e
's/[^0-9. ]//g; s/^ *//g; s/ .*//g'
`
case
"
$cc_ver
--
$cc_verno
"
in
case
"
$cc_ver
--
$cc_verno
"
in
*
GCC
*
--3
.4
*
|
*
GCC
*
--3
.5
*
|
*
GCC
*
--4
.
*
)
check_cpu_cflags
=
"-mtune=
$cpu_flag
-march=
$cpu_flag
"
;;
*
GCC
*
)
*
GCC
*
)
# Fix for older compiler versions
# different gcc backends (and versions) have different CPU flags
if
test
-n
"
$cpu_flag_old
"
;
then
case
`
gcc
-dumpmachine
`
in
cpu_flag
=
"
$cpu_flag_old
"
i?86-
*
)
fi
case
"
$cc_verno
"
in
check_cpu_cflags
=
"-mcpu=
$cpu_flag
-march=
$cpu_flag
"
3.4
*
|
3.5
*
|
4.
*
)
if
test
-n
"
$no_march
"
;
then
check_cpu_args
=
'-mtune=$cpu_arg -march=$cpu_arg'
check_cpu_cflags
=
"-mcpu=
$cpu_flag
"
;;
fi
*
)
check_cpu_args
=
'-mcpu=$cpu_arg -march=$cpu_arg'
;;
esac
;;
ppc-
*
)
check_cpu_args
=
'-mcpu=$cpu_arg -mtune=$cpu_arg'
;;
;;
*
)
*
)
check_cpu_cflags
=
""
check_cpu_cflags
=
""
return
;;
esac
;;
2.95.
*
)
# GCC 2.95 doesn't expose its name in --version output
check_cpu_args
=
'-m$cpu_arg'
;;
*
)
check_cpu_cflags
=
""
return
;;
;;
esac
esac
echo
$check_cpu_cflags
# now we check whether the compiler really understands the cpu type
touch
__test.c
while
[
"
$cpu_arg
"
]
;
do
echo
-n
testing
$cpu_arg
"... "
# compile check
check_cpu_cflags
=
`
eval echo
$check_cpu_args
`
if
$cc
-c
$check_cpu_cflags
__test.c 2>/dev/null
;
then
echo
ok
break
;
fi
echo
failed
check_cpu_cflags
=
""
# if compile failed: check whether it supports a predecessor of this CPU
# this list is not complete, feel free to add further entries
case
"
$cpu_arg
"
in
# Intel ia32
nocona
)
cpu_arg
=
pentium4
;;
prescott
)
cpu_arg
=
pentium4
;;
pentium4m
)
cpu_arg
=
pentium4
;;
pentium4
)
cpu_arg
=
pentium3
;;
pentium3m
)
cpu_arg
=
pentium3
;;
pentium3
)
cpu_arg
=
pentium2
;;
pentium2
)
cpu_arg
=
pentiumpro
;;
pentiumpro
)
cpu_arg
=
pentium
;;
pentium
)
cpu_arg
=
i486
;;
i486
)
cpu_arg
=
i386
;;
# power / powerPC
7450
)
cpu_arg
=
7400
;;
*
)
cpu_arg
=
""
;;
esac
done
rm
__test.
*
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment