8221907: make reconfigure breaks when configured with relative paths
authorerikj
Fri, 05 Apr 2019 06:48:20 -0700
changeset 54455 542735f2a53e
parent 54454 22ee881e6a74
child 54456 a8db7fd22fd1
8221907: make reconfigure breaks when configured with relative paths Reviewed-by: dholmes
make/Init.gmk
make/autoconf/basics.m4
make/autoconf/basics_windows.m4
make/autoconf/spec.gmk.in
make/autoconf/toolchain_windows.m4
--- a/make/Init.gmk	Mon Apr 08 15:25:27 2019 +0200
+++ b/make/Init.gmk	Fri Apr 05 06:48:20 2019 -0700
@@ -279,7 +279,7 @@
         else
 	  $(ECHO) "Re-running configure using default settings"
         endif
-	( cd $(OUTPUTDIR) && PATH="$(ORIGINAL_PATH)" AUTOCONF="$(AUTOCONF)" \
+	( cd $(CONFIGURE_START_DIR) && PATH="$(ORIGINAL_PATH)" AUTOCONF="$(AUTOCONF)" \
 	    CUSTOM_ROOT="$(CUSTOM_ROOT)" \
 	    CUSTOM_CONFIG_DIR="$(CUSTOM_CONFIG_DIR)" \
 	    $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
--- a/make/autoconf/basics.m4	Mon Apr 08 15:25:27 2019 +0200
+++ b/make/autoconf/basics.m4	Fri Apr 05 06:48:20 2019 -0700
@@ -627,7 +627,7 @@
 AC_DEFUN_ONCE([BASIC_SETUP_PATHS],
 [
   # Save the current directory this script was started from
-  CURDIR="$PWD"
+  CONFIGURE_START_DIR="$PWD"
 
   # We might need to rewrite ORIGINAL_PATH, if it includes "#", to quote them
   # for make. We couldn't do this when we retrieved ORIGINAL_PATH, since SED
@@ -653,9 +653,10 @@
   AC_MSG_CHECKING([for top-level directory])
   AC_MSG_RESULT([$TOPDIR])
   AC_SUBST(TOPDIR)
+  AC_SUBST(CONFIGURE_START_DIR)
 
   # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS.
-  BASIC_FIXUP_PATH(CURDIR)
+  BASIC_FIXUP_PATH(CONFIGURE_START_DIR)
   BASIC_FIXUP_PATH(TOPDIR)
 
   # Locate the directory of this script.
@@ -868,9 +869,10 @@
 
   # Test from where we are running configure, in or outside of src root.
   AC_MSG_CHECKING([where to store configuration])
-  if test "x$CURDIR" = "x$TOPDIR" || test "x$CURDIR" = "x$CUSTOM_ROOT" \
-      || test "x$CURDIR" = "x$TOPDIR/make/autoconf" \
-      || test "x$CURDIR" = "x$TOPDIR/make" ; then
+  if test "x$CONFIGURE_START_DIR" = "x$TOPDIR" \
+      || test "x$CONFIGURE_START_DIR" = "x$CUSTOM_ROOT" \
+      || test "x$CONFIGURE_START_DIR" = "x$TOPDIR/make/autoconf" \
+      || test "x$CONFIGURE_START_DIR" = "x$TOPDIR/make" ; then
     # We are running configure from the src root.
     # Create a default ./build/target-variant-debuglevel output root.
     if test "x${CONF_NAME}" = x; then
@@ -895,9 +897,9 @@
     # If configuration is situated in normal build directory, just use the build
     # directory name as configuration name, otherwise use the complete path.
     if test "x${CONF_NAME}" = x; then
-      CONF_NAME=`$ECHO $CURDIR | $SED -e "s!^${TOPDIR}/build/!!"`
+      CONF_NAME=`$ECHO $CONFIGURE_START_DIR | $SED -e "s!^${TOPDIR}/build/!!"`
     fi
-    OUTPUTDIR="$CURDIR"
+    OUTPUTDIR="$CONFIGURE_START_DIR"
     AC_MSG_RESULT([in current directory])
 
     # WARNING: This might be a bad thing to do. You need to be sure you want to
@@ -917,14 +919,14 @@
               -e 's/ //g' \
           | $TR -d '\n'`
       if test "x$filtered_files" != x; then
-        AC_MSG_NOTICE([Current directory is $CURDIR.])
+        AC_MSG_NOTICE([Current directory is $CONFIGURE_START_DIR.])
         AC_MSG_NOTICE([Since this is not the source root, configure will output the configuration here])
         AC_MSG_NOTICE([(as opposed to creating a configuration in <src_root>/build/<conf-name>).])
         AC_MSG_NOTICE([However, this directory is not empty. This is not allowed, since it could])
         AC_MSG_NOTICE([seriously mess up just about everything.])
         AC_MSG_NOTICE([Try 'cd $TOPDIR' and restart configure])
         AC_MSG_NOTICE([(or create a new empty directory and cd to it).])
-        AC_MSG_ERROR([Will not continue creating configuration in $CURDIR])
+        AC_MSG_ERROR([Will not continue creating configuration in $CONFIGURE_START_DIR])
       fi
     fi
   fi
--- a/make/autoconf/basics_windows.m4	Mon Apr 08 15:25:27 2019 +0200
+++ b/make/autoconf/basics_windows.m4	Fri Apr 05 06:48:20 2019 -0700
@@ -551,7 +551,7 @@
     $MKDIR -p $FIXPATH_DIR $CONFIGURESUPPORT_OUTPUTDIR/bin
     cd $FIXPATH_DIR
     $CC $FIXPATH_SRC_W -Fe$FIXPATH_BIN_W > $FIXPATH_DIR/fixpath1.log 2>&1
-    cd $CURDIR
+    cd $CONFIGURE_START_DIR
 
     if test ! -x $FIXPATH_BIN; then
       AC_MSG_RESULT([no])
@@ -574,7 +574,7 @@
     cd $FIXPATH_DIR
     $FIXPATH $CC $FIXPATH_SRC -Fe$FIXPATH_DIR/fixpath2.exe \
         > $FIXPATH_DIR/fixpath2.log 2>&1
-    cd $CURDIR
+    cd $CONFIGURE_START_DIR
     if test ! -x $FIXPATH_DIR/fixpath2.exe; then
       AC_MSG_RESULT([no])
       cat $FIXPATH_DIR/fixpath2.log
--- a/make/autoconf/spec.gmk.in	Mon Apr 08 15:25:27 2019 +0200
+++ b/make/autoconf/spec.gmk.in	Fri Apr 05 06:48:20 2019 -0700
@@ -32,6 +32,8 @@
 
 # The command line given to configure.
 CONFIGURE_COMMAND_LINE:=@CONFIGURE_COMMAND_LINE@
+# The current directory when configure was run
+CONFIGURE_START_DIR:=@CONFIGURE_START_DIR@
 
 # A self-referential reference to this file.
 SPEC:=@SPEC@
@@ -139,7 +141,6 @@
 # The top-level directory of the source repository
 TOPDIR:=@TOPDIR@
 
-
 IMPORT_MODULES_CLASSES:=@IMPORT_MODULES_CLASSES@
 IMPORT_MODULES_CMDS:=@IMPORT_MODULES_CMDS@
 IMPORT_MODULES_LIBS:=@IMPORT_MODULES_LIBS@
--- a/make/autoconf/toolchain_windows.m4	Mon Apr 08 15:25:27 2019 +0200
+++ b/make/autoconf/toolchain_windows.m4	Fri Apr 05 06:48:20 2019 -0700
@@ -472,7 +472,7 @@
       # Change directory so we don't need to mess with Windows paths in redirects.
       cd $VS_ENV_TMP_DIR
       $CMD /c extract-vs-env.bat | $CAT
-      cd $CURDIR
+      cd $CONFIGURE_START_DIR
 
       if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
         AC_MSG_NOTICE([Could not succesfully extract the environment variables needed for the VS setup.])