configure: use stat -f on bsds, -c otherwise

Move host platform detection up, fix indentation.

If the host platform is a BSD (darwin|freebsd|openbsd) use stat -f,
otherwise use stat -c to check for a restrictive umask.

Change-Id: Ifb57eb69153221a23a84700445ff08a96517844a
Reviewed-on: https://review.haiku-os.org/c/1535
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
John Scipione 2019-06-27 15:53:47 -07:00 committed by waddlesplash
parent fdc59e4e7e
commit 2a1cc90e3e

57
configure vendored
View File

@ -555,16 +555,6 @@ if [ `umask` -gt 22 ]; then
echo you will need to run \"git checkout\" again to fix this. echo you will need to run \"git checkout\" again to fix this.
exit 1 exit 1
fi fi
# ensure git checkout was not done with a restrictive umask
if [ `stat -c '%a' "$sourceDir/data/system/boot/SetupEnvironment"` -lt 644 ]; then
echo "The source tree was cloned with a umask > 0022. It seems you"
echo have already corrected your umask, but not re-checked-out the
echo source tree. Try running:
echo " git checkout --force"
echo to fix this problem.
exit 1
fi
# internal default parameter values # internal default parameter values
# #
@ -584,6 +574,37 @@ if [ -z "$CC" ]; then
CC=gcc CC=gcc
fi fi
# detect the build platform
case "${platform}" in
Darwin) HOST_PLATFORM=darwin ;;
FreeBSD) HOST_PLATFORM=freebsd
if [ "$HAIKU_HOST_USE_32BIT" = 1 ] ; then
echo Unsupported platform: FreeBSD ${platformMachine}
exit 1
fi ;;
Haiku) HOST_PLATFORM=haiku_host ;;
Linux) HOST_PLATFORM=linux ;;
OpenBSD) HOST_PLATFORM=openbsd ;;
MINGW*) HOST_PLATFORM=mingw ;;
*) echo Unsupported platform: ${platform}
exit 1 ;;
esac
case $HOST_PLATFORM in
darwin|freebsd|openbsd) statCmd='stat -f' ;;
*) statCmd='stat -c' ;;
esac
# ensure git checkout was not done with a restrictive umask
if [ `$statCmd '%a' "$sourceDir/data/system/boot/SetupEnvironment"` -lt 644 ]; then
echo "The source tree was cloned with a umask > 0022. It seems you"
echo have already corrected your umask, but not re-checked-out the
echo source tree. Try running:
echo " git checkout --force"
echo to fix this problem.
exit 1
fi
# exported (BuildSetup) default parameter values # exported (BuildSetup) default parameter values
# #
HOST_GCC_RAW_VERSION=`$CC -dumpversion` HOST_GCC_RAW_VERSION=`$CC -dumpversion`
@ -771,22 +792,6 @@ while [ $# -gt 0 ] ; do
esac esac
done done
# detect the build platform
case "${platform}" in
Darwin) HOST_PLATFORM=darwin ;;
FreeBSD) HOST_PLATFORM=freebsd
if [ "$HAIKU_HOST_USE_32BIT" = 1 ] ; then
echo Unsupported platform: FreeBSD ${platformMachine}
exit 1
fi ;;
Haiku) HOST_PLATFORM=haiku_host ;;
Linux) HOST_PLATFORM=linux ;;
OpenBSD) HOST_PLATFORM=openbsd ;;
MINGW*) HOST_PLATFORM=mingw ;;
*) echo Unsupported platform: ${platform}
exit 1 ;;
esac
# check for case-sensitive filesystem # check for case-sensitive filesystem
mkdir haikuCaseTest 2>/dev/null mkdir haikuCaseTest 2>/dev/null
mkdir haikucasetest 2>/dev/null mkdir haikucasetest 2>/dev/null