diff --git a/office/htmldoc/htmldoc.SlackBuild b/office/htmldoc/htmldoc.SlackBuild
index 6ac4ae7e17..8d8fb16161 100644
--- a/office/htmldoc/htmldoc.SlackBuild
+++ b/office/htmldoc/htmldoc.SlackBuild
@@ -27,10 +27,19 @@
PRGNAM=htmldoc
VERSION=1.8.27
-ARCH=${ARCH:-i486}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
+# Automatically determine the architecture we're building on:
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i486 ;;
+ arm*) ARCH=arm ;;
+ # Unless $ARCH is already set, use uname -m for all other archs:
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
@@ -47,6 +56,9 @@ elif [ "$ARCH" = "i686" ]; then
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
fi
rm -rf $PKG