summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Kukunas <james.t.kukunas@linux.intel.com>2013-09-16 11:38:07 -0700
committerJim Kukunas <james.t.kukunas@linux.intel.com>2013-12-13 09:28:19 -0800
commit1af4192c78f291a3575fd4d83a2dc9f5e82e4458 (patch)
tree65b6a737c23cd18845ac14a72000fb70375f556b
parent50893291621658f355bc5b4d450a8d06a563053d (diff)
downloadProject-Tick-1af4192c78f291a3575fd4d83a2dc9f5e82e4458.tar.gz
Project-Tick-1af4192c78f291a3575fd4d83a2dc9f5e82e4458.zip
Add architecture detection in configure script.
This allows for per-architecture build tuning.
-rwxr-xr-xconfigure38
1 files changed, 38 insertions, 0 deletions
diff --git a/configure b/configure
index b77a8a8cf9..dfdde3ee2e 100755
--- a/configure
+++ b/configure
@@ -22,8 +22,28 @@ date >> configure.log
if [ -n "${CHOST}" ]; then
uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
CROSS_PREFIX="${CHOST}-"
+ ARCH="`echo "${CHOST}" | sed -e 's/-.*//'`"
+else
+ ARCH="`uname -m`"
fi
+case "${ARCH}" in
+ x86_64)
+ case "${CFLAGS}" in
+ *-m32*)
+ ARCH=i686
+ ;;
+ esac
+ ;;
+ i386 | i486 | i586 | i686)
+ case "${CFLAGS}" in
+ *-m64*)
+ ARCH=x86_64
+ ;;
+ esac
+ ;;
+esac
+
# destination name for static library
STATICLIB=libz.a
@@ -740,6 +760,24 @@ EOF
fi
fi
+# Set ARCH specific FLAGS
+case "${ARCH}" in
+ x86_64)
+ OBJC="${OBJC}"
+ PIC_OBJC="${PIC_OBJC}"
+
+ CFLAGS="${CFLAGS} -DX86_64"
+ SFLAGS="${SFLAGS} -DX86_64"
+ ;;
+ i386 | i486 | i586 | i686)
+ OBJC="${OBJC}"
+ PIC_OBJC="${PIC_OBJC}"
+
+ CFLAGS="${CFLAGS} -DX86"
+ SFLAGS="${SFLAGS} -DX86"
+ ;;
+esac
+
# show the results in the log
echo >> configure.log
echo ALL = $ALL >> configure.log