https://gcc.gnu.org/g:6805dbaf58abb7566378f6bd1514efcb35441421

commit r17-6084-g6805dbaf58abb7566378f6bd1514efcb35441421
Author: Pietro Monteiro <[email protected]>
Date:   Wed Nov 4 20:06:01 2026 -0500

    libgcc: Simplify finding libgcc_topdir
    
    Libgcc configure script deduces the topdir based on the values of the
    options srcdir, with_build_subdir, and with_target_subdir.
    
    with_build_subdir is not an oprion used for libgc because it is only
    built for the target.
    
    And srcdir is always passed by the top-level Makefile suffixed with
    /libgcc, see Makefile.tpl starting on line 1211.
    
    So we can simplify the code by removing the parts that depend on
    srcdir being ".".
    
    We can also remove AC_CONFIG_AUX_DIR because autoconf will search
    srcdir/.. by default.
    
    libgcc/ChangeLog:
    
            * configure: Regenerate.
            * configure.ac: Set libgcc_topdir to "${srcdir}/.." and remove 
AC_CONFIG_AUX_DIR.
    
    Signed-off-by: Pietro Monteiro <[email protected]>

Diff:
---
 libgcc/configure    | 75 +++++++++++++++++++++--------------------------------
 libgcc/configure.ac | 18 +------------
 2 files changed, 31 insertions(+), 62 deletions(-)

diff --git a/libgcc/configure b/libgcc/configure
index a3f6a4a9650b..92490a94b038 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -2185,51 +2185,7 @@ if test "${with_ld+set}" = set; then :
 fi
 
 
-if test "${srcdir}" = "."; then
-  if test -n "${with_build_subdir}"; then
-    libgcc_topdir="${srcdir}/../.."
-    with_target_subdir=
-  elif test -z "${with_target_subdir}"; then
-    libgcc_topdir="${srcdir}/.."
-  else
-    if test "${with_target_subdir}" != "."; then
-      libgcc_topdir="${srcdir}/${with_multisrctop}../.."
-    else
-      libgcc_topdir="${srcdir}/${with_multisrctop}.."
-    fi
-  fi
-else
-  libgcc_topdir="${srcdir}/.."
-fi
-
-ac_aux_dir=
-for ac_dir in $libgcc_topdir "$srcdir"/$libgcc_topdir; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  as_fn_error $? "cannot find install-sh, install.sh, or shtool in 
$libgcc_topdir \"$srcdir\"/$libgcc_topdir" "$LINENO" 5
-fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
-
+libgcc_topdir="${srcdir}/.."
 
 ac_config_headers="$ac_config_headers auto-target.h:config.in"
 
@@ -2293,6 +2249,35 @@ fi
 
 
 
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" 
\"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
 # Make sure we can run config.sub.
 $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
   as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index 479cff4b2376..06dfcc7a6094 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -30,24 +30,8 @@ AC_ARG_WITH(cross-host,
 AC_ARG_WITH(ld,
 [  --with-ld               arrange to use the specified ld (full pathname)])
 
-if test "${srcdir}" = "."; then
-  if test -n "${with_build_subdir}"; then
-    libgcc_topdir="${srcdir}/../.."
-    with_target_subdir=
-  elif test -z "${with_target_subdir}"; then
-    libgcc_topdir="${srcdir}/.."
-  else
-    if test "${with_target_subdir}" != "."; then
-      libgcc_topdir="${srcdir}/${with_multisrctop}../.."
-    else
-      libgcc_topdir="${srcdir}/${with_multisrctop}.."
-    fi
-  fi
-else
-  libgcc_topdir="${srcdir}/.."
-fi
+libgcc_topdir="${srcdir}/.."
 AC_SUBST(libgcc_topdir)
-AC_CONFIG_AUX_DIR($libgcc_topdir)
 AC_CONFIG_HEADERS([auto-target.h:config.in])
 
 AC_ARG_ENABLE(shared,

Reply via email to