Skip to content

Commit f8514d9

Browse files
committed
build: uname -m is a lie on 64-bit Darwin. Add a workaround.
1 parent 106216d commit f8514d9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

configure

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,17 @@ need_cmd sed
127127
msg "inspecting environment"
128128

129129
CFG_OSTYPE=$(uname -s)
130+
130131
CFG_CPUTYPE=$(uname -m)
132+
if [ $CFG_OSTYPE = Darwin -a $CFG_CPUTYPE = i386 ]
133+
then
134+
# Darwin's `uname -s` lies and always returns i386. We have to use sysctl
135+
# instead.
136+
if sysctl hw.optional.x86_64 | grep ': 1'
137+
then
138+
CFG_CPUTYPE=x86_64
139+
fi
140+
fi
131141

132142
CFG_SELF=$(echo $0 | tr '\\' '/')
133143
CFG_SRC_DIR=${CFG_SELF%${CFG_SELF##*/}}

0 commit comments

Comments
 (0)