1.1 --- a/common/autoconf/basics.m4 Mon Dec 03 10:26:55 2012 +0100 1.2 +++ b/common/autoconf/basics.m4 Wed Dec 05 09:39:34 2012 +0100 1.3 @@ -129,7 +129,7 @@ 1.4 if test "x$READLINK_TESTED" != yes; then 1.5 # On MacOSX there is a readlink tool with a different 1.6 # purpose than the GNU readlink tool. Check the found readlink. 1.7 - ISGNU=`$READLINK --help 2>&1 | $GREP GNU` 1.8 + ISGNU=`$READLINK --version 2>&1 | $GREP GNU` 1.9 if test "x$ISGNU" = x; then 1.10 # A readlink that we do not know how to use. 1.11 # Are there other non-GNU readlinks out there? 1.12 @@ -141,20 +141,24 @@ 1.13 if test "x$READLINK" != x; then 1.14 $1=`$READLINK -f [$]$1` 1.15 else 1.16 + # Save the current directory for restoring afterwards 1.17 STARTDIR=$PWD 1.18 COUNTER=0 1.19 sym_link_dir=`$DIRNAME [$]$1` 1.20 sym_link_file=`$BASENAME [$]$1` 1.21 + # Use the system pwd and not the shell builtin to resolve directory symlinks 1.22 + cd $sym_link_dir 1.23 + cd `$THEPWDCMD` 1.24 + sym_link_dir=`$THEPWDCMD` 1.25 + # Resolve file symlinks 1.26 while test $COUNTER -lt 20; do 1.27 ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` 1.28 if test "x$ISLINK" == x; then 1.29 # This is not a symbolic link! We are done! 1.30 break 1.31 fi 1.32 - # The link might be relative! We have to use cd to travel safely. 1.33 - cd $sym_link_dir 1.34 - # ... and we must get the to the absolute path, not one using symbolic links. 1.35 - cd `pwd -P` 1.36 + # Again resolve directory symlinks since the target of the just found 1.37 + # link could be in a different directory 1.38 cd `$DIRNAME $ISLINK` 1.39 sym_link_dir=`$THEPWDCMD` 1.40 sym_link_file=`$BASENAME $ISLINK` 1.41 @@ -286,7 +290,7 @@ 1.42 # Where is the source? It is located two levels above the configure script. 1.43 CURDIR="$PWD" 1.44 cd "$AUTOCONF_DIR/../.." 1.45 -SRC_ROOT="`pwd`" 1.46 +SRC_ROOT="`$THEPWDCMD`" 1.47 1.48 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then 1.49 PATH_SEP=";"