1.1 --- a/common/autoconf/basics.m4 Fri Oct 26 14:29:57 2012 -0700 1.2 +++ b/common/autoconf/basics.m4 Mon Oct 29 14:06:57 2012 -0700 1.3 @@ -143,25 +143,25 @@ 1.4 else 1.5 STARTDIR=$PWD 1.6 COUNTER=0 1.7 - DIR=`$DIRNAME [$]$1` 1.8 - FILE=`$BASENAME [$]$1` 1.9 + sym_link_dir=`$DIRNAME [$]$1` 1.10 + sym_link_file=`$BASENAME [$]$1` 1.11 while test $COUNTER -lt 20; do 1.12 - ISLINK=`$LS -l $DIR/$FILE | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` 1.13 + ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` 1.14 if test "x$ISLINK" == x; then 1.15 # This is not a symbolic link! We are done! 1.16 break 1.17 fi 1.18 # The link might be relative! We have to use cd to travel safely. 1.19 - cd $DIR 1.20 + cd $sym_link_dir 1.21 # ... and we must get the to the absolute path, not one using symbolic links. 1.22 cd `pwd -P` 1.23 cd `$DIRNAME $ISLINK` 1.24 - DIR=`$THEPWDCMD` 1.25 - FILE=`$BASENAME $ISLINK` 1.26 + sym_link_dir=`$THEPWDCMD` 1.27 + sym_link_file=`$BASENAME $ISLINK` 1.28 let COUNTER=COUNTER+1 1.29 done 1.30 cd $STARTDIR 1.31 - $1=$DIR/$FILE 1.32 + $1=$sym_link_dir/$sym_link_file 1.33 fi 1.34 fi 1.35 ]) 1.36 @@ -340,7 +340,6 @@ 1.37 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], 1.38 [ 1.39 1.40 -AC_MSG_CHECKING([what configuration name to use]) 1.41 AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name], 1.42 [use this as the name of the configuration @<:@generated from important configuration options@:>@])], 1.43 [ CONF_NAME=${with_conf_name} ]) 1.44 @@ -366,7 +365,27 @@ 1.45 CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"` 1.46 fi 1.47 OUTPUT_ROOT="$CURDIR" 1.48 + 1.49 + # WARNING: This might be a bad thing to do. You need to be sure you want to 1.50 + # have a configuration in this directory. Do some sanity checks! 1.51 + 1.52 + if test ! -e "$OUTPUT_ROOT/spec.gmk"; then 1.53 + # If we have a spec.gmk, we have run here before and we are OK. Otherwise, check for 1.54 + # other files 1.55 + files_present=`$LS $OUTPUT_ROOT` 1.56 + if test "x$files_present" != x; then 1.57 + AC_MSG_NOTICE([Current directory is $CURDIR.]) 1.58 + AC_MSG_NOTICE([Since this is not the source root, configure will output the configuration here]) 1.59 + AC_MSG_NOTICE([(as opposed to creating a configuration in <src_root>/build/<conf-name>).]) 1.60 + AC_MSG_NOTICE([However, this directory is not empty. This is not allowed, since it could]) 1.61 + AC_MSG_NOTICE([seriously mess up just about everything.]) 1.62 + AC_MSG_NOTICE([Try 'cd $SRC_ROOT' and restart configure]) 1.63 + AC_MSG_NOTICE([(or create a new empty directory and cd to it).]) 1.64 + AC_MSG_ERROR([Will not continue creating configuration in $CURDIR]) 1.65 + fi 1.66 + fi 1.67 fi 1.68 +AC_MSG_CHECKING([what configuration name to use]) 1.69 AC_MSG_RESULT([$CONF_NAME]) 1.70 1.71 BASIC_FIXUP_PATH(OUTPUT_ROOT)