141 if test "x$READLINK" != x; then |
141 if test "x$READLINK" != x; then |
142 $1=`$READLINK -f [$]$1` |
142 $1=`$READLINK -f [$]$1` |
143 else |
143 else |
144 STARTDIR=$PWD |
144 STARTDIR=$PWD |
145 COUNTER=0 |
145 COUNTER=0 |
146 DIR=`$DIRNAME [$]$1` |
146 sym_link_dir=`$DIRNAME [$]$1` |
147 FILE=`$BASENAME [$]$1` |
147 sym_link_file=`$BASENAME [$]$1` |
148 while test $COUNTER -lt 20; do |
148 while test $COUNTER -lt 20; do |
149 ISLINK=`$LS -l $DIR/$FILE | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` |
149 ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` |
150 if test "x$ISLINK" == x; then |
150 if test "x$ISLINK" == x; then |
151 # This is not a symbolic link! We are done! |
151 # This is not a symbolic link! We are done! |
152 break |
152 break |
153 fi |
153 fi |
154 # The link might be relative! We have to use cd to travel safely. |
154 # The link might be relative! We have to use cd to travel safely. |
155 cd $DIR |
155 cd $sym_link_dir |
156 # ... and we must get the to the absolute path, not one using symbolic links. |
156 # ... and we must get the to the absolute path, not one using symbolic links. |
157 cd `pwd -P` |
157 cd `pwd -P` |
158 cd `$DIRNAME $ISLINK` |
158 cd `$DIRNAME $ISLINK` |
159 DIR=`$THEPWDCMD` |
159 sym_link_dir=`$THEPWDCMD` |
160 FILE=`$BASENAME $ISLINK` |
160 sym_link_file=`$BASENAME $ISLINK` |
161 let COUNTER=COUNTER+1 |
161 let COUNTER=COUNTER+1 |
162 done |
162 done |
163 cd $STARTDIR |
163 cd $STARTDIR |
164 $1=$DIR/$FILE |
164 $1=$sym_link_dir/$sym_link_file |
165 fi |
165 fi |
166 fi |
166 fi |
167 ]) |
167 ]) |
168 |
168 |
169 AC_DEFUN_ONCE([BASIC_INIT], |
169 AC_DEFUN_ONCE([BASIC_INIT], |
338 ]) |
338 ]) |
339 |
339 |
340 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], |
340 AC_DEFUN_ONCE([BASIC_SETUP_OUTPUT_DIR], |
341 [ |
341 [ |
342 |
342 |
343 AC_MSG_CHECKING([what configuration name to use]) |
|
344 AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name], |
343 AC_ARG_WITH(conf-name, [AS_HELP_STRING([--with-conf-name], |
345 [use this as the name of the configuration @<:@generated from important configuration options@:>@])], |
344 [use this as the name of the configuration @<:@generated from important configuration options@:>@])], |
346 [ CONF_NAME=${with_conf_name} ]) |
345 [ CONF_NAME=${with_conf_name} ]) |
347 |
346 |
348 # Test from where we are running configure, in or outside of src root. |
347 # Test from where we are running configure, in or outside of src root. |
364 # directory name as configuration name, otherwise use the complete path. |
363 # directory name as configuration name, otherwise use the complete path. |
365 if test "x${CONF_NAME}" = x; then |
364 if test "x${CONF_NAME}" = x; then |
366 CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"` |
365 CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${SRC_ROOT}/build/!!"` |
367 fi |
366 fi |
368 OUTPUT_ROOT="$CURDIR" |
367 OUTPUT_ROOT="$CURDIR" |
369 fi |
368 |
|
369 # WARNING: This might be a bad thing to do. You need to be sure you want to |
|
370 # have a configuration in this directory. Do some sanity checks! |
|
371 |
|
372 if test ! -e "$OUTPUT_ROOT/spec.gmk"; then |
|
373 # If we have a spec.gmk, we have run here before and we are OK. Otherwise, check for |
|
374 # other files |
|
375 files_present=`$LS $OUTPUT_ROOT` |
|
376 if test "x$files_present" != x; then |
|
377 AC_MSG_NOTICE([Current directory is $CURDIR.]) |
|
378 AC_MSG_NOTICE([Since this is not the source root, configure will output the configuration here]) |
|
379 AC_MSG_NOTICE([(as opposed to creating a configuration in <src_root>/build/<conf-name>).]) |
|
380 AC_MSG_NOTICE([However, this directory is not empty. This is not allowed, since it could]) |
|
381 AC_MSG_NOTICE([seriously mess up just about everything.]) |
|
382 AC_MSG_NOTICE([Try 'cd $SRC_ROOT' and restart configure]) |
|
383 AC_MSG_NOTICE([(or create a new empty directory and cd to it).]) |
|
384 AC_MSG_ERROR([Will not continue creating configuration in $CURDIR]) |
|
385 fi |
|
386 fi |
|
387 fi |
|
388 AC_MSG_CHECKING([what configuration name to use]) |
370 AC_MSG_RESULT([$CONF_NAME]) |
389 AC_MSG_RESULT([$CONF_NAME]) |
371 |
390 |
372 BASIC_FIXUP_PATH(OUTPUT_ROOT) |
391 BASIC_FIXUP_PATH(OUTPUT_ROOT) |
373 |
392 |
374 AC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk) |
393 AC_SUBST(SPEC, $OUTPUT_ROOT/spec.gmk) |