From a107d3b4f9644ea2e41f76778109f2927300da4b Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Wed, 1 Aug 2018 19:23:18 -0400 Subject: [PATCH] configure: Do --update check earlier. Previously we initialized variables and ran a few $CC tests first (which was what the old version of --update needed.) Now, we can do it almost immediately after the script begins. Spotted by running --update on a GCCless system (as the $CC tests gave warning messages due to no GCC, while CC= was set in --update environs.) --- configure | 80 +++++++++++++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/configure b/configure index 22ed44bb61..2a78d939a4 100755 --- a/configure +++ b/configure @@ -477,18 +477,46 @@ if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then usage; exit 0; fi -# ensure umask is not too restrictive -if [ $(umask) -gt 22 ]; then - echo "Your umask is too restrictive (should be: <= 0022; is actually:" $(umask)")" - exit 1 -fi - # get cwd and the source directory currentDir=`pwd` cd `dirname "$0"` sourceDir=`pwd` cd "$currentDir" +# determine output directory +if [ "$currentDir" = "$sourceDir" ]; then + outputDir=$currentDir/generated +else + outputDir=$currentDir +fi +buildOutputDir="$outputDir/build" +HAIKU_BUILD_ATTRIBUTES_DIR="$outputDir/attributes" +buildConfigFile="$buildOutputDir/BuildConfig" + +# check for update request +if [ "$1" = "--update" ]; then + if ! [ -e "$buildConfigFile" ]; then + echo $0 --update: \'$buildConfigFile\' not found - updating not possible. + exit 1 + fi + # get last configure invocation and flags from BuildConfig and call ourselves with it + lastPwd=`grep "#d " "$buildConfigFile" | cut -c 4-` + lastConfig=`grep "#c " "$buildConfigFile" | cut -c 4-` + lastEnv=`grep "#e " "$buildConfigFile" | cut -c 4-` + lastArgs=`grep "#a " "$buildConfigFile" | cut -c 4-` + if [ -z "$lastConfig" ]; then + echo "$0 --update: The previous configure invocation was not properly" \ + "encoded into '$buildConfigFile' - updating not possible." + exit 1 + fi + cd $lastPwd + if [ -n "$lastEnv" ]; then + export $lastEnv + fi + $lastConfig $lastArgs + exit $? +fi + # backup the passed arguments configureArgs="$@" configurePath=$0 @@ -503,6 +531,12 @@ for var in `env`; do esac done +# ensure umask is not too restrictive +if [ $(umask) -gt 22 ]; then + echo "Your umask is too restrictive (should be: <= 0022; is actually:" $(umask)")" + exit 1 +fi + # internal default parameter values # platform=`uname` @@ -572,40 +606,6 @@ supportedTargetArchs=" x86_gcc2 " -# determine output directory -if [ "$currentDir" = "$sourceDir" ]; then - outputDir=$currentDir/generated -else - outputDir=$currentDir -fi -buildOutputDir="$outputDir/build" -HAIKU_BUILD_ATTRIBUTES_DIR="$outputDir/attributes" -buildConfigFile="$buildOutputDir/BuildConfig" - -# check for update request -if [ "$1" = "--update" ]; then - if ! [ -e "$buildConfigFile" ]; then - echo $0 --update: \'$buildConfigFile\' not found - updating not possible. - exit 1 - fi - # get last configure invocation and flags from BuildConfig and call ourselves with it - lastPwd=`grep "#d " "$buildConfigFile" | cut -c 4-` - lastConfig=`grep "#c " "$buildConfigFile" | cut -c 4-` - lastEnv=`grep "#e " "$buildConfigFile" | cut -c 4-` - lastArgs=`grep "#a " "$buildConfigFile" | cut -c 4-` - if [ -z "$lastConfig" ]; then - echo "$0 --update: The previous configure invocation was not properly" \ - "encoded into '$buildConfigFile' - updating not possible." - exit 1 - fi - cd $lastPwd - if [ -n "$lastEnv" ]; then - export $lastEnv - fi - $lastConfig $lastArgs - exit $? -fi - # parse parameters # while [ $# -gt 0 ] ; do