From 523c3c21bbdb32a6c825e3c6c2519d0cd7492539 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Thu, 11 Aug 2011 19:13:22 +0000
Subject: [PATCH] Use sysctl hw.optional.x86_64 to detect 64-bit support with a
 32-bit kernel

---
 src/build/Common.gmake | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/build/Common.gmake b/src/build/Common.gmake
index 29ae1ca3b4..8bc4ccbd4f 100644
--- a/src/build/Common.gmake
+++ b/src/build/Common.gmake
@@ -196,11 +196,14 @@ ifndef os
 endif
 os      :=	$(shell echo $(os) | tr '[A-Z]' '[a-z]' | tr ' ' '_')
 
+machine		:=	$(shell if uname -m | egrep -v "(i[3456789]*|x)86" > /dev/null; then uname -m | tr "[A-Z]" "[a-z]" | tr " " "_" ; fi)
+machine		:=	$(shell if uname -m | egrep "64" > /dev/null; then uname -m | tr "[A-Z]" "[a-z]" | tr " " "_" ; else echo $(machine) ; fi)
 ifeq ($(os),darwin)
- machine		:=	$(shell ld -w 2>&1 | sed -E 's/.*[[:space:]]//')
-else
- machine		:=	$(shell if uname -m | egrep -v "(i[3456789]*|x)86" > /dev/null; then uname -m | tr "[A-Z]" "[a-z]" | tr " " "_" ; fi)
- machine		:=	$(shell if uname -m | egrep "64" > /dev/null; then uname -m | tr "[A-Z]" "[a-z]" | tr " " "_" ; else echo $(machine) ; fi)
+ ifeq ("$(machine)","")
+  ifeq ($(shell sysctl hw.optional.x86_64),hw.optional.x86_64: 1)
+   machine	:= x86_64
+  endif
+ endif
 endif
 
 ifeq ($(machine),x86_64)
-- 
GitLab