diff --git a/core/c/jbigi/build_jbigi.sh b/core/c/jbigi/build_jbigi.sh
index 61b2fb82eb2296a3a66a8cfb5623d2381595d3d9..f2c042ef03d029ec6ca91dd497d0e18462d72288 100755
--- a/core/c/jbigi/build_jbigi.sh
+++ b/core/c/jbigi/build_jbigi.sh
@@ -5,7 +5,17 @@
 [ -z "$CC" ] && CC="gcc"
 
 if [ -z $BITS ]; then
-  BITS=64
+  if [[ $(uname -a) =~ "x86_64" ]]; then
+    BITS=64
+  elif [[ $(uname -a) =~ "i386" ]]; then
+    BITS=32
+  elif [[ $(uname -a) =~ "i686" ]]; then
+    BITS=32
+  else
+    echo "Unable to detect default setting for BITS variable"
+    exit
+  fi
+
   printf "\aBITS variable not set, defaulting to $BITS\n\a" >&2
 fi
 
diff --git a/core/c/jbigi/mbuild-all.sh b/core/c/jbigi/mbuild-all.sh
index e74f29c00d7aa3ada6dbee3939cbdc21ad2bfdc8..5099b578d2b4d9a07268036d03cdac30030f1953 100755
--- a/core/c/jbigi/mbuild-all.sh
+++ b/core/c/jbigi/mbuild-all.sh
@@ -86,10 +86,22 @@ fi
 
 
 if [ -z $BITS ]; then
-  BITS=32
+  UNAME="$(uname -a)"
+  if test "${UNAME#*x86_64}" != "x86_&4"; then
+    BITS=64
+  elif test "${UNAME#*i386}" != "i386"; then
+    BITS=32
+  elif test "${UNAME#*i686}" != "i686"; then
+    BITS=32
+  else
+    echo "Unable to detect default setting for BITS variable"
+    exit
+  fi
+
   printf "\aBITS variable not set, defaulting to $BITS\n\a" >&2
 fi
 
+
 if [ -z $CC ]; then
   export CC="gcc"
   printf "\aCC variable not set, defaulting to $CC\n\a" >&2
diff --git a/core/c/jcpuid/build.sh b/core/c/jcpuid/build.sh
index cb9a7e500028f46bde490d109ce8c8b371359846..63dacb55e968d973f3955968e3c169ba4b568d3b 100755
--- a/core/c/jcpuid/build.sh
+++ b/core/c/jcpuid/build.sh
@@ -24,10 +24,22 @@ esac
 
 
 if [ -z $BITS ]; then
-  BITS=64
+  UNAME="$(uname -a)"
+  if test "${UNAME#*x86_64}" != "x86_&4"; then
+    BITS=64
+  elif test "${UNAME#*i386}" != "i386"; then
+    BITS=32
+  elif test "${UNAME#*i686}" != "i686"; then
+    BITS=32
+  else
+    echo "Unable to detect default setting for BITS variable"
+    exit
+  fi
+
   printf "\aBITS variable not set, defaulting to $BITS\n\a" >&2
 fi
 
+
 if [ -z $CC ]; then
   export CC="gcc"
   printf "\aCC variable not set, defaulting to $CC\n\a" >&2