Wed, 14 Nov 2012 10:18:51 -0800
8003317: build-infra: Configure fails when current dir is part of a symlink
Summary: Call macro for removing symbolic links on a copy of the CURDIR variable before comparing
Reviewed-by: ohair, tbell
Contributed-by: erik.joelsson@oracle.com
common/autoconf/basics.m4 | file | annotate | diff | comparison | revisions | |
common/autoconf/generated-configure.sh | file | annotate | diff | comparison | revisions |
1.1 --- a/common/autoconf/basics.m4 Wed Nov 14 10:16:45 2012 -0800 1.2 +++ b/common/autoconf/basics.m4 Wed Nov 14 10:18:51 2012 -0800 1.3 @@ -345,7 +345,13 @@ 1.4 [ CONF_NAME=${with_conf_name} ]) 1.5 1.6 # Test from where we are running configure, in or outside of src root. 1.7 -if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then 1.8 +# To enable comparison of directories, CURDIR needs to be symlink free 1.9 +# just like SRC_ROOT already is 1.10 +NOSYM_CURDIR="$CURDIR" 1.11 +BASIC_REMOVE_SYMBOLIC_LINKS(NOSYM_CURDIR) 1.12 +if test "x$NOSYM_CURDIR" = "x$SRC_ROOT" || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common" \ 1.13 + || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common/autoconf" \ 1.14 + || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common/makefiles" ; then 1.15 # We are running configure from the src root. 1.16 # Create a default ./build/target-variant-debuglevel output root. 1.17 if test "x${CONF_NAME}" = x; then
2.1 --- a/common/autoconf/generated-configure.sh Wed Nov 14 10:16:45 2012 -0800 2.2 +++ b/common/autoconf/generated-configure.sh Wed Nov 14 10:18:51 2012 -0800 2.3 @@ -3068,7 +3068,7 @@ 2.4 #CUSTOM_AUTOCONF_INCLUDE 2.5 2.6 # Do not change or remove the following line, it is needed for consistency checks: 2.7 -DATE_WHEN_GENERATED=1352916966 2.8 +DATE_WHEN_GENERATED=1352917083 2.9 2.10 ############################################################################### 2.11 # 2.12 @@ -7137,7 +7137,56 @@ 2.13 2.14 2.15 # Test from where we are running configure, in or outside of src root. 2.16 -if test "x$CURDIR" = "x$SRC_ROOT" || test "x$CURDIR" = "x$SRC_ROOT/common" || test "x$CURDIR" = "x$SRC_ROOT/common/autoconf" || test "x$CURDIR" = "x$SRC_ROOT/common/makefiles" ; then 2.17 +# To enable comparison of directories, CURDIR needs to be symlink free 2.18 +# just like SRC_ROOT already is 2.19 +NOSYM_CURDIR="$CURDIR" 2.20 + 2.21 + if test "x$OPENJDK_BUILD_OS" != xwindows; then 2.22 + # Follow a chain of symbolic links. Use readlink 2.23 + # where it exists, else fall back to horribly 2.24 + # complicated shell code. 2.25 + if test "x$READLINK_TESTED" != yes; then 2.26 + # On MacOSX there is a readlink tool with a different 2.27 + # purpose than the GNU readlink tool. Check the found readlink. 2.28 + ISGNU=`$READLINK --help 2>&1 | $GREP GNU` 2.29 + if test "x$ISGNU" = x; then 2.30 + # A readlink that we do not know how to use. 2.31 + # Are there other non-GNU readlinks out there? 2.32 + READLINK_TESTED=yes 2.33 + READLINK= 2.34 + fi 2.35 + fi 2.36 + 2.37 + if test "x$READLINK" != x; then 2.38 + NOSYM_CURDIR=`$READLINK -f $NOSYM_CURDIR` 2.39 + else 2.40 + STARTDIR=$PWD 2.41 + COUNTER=0 2.42 + sym_link_dir=`$DIRNAME $NOSYM_CURDIR` 2.43 + sym_link_file=`$BASENAME $NOSYM_CURDIR` 2.44 + while test $COUNTER -lt 20; do 2.45 + ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'` 2.46 + if test "x$ISLINK" == x; then 2.47 + # This is not a symbolic link! We are done! 2.48 + break 2.49 + fi 2.50 + # The link might be relative! We have to use cd to travel safely. 2.51 + cd $sym_link_dir 2.52 + # ... and we must get the to the absolute path, not one using symbolic links. 2.53 + cd `pwd -P` 2.54 + cd `$DIRNAME $ISLINK` 2.55 + sym_link_dir=`$THEPWDCMD` 2.56 + sym_link_file=`$BASENAME $ISLINK` 2.57 + let COUNTER=COUNTER+1 2.58 + done 2.59 + cd $STARTDIR 2.60 + NOSYM_CURDIR=$sym_link_dir/$sym_link_file 2.61 + fi 2.62 + fi 2.63 + 2.64 +if test "x$NOSYM_CURDIR" = "x$SRC_ROOT" || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common" \ 2.65 + || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common/autoconf" \ 2.66 + || test "x$NOSYM_CURDIR" = "x$SRC_ROOT/common/makefiles" ; then 2.67 # We are running configure from the src root. 2.68 # Create a default ./build/target-variant-debuglevel output root. 2.69 if test "x${CONF_NAME}" = x; then