diff --git a/src/build/Common.gmake b/src/build/Common.gmake
index 29ae1ca3b4b8da19f699d61a91574f6498b287fb..8bc4ccbd4f6164d4862dea55c72866f7eed39d98 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)