https://gcc.gnu.org/g:33ed38d4ee09b1fadb4da344aebbae27cf88e807
commit r17-6085-g33ed38d4ee09b1fadb4da344aebbae27cf88e807 Author: Pietro Monteiro <[email protected]> Date: Sun Nov 8 13:02:50 2026 -0500 libiberty: Simplify finding libiberty_topdir Libiberty configure script deduces the topdir based on the values of the options srcdir, with_build_subdir, and with_target_subdir. srcdir is always passed by the top-level Makefile suffixed with /libiberty, 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. libiberty/ChangeLog: * configure: Regenerate. * configure.ac: Set libiberty_topdir to "${srcdir}/.." and remove AC_CONFIG_AUX_DIR. Signed-off-by: Pietro Monteiro <[email protected]> Diff: --- libiberty/configure | 75 ++++++++++++++++++++------------------------------ libiberty/configure.ac | 18 +----------- 2 files changed, 31 insertions(+), 62 deletions(-) diff --git a/libiberty/configure b/libiberty/configure index 228cfd4740a1..16a9b04609ce 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -2503,51 +2503,7 @@ if test "${with_newlib+set}" = set; then : fi -if test "${srcdir}" = "."; then - if test -n "${with_build_subdir}"; then - libiberty_topdir="${srcdir}/../.." - with_target_subdir= - elif test -z "${with_target_subdir}"; then - libiberty_topdir="${srcdir}/.." - else - if test "${with_target_subdir}" != "."; then - libiberty_topdir="${srcdir}/${with_multisrctop}../.." - else - libiberty_topdir="${srcdir}/${with_multisrctop}.." - fi - fi -else - libiberty_topdir="${srcdir}/.." -fi - -ac_aux_dir= -for ac_dir in $libiberty_topdir "$srcdir"/$libiberty_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 $libiberty_topdir \"$srcdir\"/$libiberty_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. - +libiberty_topdir="${srcdir}/.." @@ -2690,6 +2646,35 @@ else 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/libiberty/configure.ac b/libiberty/configure.ac index 0963a8387edb..f9bba96d59a8 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -20,24 +20,8 @@ AC_ARG_WITH(cross-host, AC_ARG_WITH(newlib, [ --with-newlib Configuring with newlib]) -if test "${srcdir}" = "."; then - if test -n "${with_build_subdir}"; then - libiberty_topdir="${srcdir}/../.." - with_target_subdir= - elif test -z "${with_target_subdir}"; then - libiberty_topdir="${srcdir}/.." - else - if test "${with_target_subdir}" != "."; then - libiberty_topdir="${srcdir}/${with_multisrctop}../.." - else - libiberty_topdir="${srcdir}/${with_multisrctop}.." - fi - fi -else - libiberty_topdir="${srcdir}/.." -fi +libiberty_topdir="${srcdir}/.." AC_SUBST(libiberty_topdir) -AC_CONFIG_AUX_DIR($libiberty_topdir) dnl Very limited version of automake's enable-maintainer-mode
