forked from markfasheh/ocfs2-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpmarch.guess
executable file
·74 lines (65 loc) · 1.39 KB
/
rpmarch.guess
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#! /bin/sh
mode="$1"
srcdir="$2"
host_cpu=
QUERYFILE=
if test -f /etc/redhat-release ; then
QUERYFILE=/etc/redhat-release
elif test -f /etc/SuSE-release ; then
QUERYFILE=/etc/SuSE-release
elif test -f /etc/UnitedLinux-release ; then
QUERYFILE=/etc/UnitedLinux-release
fi
if test -n "$QUERYFILE"; then
host_cpu="`rpm -qf $QUERYFILE --queryformat \"%{ARCH}\"`"
fi
if test -z "$host_cpu" -o "$host_cpu" = "noarch" ; then
host_alias=`$srcdir/config.guess`
host=`$srcdir/config.sub $host_alias`
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
fi
case "$host_cpu" in
x86_64|ia64|s390x)
TESTARCH=""
;;
i386|i486|i586|i686|i786|k6|k7)
TESTARCH="i386"
;;
ppc|ppc64|ppciseries|ppcpseries|ppc64iseries|ppc64pseries|powerpc|powerpc64)
TESTARCH="ppc"
;;
*)
echo "rpmarch.guess: Warning: unknown RPM CPU architecture: $host_cpu" >&2
TESTARCH=""
;;
esac
# Only a few of these need to be overwritten from RPM's default
case "$host_cpu" in
i586)
MODULEARCH="$host_cpu"
;;
i386)
MODULEARCH="i686"
;;
*)
MODULEARCH=""
;;
esac
case "$mode" in
module)
if [ -n "$MODULEARCH" ] ; then
echo "--target $MODULEARCH"
fi
;;
tools)
if [ -n "$TESTARCH" ] ; then
echo "--target $TESTARCH"
fi
;;
*)
echo "rpmarch.guess: Invalid mode: $mode" >&2
echo "error"
exit 1
;;
esac
exit 0