common/autoconf/basics.m4
changeset 14563 f0ac652fdbbb
parent 14461 7511ccfbebc0
child 14736 ee810661e3d1
equal deleted inserted replaced
14562:ab12d5824d04 14563:f0ac652fdbbb
   127         # where it exists, else fall back to horribly
   127         # where it exists, else fall back to horribly
   128         # complicated shell code.
   128         # complicated shell code.
   129         if test "x$READLINK_TESTED" != yes; then
   129         if test "x$READLINK_TESTED" != yes; then
   130             # On MacOSX there is a readlink tool with a different
   130             # On MacOSX there is a readlink tool with a different
   131             # purpose than the GNU readlink tool. Check the found readlink.
   131             # purpose than the GNU readlink tool. Check the found readlink.
   132             ISGNU=`$READLINK --help 2>&1 | $GREP GNU`
   132             ISGNU=`$READLINK --version 2>&1 | $GREP GNU`
   133             if test "x$ISGNU" = x; then
   133             if test "x$ISGNU" = x; then
   134                  # A readlink that we do not know how to use.
   134                  # A readlink that we do not know how to use.
   135                  # Are there other non-GNU readlinks out there?
   135                  # Are there other non-GNU readlinks out there?
   136                  READLINK_TESTED=yes
   136                  READLINK_TESTED=yes
   137                  READLINK=
   137                  READLINK=
   139         fi
   139         fi
   140 
   140 
   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             # Save the current directory for restoring afterwards
   144             STARTDIR=$PWD
   145             STARTDIR=$PWD
   145             COUNTER=0
   146             COUNTER=0
   146             sym_link_dir=`$DIRNAME [$]$1`
   147             sym_link_dir=`$DIRNAME [$]$1`
   147             sym_link_file=`$BASENAME [$]$1`
   148             sym_link_file=`$BASENAME [$]$1`
       
   149             # Use the system pwd and not the shell builtin to resolve directory symlinks
       
   150             cd $sym_link_dir
       
   151             cd `$THEPWDCMD`
       
   152             sym_link_dir=`$THEPWDCMD`
       
   153             # Resolve file symlinks
   148             while test $COUNTER -lt 20; do
   154             while test $COUNTER -lt 20; do
   149                 ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
   155                 ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
   150                 if test "x$ISLINK" == x; then
   156                 if test "x$ISLINK" == x; then
   151                     # This is not a symbolic link! We are done!
   157                     # This is not a symbolic link! We are done!
   152                     break
   158                     break
   153                 fi
   159                 fi
   154                 # The link might be relative! We have to use cd to travel safely.
   160                 # Again resolve directory symlinks since the target of the just found
   155                 cd $sym_link_dir
   161                 # link could be in a different directory
   156                 # ... and we must get the to the absolute path, not one using symbolic links.             
       
   157                 cd `pwd -P`
       
   158                 cd `$DIRNAME $ISLINK`
   162                 cd `$DIRNAME $ISLINK`
   159                 sym_link_dir=`$THEPWDCMD`
   163                 sym_link_dir=`$THEPWDCMD`
   160                 sym_link_file=`$BASENAME $ISLINK`
   164                 sym_link_file=`$BASENAME $ISLINK`
   161                 let COUNTER=COUNTER+1
   165                 let COUNTER=COUNTER+1
   162             done
   166             done
   284 AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD`
   288 AUTOCONF_DIR=`cd \`$DIRNAME $SCRIPT\`; $THEPWDCMD`
   285 
   289 
   286 # Where is the source? It is located two levels above the configure script.
   290 # Where is the source? It is located two levels above the configure script.
   287 CURDIR="$PWD"
   291 CURDIR="$PWD"
   288 cd "$AUTOCONF_DIR/../.."
   292 cd "$AUTOCONF_DIR/../.."
   289 SRC_ROOT="`pwd`"
   293 SRC_ROOT="`$THEPWDCMD`"
   290 
   294 
   291 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   295 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
   292   PATH_SEP=";"
   296   PATH_SEP=";"
   293   BASIC_CHECK_PATHS_WINDOWS
   297   BASIC_CHECK_PATHS_WINDOWS
   294 else
   298 else