@@ -1,5 +1,6 @@
*.diff
*.patch
+!*patches/*.patch
*.orig
*.rej
new file mode 100755
@@ -0,0 +1,266 @@
+#!/usr/bin/env -S make -f
+# -*- mode: Makefile -*-
+# bootstrap - Bootstrap bundled and generated files that are included in source tarballs.
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+################################################################################
+#
+# For users: See `./bootstrap help`.
+#
+# For developers: This file is just the framework of the bootstrap
+# process, the real meat of the process is in the `bootstrap.d/*.mk`
+# files that this file includes.
+#
+################################################################################
+
+# GNU Make features we need:
+# - .NOTINTERMEDIATE (.FEATURES=notintermediate, new in v4.4)
+# - .WAIT (no .FEATURES entry, new in v4.4)
+# - $(let) (no .FEATURES entry, new in v4.4)
+# - &: grouping (.FEATURES=grouped-target, new in v4.3)
+ifeq ($(filter notintermediate,$(.FEATURES)),)
+$(error ./bootstrap needs GNU Make 4.4 or later)
+endif
+
+# Configure Make itself
+.DEFAULT_GOAL = all
+.NOTINTERMEDIATE:
+.DELETE_ON_ERROR:
+.SHELLFLAGS = -e -o pipefail -c
+
+# Wrap Make to force calling `_autotools/run` after all of the normal goals have run.
+ifeq ($(_ORIG_MAKECMDGOALS),)
+$(or $(MAKECMDGOALS),$(.DEFAULT_GOAL)) &:
+ @$(MAKE) --no-print-directory -f bootstrap _ORIG_MAKECMDGOALS='$(or $(MAKECMDGOALS),$(.DEFAULT_GOAL))' _recurse
+.PHONY: $(MAKECMDGOALS) all
+else
+_recurse: $(_ORIG_MAKECMDGOALS) .WAIT _atexit
+.PHONY: _recurse
+
+# Overview.
+help:
+ @echo Usage: ./bootstrap [MODE]
+ @echo Bootstrap bundled and generated files that are included in source tarballs
+ @echo
+ @echo MODEs:
+ @echo ' all Do everything (the default)'
+ @echo ' │ │'
+ @echo ' │ ================================( modes that act on `$$PWD.bootstrap` )================================'
+ @echo ' │ │'
+ @echo ' ├─ download ├─ Download (to `$$PWD.bootstrap/src`) anything that needs downloaded'
+ @echo ' ├─ extract ├─ Extract (to `$$PWD.bootstrap/src`) anything that needs extracted'
+ @echo ' ├─ autotools-install ├─ Install (to `$$PWD.bootstrap`) the appropriate versions of autotools'
+ @echo ' │ │'
+ @echo ' │ ======================================( modes that act on `.` )======================================='
+ @echo ' │ │'
+ @echo ' ├─ bundle-clean [1] ├─ Delete files bundled from external sources (except from autotools)'
+ @echo ' ├─ bundle [1] ├─ Add files bundled from external sources'
+ @echo ' │ │'
+ @echo ' ├─ autotools-clean [2] ├─ Delete files added/created by autotools'
+ @echo ' │ ├─ autotools-clean/add-missing [2] │ ├─ Delete files bundled from autotools'
+ @echo ' │ └─ autotools-clean/run [2] │ └─ Delete files generated by running autotools'
+ @echo ' └─ autotools └─ Add files files added/created by autotools'
+ @echo ' ├─ autotools/add-missing ├─ Add files bundled from autotools'
+ @echo ' └─ autotools/run [2] └─ Run autotools (mostly `autoreconf`)'
+ @echo
+ @echo ' clean Delete all bundled/created files (`bundle-clean` and `autotools-clean`)'
+ @echo
+ @echo ' help Show this message'
+ @echo
+ @echo '[1]: The `bundle-clean` and `bundle` tasks respectively have sub-tasks'
+ @echo '`bundle-clean/BUNDLE` and `bundle/BUNDLE` that can be run individually'
+ @echo 'for each of the following BUNDLEs:'
+ @printf '%s\n' $(sort $(bundles)) | column --output-width=78 | expand | sed 's/^/ /'
+ @echo
+ @echo '[2]: Similarly, the `autotools-clean`, `autotools-clean/add-missing`,'
+ @echo '`autotools-clean/run`, `autotools/add-missing`, and `autotools/run`'
+ @echo 'tasks have …/AUTODIR sub-tasks that can be run individually for each'
+ @echo 'of the following AUTODIRs:'
+ @printf '%s\n' $(autodirs.all) | sed 's/^top$$/& (`.`)/' | column --output-width=78 | expand | sed 's/^/ /'
+.PHONY: help
+
+# Base utilities.
+.PHONY: FORCE
+FORCE:
+bootstrapdir := $(CURDIR).bootstrap
+define hash
+#
+endef
+define newline
+
+
+endef
+
+# The bootstrap.d/*.mk files will append to these.
+bundles =
+downloads/http =
+downloads/git =
+#downloads/git/$(basename).flags =
+#downloads/git/$(basename).commits/$(worktree) =
+#downloads/git/$(worktree).extra-cmd =
+
+# macros for when $(download) = a item from $(downloads/http)
+download.http.url = $(lastword $(subst ::, ,$(download)))
+download.http.file = $(if $(findstring ::,$(download)),$(firstword $(subst ::, ,$(download))),$(notdir $(download)))
+download.http.dir = $(strip $(foreach z,xz bz2 gz,$(patsubst %.tar.$z,%,$(filter %.tar.$z,$(download.http.file)))))# empty for non-tarballs
+
+# macros for when $(download) = a item from $(downloads/git)
+download.git.url = $(download)
+download.git.gitname = $(notdir $(download.git.url))
+download.git.basename = $(patsubst %.git,%,$(download.git.gitname))
+
+# macros for when $(download) = a item from $(downloads/git) AND $(download.git.basename) is set
+download.git.flags = $(downloads/git/$(download.git.basename).flags)
+download.git.commits = $(foreach v,$(filter downloads/git/$(download.git.basename).commits/%,$(.VARIABLES)),$($v))
+download.git.worktrees = $(notdir $(filter downloads/git/$(download.git.basename).commits/%,$(.VARIABLES)))
+
+################################################################################
+
+# Load the real meat of the program.
+include $(sort $(wildcard bootstrap.d/*.mk))
+
+# Act on $(bootstrapdir)########################################################
+
+# download #############################
+
+download: $(foreach download,$(downloads/http),$(bootstrapdir)/src/$(download.http.file))
+download: $(foreach download,$(downloads/git),$(bootstrapdir)/src/$(download.git.gitname))
+.PHONY: download
+
+define _download/http
+$$(bootstrapdir)/src/$(download.http.file):
+ mkdir -p $$(@D)
+ wget --output-document=$$@ $(download.http.url)
+endef
+$(foreach download,$(downloads/http),$(eval $(_download/http)))
+
+# FORCE this because (unlike tarballs with a version number in the
+# name) changing the version probably doesn't change the filename.
+define _download/git
+$$(bootstrapdir)/src/$(download.git.gitname): FORCE
+ @if ! [ -d $$@ ]; then \
+ PS4=; set -x; \
+ git clone --bare $(download.git.flags) $(download.git.url) $$@; \
+ elif ! (true $(foreach c,$(download.git.commits),&& git -C $$@ rev-parse $c)) >/dev/null 2>&1; then \
+ PS4=; set -x; \
+ git -C $$@ fetch $(download.git.flags); \
+ else \
+ echo '# $$@ is already sufficiently up-to-date'; \
+ fi
+ git -C $$@ worktree prune
+endef
+$(foreach download,$(downloads/git),$(eval $(_download/git)))
+
+# extract ##############################
+
+extract: $(addprefix $(bootstrapdir)/src/,$(foreach download,$(downloads/http),$(download.http.dir)))
+extract: $(addprefix $(bootstrapdir)/src/,$(foreach download,$(downloads/git),$(download.git.worktrees)))
+.PHONY: extract
+
+$(bootstrapdir)/src/%: $(bootstrapdir)/src/%.tar.xz
+ cd $(bootstrapdir)/src && tar xaf $< && touch --no-create $@
+$(bootstrapdir)/src/%: $(bootstrapdir)/src/%.tar.bz2
+ cd $(bootstrapdir)/src && tar xaf $< && touch --no-create $@
+$(bootstrapdir)/src/%: $(bootstrapdir)/src/%.tar.gz
+ cd $(bootstrapdir)/src && tar xaf $< && touch --no-create $@
+
+# FORCE this because (unlike tarballs with a version number in the
+# name) changing the version probably doesn't change the filename.
+_extract/git/basename = $(patsubst %.git,%,$(notdir $<))
+_extract/git/worktree = $*
+_extract/git/commit = $(strip $(downloads/git/$(_extract/git/basename).commits/$(_extract/git/worktree)))
+define _extract/git
+$(addprefix $$(bootstrapdir)/src/,$(download.git.worktrees)): $$(bootstrapdir)/src/%: $$(bootstrapdir)/src/$(download.git.gitname) FORCE
+ git $$(if $$(wildcard $$@/.git),-C $$@ reset --hard,-C $$< worktree add --detach ../$$(@F)) $$(_extract/git/commit)
+ $$(downloads/git/$$*.extra-cmd)
+endef
+$(foreach download,$(downloads/git),$(eval $(_extract/git)))
+
+# Act on $(CURDIR) #############################################################
+
+# Various targets will append to this when the target runs.
+autotools-dirs =
+atexit/clean-dirs/add-missing =
+atexit/clean-dirs/run =
+atexit/extra-goals =
+
+# The */BUNDLE and */AUTODIR targets that do the actual work are
+# defined in bootstrap.d/*.mk.
+
+# bundle ###############################
+
+bundle-clean: $(addprefix bundle-clean/,$(bundles))
+.PHONY: bundle-clean $(addprefix bundle-clean/,$(bundles))
+
+bundle: bundle-clean .WAIT $(addprefix bundle/,$(bundles))
+.PHONY: bundle $(addprefix bundle/,$(bundles))
+
+# autotools-clean ######################
+#
+# These don't do any real work, they just adjust the $(atexit/*)
+# variables for `_atexit`.
+
+autotools-clean: autotools-clean/add-missing autotools-clean/run
+.PHONY: autotools-clean/add-missing autotools-clean/run
+
+autotools-clean/add-missing:
+ $(eval atexit/clean-dirs/add-missing += all)
+autotools-clean/add-missing/%:
+ $(eval atexit/clean-dirs/add-missing += $(call _autotools/dep2dir,$*))
+.PHONY: autotools-clean/add-missing autotools-clean/add-missing/%
+
+autotools-clean/run:
+ $(eval autotools-clean-dirs += all)
+autotools-clean/run/%:
+ $(eval autotools-clean-dirs += $(call _autotools/dep2dir,$*))
+.PHONY: autotools-clean/run autotools-clean/run/%
+
+# autotools ############################
+
+autotools: autotools/run
+.PHONY: autotools/add-missing autotools/run
+
+autotools/add-missing:
+ $(eval atexit/clean-dirs/add-missing += all)
+ $(eval atexit/extra-goals += _atexit/autotools/add-missing)
+PHONY: autotools/add-missing
+
+autotools/run:
+ $(eval autotools-dirs += all)
+autotools/run/%:
+ $(eval autotools-dirs += $(call _autotools/dep2dir,$*))
+.PHONY: autotools/run autotools/run/%
+
+# both #################################
+
+all: bundle autotools
+.PHONY: all
+
+clean: bundle-clean .WAIT autotools-clean
+.PHONY: clean
+
+# _atexit ##############################
+
+# Use a sub-Make to defer evaluating the $(autotools-dirs) and
+# $(atexit/*) variables.
+_atexit: _atexit/autotools-clean/add-missing _atexit/autotools-clean/run
+ @$(let goals,$(atexit/extra-goals) $(addprefix _atexit/autotools/run/,$(autodirs.selected)),\
+ $(if $(strip $(goals)),\
+ $(MAKE) --no-print-directory -f bootstrap $(goals)))
+
+endif
new file mode 100644
@@ -0,0 +1,47 @@
+# autotools0-install.mk - Install the appropriate versions of autotools.
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+_install/downloads = https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz # 2012-04-24
+_install/downloads += https://ftp.gnu.org/gnu/automake/automake-1.15.1.tar.xz # 2017-06-19
+_install/downloads += https://git.savannah.gnu.org/cgit/libtool.git/snapshot/libtool-b15f6f9ded3e9e1edb7b74e5bd823cd511673e48.tar.gz # 2009-11-29, between v2.2.6 and v2.2.7b
+_install/downloads += https://ftp.gnu.org/gnu/gettext/gettext-0.16.1.tar.gz # 2006-11-27
+downloads/http += $(_install/downloads)
+
+PATH := $(bootstrapdir)/bin:$(PATH)
+
+autotools-install: $(foreach download,$(_install/downloads),$(bootstrapdir)/src/$(download.http.dir)/.install)
+.PHONY: autotools-install
+
+$(bootstrapdir)/src/%/.install: | $(bootstrapdir)/src/%
+ cd $(@D) && if ! [ -f configure ]; then sh -e ./bootstrap; fi
+ cd $(@D) && ./configure --prefix=$(bootstrapdir)
+ cd $(@D) && make
+ cd $(@D) && make install
+ date >$@
+
+# Patches for libtool ##########################################################
+
+$(bootstrapdir)/src/libtool-%: $(bootstrapdir)/src/libtool-%.tar.gz
+ cd $(bootstrapdir)/src && tar xaf $< && touch --no-create $@
+# Adjust the build system to work with this version of automake.
+ sed -i 's/lzma/xz/' -- $@/configure.ac
+# Apply patches.
+ @cd $@; for patch in $(abspath bootstrap.d/libtool-patches)/*.patch; do echo patch -p1 -i $$patch; patch -p1 -i $$patch; done
+
+# Without this variable, the build hangs.
+$(bootstrapdir)/src/libtool-2c9c38d8a12eb0a2ce7fe9c3862523026c3d5622/.install: private export as_echo = printf %s\n
new file mode 100644
@@ -0,0 +1,162 @@
+# autotools1-addmissing.mk - Implement autotools "--add-missing"-equivalent behavior.
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# Please keep this list sorted by date.
+downloads/http += https://ftp.gnu.org/gnu/automake/automake-1.7.2.tar.bz2 # 2002-12-05
+downloads/http += https://ftp.gnu.org/gnu/gettext/gettext-0.12.1.tar.gz # 2003-05-27
+downloads/http += https://git.savannah.gnu.org/cgit/texinfo.git/snapshot/texinfo-e20f39e569775c79f270d249d9a2c47f4cd6d9c2.tar.gz # 2009-03-29, between v4.7 and v5.0
+downloads/http += https://git.savannah.gnu.org/cgit/automake.git/snapshot/automake-9042530473b52251a4022cc0a0e02636b9a53211.tar.gz # 2014-04-21, based on v1.14.1, but not merged until v1.16 (skipping v1.15)
+# from autotools0-install.mk automake-1.15.1.tar.xz # 2017-06-19
+downloads/git/gnulib.commits/gnulib-readline = 281b825eba78dc403b9bf34979923bc587bc31af # 2018-01-01
+downloads/http += https://git.savannah.gnu.org/cgit/texinfo.git/snapshot/texinfo-dbf3d9ca0ee61da4443d305479dfec35f4456d45.tar.gz # 2021-02-20, based on v6.6, but not merged until v6.8 (skipping v6.7)
+downloads/http += https://git.savannah.gnu.org/cgit/config.git/snapshot/config-7779518ae25d075f5f6ba0a10792fa9b9428f748.tar.gz # 2021-04-30
+downloads/http += https://git.savannah.gnu.org/cgit/config.git/snapshot/config-28ea239c53a2d5d8800c472bc2452eaa16e37af2.tar.gz # 2023-09-12
+
+# clean ########################################################################
+
+_autotools-clean/add-missing = find $(strip $1) -type f \( -false
+
+# These first few come from `automake --add-missing`, and you can
+# verify that the list is complete by comparint it to the list of
+# plain files in the `$(automake --print-libdir)` directory. (Some of
+# these files are also found in `$(prefix)/share/libtool/build-aux/`)
+_autotools-clean/add-missing += -o -name ar-lib
+_autotools-clean/add-missing += -o -name compile
+_autotools-clean/add-missing += -o -name config.guess
+_autotools-clean/add-missing += -o -name config.sub
+_autotools-clean/add-missing += -o -name depcomp
+_autotools-clean/add-missing += -o -name install-sh
+_autotools-clean/add-missing += -o -name mdate-sh
+_autotools-clean/add-missing += -o -name missing
+_autotools-clean/add-missing += -o -name mkinstalldirs
+_autotools-clean/add-missing += -o -name test-driver
+_autotools-clean/add-missing += -o -name texinfo.tex
+_autotools-clean/add-missing += -o -name ylwrap
+
+# These are the libtool m4 files, which are normally found in the
+# `$(aclocal --print-ac-dir)` directory.
+_autotools-clean/add-missing += -o -name libtool.m4
+_autotools-clean/add-missing += -o -name ltoptions.m4
+_autotools-clean/add-missing += -o -name ltsugar.m4
+_autotools-clean/add-missing += -o -name ltversion.m4
+_autotools-clean/add-missing += -o -name lt~obsolete.m4
+
+# ltmain.sh, which is normally found in
+# the `$(prefix)/share/libtool/build-aux/` directory.
+_autotools-clean/add-missing += -o -name ltmain.sh
+
+# Finally, config.rpath... see the comments below about where
+# config.rpath comes from.
+_autotools-clean/add-missing += -o -name config.rpath
+
+_autotools-clean/add-missing += \) -delete
+
+# Clean added files from the directories listed in $(autotools-dirs)
+# and $(atexit/clean-dirs/add-missing).
+#
+# The special value 'all'...
+# - ... in $(autotools-dirs) is a synonym for $(autotools-dirs.all).
+# - ... in $(atexit/clean-dirs/add-missing) has it look for files to
+# clean even in directories that aren't listed in
+# $(autotools-dirs.all).
+_atexit/autotools-clean/add-missing:
+ $(let dirs,$(autotools-dirs.selected) $(atexit/clean-dirs/add-missing),\
+ $(if $(strip $(dirs)),\
+ $(call _autotools-clean/add-missing,\
+ $(if $(filter all,$(dirs)),.,$(sort $(dirs)) -maxdepth 1))))
+.PHONY: _atexit/autotools-clean/add-missing
+
+# add-missing ##################################################################
+
+# Normally this is done by `automake --add-missing` or similar, but:
+#
+# 1) Our top-level directory doesn't actually use automake.
+#
+# 2) We may want different versions than what autotools0-install.mk
+# installs.
+_atexit/autotools/add-missing: $(bootstrapdir)/src/automake-1.7.2
+_atexit/autotools/add-missing: $(bootstrapdir)/src/automake-1.15.1
+_atexit/autotools/add-missing: $(bootstrapdir)/src/automake-9042530473b52251a4022cc0a0e02636b9a53211
+_atexit/autotools/add-missing: $(bootstrapdir)/src/config-28ea239c53a2d5d8800c472bc2452eaa16e37af2
+_atexit/autotools/add-missing: $(bootstrapdir)/src/config-7779518ae25d075f5f6ba0a10792fa9b9428f748
+_atexit/autotools/add-missing: $(bootstrapdir)/src/gettext-0.12.1
+_atexit/autotools/add-missing: $(bootstrapdir)/src/gnulib-readline
+_atexit/autotools/add-missing: $(bootstrapdir)/src/texinfo-dbf3d9ca0ee61da4443d305479dfec35f4456d45
+_atexit/autotools/add-missing: $(bootstrapdir)/src/texinfo-e20f39e569775c79f270d249d9a2c47f4cd6d9c2
+_atexit/autotools/add-missing: autotools-install
+# automake --add-missing (normally from the `$(automake --print-libdir)` directory,
+# though some are also normally in the `$(prefix)/share/libtool/build-aux/` directory.)
+ cp -vn $(bootstrapdir)/src/config-28ea239c53a2d5d8800c472bc2452eaa16e37af2/config.guess .
+ cp -vn $(bootstrapdir)/src/config-28ea239c53a2d5d8800c472bc2452eaa16e37af2/config.sub .
+ cp -vn $(bootstrapdir)/src/automake-9042530473b52251a4022cc0a0e02636b9a53211/lib/compile .
+ cp -vn $(bootstrapdir)/src/automake-9042530473b52251a4022cc0a0e02636b9a53211/lib/depcomp .
+ cp -vn $(bootstrapdir)/src/automake-9042530473b52251a4022cc0a0e02636b9a53211/lib/install-sh .
+ cp -vn $(bootstrapdir)/src/automake-9042530473b52251a4022cc0a0e02636b9a53211/lib/missing .
+ cp -vn $(bootstrapdir)/src/automake-9042530473b52251a4022cc0a0e02636b9a53211/lib/mkinstalldirs .
+ cp -vn $(bootstrapdir)/src/automake-9042530473b52251a4022cc0a0e02636b9a53211/lib/ylwrap .
+ cp -vn $(bootstrapdir)/src/automake-1.15.1/lib/ar-lib .
+ cp -vn $(bootstrapdir)/src/automake-1.15.1/lib/test-driver .
+ cp -vn $(bootstrapdir)/src/texinfo-e20f39e569775c79f270d249d9a2c47f4cd6d9c2/texinfo/doc/texinfo.tex texinfo/
+ if ! [ -e gprofng/doc/mdate-sh ]; then \
+ sed 's/1995-2017/1995-2024/' <$(bootstrapdir)/src/automake-1.15.1/lib/mdate-sh >gprofng/doc/mdate-sh; \
+ chmod 755 gprofng/doc/mdate-sh; \
+ fi
+ if ! [ -e gprofng/doc/texinfo.tex ]; then sed 's/\s*$$//' <$(bootstrapdir)/src/texinfo-dbf3d9ca0ee61da4443d305479dfec35f4456d45/doc/texinfo.tex >gprofng/doc/texinfo.tex; fi
+ cp -vn $(bootstrapdir)/src/automake-1.7.2/lib/mkinstalldirs readline/readline/support/
+ cp -vn $(bootstrapdir)/src/config-7779518ae25d075f5f6ba0a10792fa9b9428f748/config.guess readline/readline/support/
+ cp -vn $(bootstrapdir)/src/config-7779518ae25d075f5f6ba0a10792fa9b9428f748/config.sub readline/readline/support/
+# libtoolize or aclocal ???
+#
+# Have the default paths in ltmain.sh match the paths on Ralf's box
+# when he generated ltmain.sh back in 2009, rather than the paths on
+# the box running ./bootstrap. These don't matter too much because
+# the build system should set them before calling ltmain.sh.
+ cp -vn "$$(aclocal --print-ac-dir)"/{libtool,ltoptions,ltsugar,ltversion,lt~obsolete}.m4 .
+ if ! [ -e ltmain.sh ]; then \
+ sed \
+ -e 's:$${EGREP=".*"}:$${EGREP="/bin/grep -E"}:' \
+ -e 's:$${FGREP=".*"}:$${FGREP="/bin/grep -F"}:' \
+ -e 's:$${GREP=".*"}:$${GREP="/bin/grep"}:' \
+ -e 's:$${SED=".*"}:$${SED="/mount/endor/wildenhu/local-x86_64/bin/sed"}:' \
+ <$(bootstrapdir)/share/libtool/config/ltmain.sh >ltmain.sh; \
+ fi
+# autopoint or gnulib-tool
+#
+# There are two "normal" ways to get config.rpath:
+#
+# 1. gettext-tools' `autopoint` or `gettextize` installs it from the
+# `$(prefix)/share/gettext` directory.
+#
+# 2. `gnulib-tool --import (gettext|havelib|threads-h)`
+#
+# These days gettext itself gets config.rpath from `gnulib-tool
+# --import havelib`; that is: the file is "owned" by gnulib. But from
+# 2001 to about 2007 it was the other way around; it was owned by
+# gettext and gnulib was the downstream.
+ if ! [ -e config.rpath ]; then \
+ sed \
+ -e 's/59 Temple Place - Suite 330, Boston, MA 02111-1307/51 Franklin Street, Fifth Floor, Boston, MA 02110-1301/' \
+ -e 's/aix3\* | aix4\* | aix5\*/aix[3-9]*/' \
+ -e 's/aix4\* | aix5\*/aix[4-9]*/' \
+ -e 's/aix5\*/aix[5-9]*/' \
+ -e '/freebsd1\*)/,/;;/d' \
+ <$(bootstrapdir)/src/gettext-0.12.1/config/config.rpath >config.rpath; \
+ chmod 755 config.rpath; \
+ fi
+ cp -vn $(bootstrapdir)/src/gnulib-readline/build-aux/config.rpath readline/readline/support/
+.PHONY: _atexit/autotools/add-missing
new file mode 100644
@@ -0,0 +1,90 @@
+# autotools2-run.mk - Run autoreconf or similar.
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+autotools-dirs.all = $(shell find . \( -name configure.in -o -name configure.ac \) -printf '%h\n')
+autotools-dirs.selected = $(if $(filter all,$(autotools-dirs)),$(autotools-dirs.all),$(autotools-dirs))
+
+_autotools/dir2dep = $(patsubst ./%,%,$(patsubst .,top,$1))
+_autotools/dep2dir = $(patsubst ./top,.,$(addprefix ./,$1))
+
+autodirs.all = $(call _autotools/dir2dep,$(sort $(autotools-dirs.all)))
+autodirs.selected = $(call _autotools/dir2dep,$(sort $(autotools-dirs.selected)))
+
+# clean ########################################################################
+
+_autotools-clean/run =
+
+_autotools-clean/run += find $(strip $1) \( -false
+_autotools-clean/run += -o -name aclocal.m4 # from `aclocal`
+_autotools-clean/run += -o -name configure # from `autoconf`
+_autotools-clean/run += -o -name config.in # from `autoheader`
+_autotools-clean/run += \)
+_autotools-clean/run += -not -path ./gdb/testsuite/aclocal.m4 # actually hand-written
+_autotools-clean/run += -not -path ./readline/readline/aclocal.m4 # actually hand-written
+_autotools-clean/run += -delete$(newline)
+
+# automake and autogen
+#
+# `./zlib/contrib/minizip/Makefile` is actually hand-written, despite
+# the presence of `./zlib/contrib/minizip/Makefile.am`
+_autotools-clean/run += find $(strip $1) \
+ \( -name Makefile.am -o -name Makefile.tpl \) \
+ -not -path ./zlib/contrib/minizip/Makefile.am \
+ -print0 \
+ | sed -zE 's/(.*)\.(am|tpl)$$/\1\x0\1.in/' \
+ | xargs -r0 rm -f --$(newline)
+
+# ./configure
+_autotools-clean/run += find $(strip $1) -name Makefile.in -print0 \
+ | sed -zE 's/\.in$$//' \
+ | xargs -r0 rm -f --$(newline)
+
+# garbage created by autoconf
+_autotools-clean/run += find $(strip $1) -name autom4te.cache -exec rm -rf -- {} +$(newline)
+
+# Clean the directories listed in $(autotools-dirs) and
+# $(atexit/clean-dirs/run).
+#
+# The special value 'all' has it look for files to clean even in
+# directories that aren't listed in $(autotools-dirs.all).
+_atexit/autotools-clean/run:
+ $(let dirs,$(autotools-dirs) $(atexit/clean-dirs/run),\
+ $(if $(strip $(dirs)),\
+ $(call _autotools-clean/run,\
+ $(if $(filter all,$(dirs)),.,$(sort $(dirs)) -maxdepth 1))))
+.PHONY: _atexit/autotools-clean/run
+
+# run ##########################################################################
+
+_atexit/autotools/run/%: _atexit/autotools/add-missing autotools-install
+ cd $(patsubst top,.,$*) && $(or $(autotools-cmd/$*),autoreconf)
+.PHONY: _atexit/autotools/run/%
+
+# Overrides.
+
+autotools-cmd/top = autogen Makefile.def && autoreconf
+
+# Why does autoreconf error out with an error from autoheader for the
+# readline directories?
+autotools-cmd/readline = aclocal && autoconf && automake
+autotools-cmd/readline/readline = autoconf
+autotools-cmd/readline/readline/examples/rlfe = autoconf
+
+# Disable; we don't check-in autotools outputs in the minizip
+# directory.
+autotools-cmd/zlib/contrib/minizip = true
new file mode 100644
@@ -0,0 +1,47 @@
+# Generated by bundle-gcc.mk. DO NOT EDIT.
+COPYING
+COPYING3
+ChangeLog-9103
+ansidecl.h
+collectorAPI.h
+ctf.h
+demangle.h
+dwarf2.def
+dwarf2.h
+dyn-string.h
+environ.h
+fibheap.h
+filenames.h
+floatformat.h
+fnmatch.h
+gcc-c-fe.def
+gcc-c-interface.h
+gcc-cp-fe.def
+gcc-cp-interface.h
+gcc-interface.h
+gdb/gdb-index.h
+getopt.h
+hashtab.h
+leb128.h
+libcollector.h
+libfcollector.h
+libiberty.h
+longlong.h
+lto-symtab.h
+md5.h
+objalloc.h
+obstack.h
+partition.h
+plugin-api.h
+safe-ctype.h
+sha1.h
+simple-object.h
+sort.h
+splay-tree.h
+symcat.h
+timeval-utils.h
+vtv-change-permission.h
+xregex.h
+xregex2.h
+xtensa-config.h
+xtensa-dynconfig.h
new file mode 100644
@@ -0,0 +1,118 @@
+# bundle-gcc.mk - Bundle files from GCC.
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+bundles += gcc-misc
+bundles += gcc-include
+bundles += gcc-config
+bundles += gcc-libbacktrace
+bundles += gcc-libdecnumber
+bundles += gcc-libiberty
+
+downloads/git += git://gcc.gnu.org/git/gcc.git
+downloads/git/gcc.flags = --shallow-since=2018-02-01
+downloads/git/gcc.commits/gcc-include = bc0e18a960f9dff3e740f4d0cb5b25b3f68d920a # 2024-02-29
+_bundle-gcc/include/revert = 9f7afa99c67f039e43019ebd08d14a7f01e2d89c # 2024-01-09
+downloads/git/gcc.commits/gcc-config = 68cb873fd360dbb64f2a6dfb28e79399ff99d07d # 2023-09-14
+downloads/git/gcc.commits/gcc-libbacktrace = c775a030af9cad20088bae4e7cb3e4bfb9c380cc # 2024-03-09
+_bundle-gcc/libbacktrace/revert = 6a6d3817afa02bbcd2388c8e005da6faf88932f1 # 2023-10-22
+downloads/git/gcc.commits/gcc-libdecnumber = a197d3406c4c2c472b8f38fb5de2bdc4e3db9476 # 2018-02-19
+downloads/git/gcc.commits/gcc-libiberty = 65388b28656d65595bdaf191df85af81c35ca638 # 2024-01-13
+
+downloads/git/gcc-include.extra-cmd = cd $@ && git revert --no-commit $(_bundle-gcc/include/revert)
+downloads/git/gcc-libbacktrace.extra-cmd = cd $@ && git show -n1 $(_bundle-gcc/libbacktrace/revert) -- libbacktrace | patch -p1 -R
+
+bundle-clean/gcc-misc:
+ rm -f config-ml.in multi.m4 symlink-tree
+bundle-clean/gcc-include:
+ cd include && grep -v '^#' ../bootstrap.d/bundle-gcc-include.txt | xargs -d '\n' -r rm -f --
+bundle-clean/gcc-config:
+ find config \
+ -mindepth 1 \
+ -not -name bfd64.m4 \
+ -not -name debuginfod.m4 \
+ -not -name dejagnu.m4 \
+ -not -name jobserver.m4 \
+ -not -path '*/patches' \
+ -not -path '*/patches/*' \
+ -delete
+$(addprefix bundle-clean/gcc-,libbacktrace libdecnumber libiberty): bundle-clean/gcc-%:
+ find $* \
+ -mindepth 1 \
+ -not -path '*/patches' \
+ -not -path '*/patches/*' \
+ -delete
+
+bundle/gcc-misc: bundle-clean/gcc-misc $(bootstrapdir)/src/gcc-libiberty
+ cp -v $(bootstrapdir)/src/gcc-libiberty/config-ml.in .
+ cp -v $(bootstrapdir)/src/gcc-libiberty/multilib.am .
+ cp -v $(bootstrapdir)/src/gcc-libiberty/symlink-tree .
+
+bundle/gcc-include: bundle-clean/gcc-include $(bootstrapdir)/src/gcc-include
+ { \
+ echo '# Generated by bundle-gcc.mk. DO NOT EDIT.'; \
+ find $(bootstrapdir)/src/gcc-include/include -type f -printf '%P\n' \
+ | grep -v \
+ -e '^ChangeLog$$' \
+ -e '^ChangeLog\.jit$$' \
+ -e '^btf\.h$$' \
+ -e '^cuda/' \
+ -e '^gomp-constants\.h$$' \
+ -e '^hsa[._]' \
+ -e '^spincount\.h$$' \
+ | LC_COLLATE=C sort; \
+ } >bootstrap.d/bundle-gcc-include.txt.tmp
+ mv bootstrap.d/bundle-gcc-include.txt.tmp bootstrap.d/bundle-gcc-include.txt
+ grep -v '^#' bootstrap.d/bundle-gcc-include.txt | while read -r file; do mkdir -p $$(dirname -- include/$$file); cp -v $(bootstrapdir)/src/gcc-include/include/$$file include/$$file; done
+ sed -i \
+ -e '/^Local/iCopyright (C) 1993-2003 Free Software Foundation, Inc.' \
+ -e '/^Local/i\\' \
+ -e '/^Local/iCopying and distribution of this file, with or without modification,' \
+ -e '/^Local/iare permitted in any medium without royalty provided the copyright' \
+ -e '/^Local/inotice and this notice are preserved.' \
+ -e '/^Local/i\\' \
+ include/ChangeLog-9103
+
+# 68cb873fd360dbb64f2a6dfb28e79399ff99d07d (2023-09-14,
+# $(downloads/git/gcc.commits/gcc-config)) is new enough that it
+# contains a few files that aren't in our copy of `config/`:
+# - ax_lib_socket_nsl.m4 was added in a20893cf6b95f60f5319b2196621acc65180125c (2021-01-05) and is still there
+# - bootstrap-hwsan.mk was added in 170e618ef559a9b1220174c1d33cd7e5b1045cc8 (2020-11-25) and is still there
+#
+# We already apply 4 patches in config/patches/, and rolling
+# $(downloads/git/gcc.commits/gcc-config) back to 2021 or 2020 would
+# mean taking on 10's of more patches. So just delete the 2 files.
+bundle/gcc-config: bundle-clean/gcc-config $(bootstrapdir)/src/gcc-config
+ cp -aT $(bootstrapdir)/src/gcc-config/config/ config/
+ @cd config; for patch in patches/*.patch; do echo patch -p2 -i $$patch; patch -p2 -i $$patch; done
+ rm -f config/ax_lib_socket_nsl.m4 config/bootstrap-hwasan.mk
+ $(eval autotools-dirs += all)
+
+bundle/gcc-libbacktrace: bundle-clean/gcc-libbacktrace $(bootstrapdir)/src/gcc-libbacktrace
+ cp -aT $(bootstrapdir)/src/gcc-libbacktrace/libbacktrace/ libbacktrace/
+ $(eval autotools-dirs += ./libbacktrace)
+
+bundle/gcc-libdecnumber: bundle-clean/gcc-libdecnumber $(bootstrapdir)/src/gcc-libdecnumber
+ cp -aT $(bootstrapdir)/src/gcc-libdecnumber/libdecnumber/ libdecnumber/
+ sed -i -e '/\f/,$$d' -e 's/\s*$$//' -e 's/^ /\t/' libdecnumber/ChangeLog
+ @cd libdecnumber; for patch in patches/*.patch; do echo patch -p2 -i $$patch; patch -p2 -i $$patch; done
+ $(eval autotools-dirs += ./libdecnumber)
+
+bundle/gcc-libiberty: bundle-clean/gcc-libiberty $(bootstrapdir)/src/gcc-libiberty
+ cp -aT $(bootstrapdir)/src/gcc-libiberty/libiberty/ libiberty/
+ @cd libiberty; for patch in patches/*.patch; do echo patch -p2 -i $$patch; patch -p2 -i $$patch; done
+ $(eval autotools-dirs += ./libiberty)
new file mode 100644
@@ -0,0 +1,45 @@
+# bundle-gnulib.mk - Bundle files from gnulib.
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+bundles += gnulib
+
+downloads/git += https://git.savannah.gnu.org/git/gnulib.git
+downloads/git/gnulib.commits/gnulib = bd11400942d63de12371988dca8144925de9e2c3 # 2022-05-01
+downloads/git/gnulib.commits/gnulib-move-if-change = 1276a2c5f24c0c932426aca9c899fa524d2443f2 # 2014-01-01
+
+bundle-clean/gnulib:
+ find gnulib \
+ -mindepth 1 \
+ -not -path gnulib/README \
+ -not -path gnulib/ChangeLog \
+ -not -path gnulib/update-gnulib.sh \
+ -not -path gnulib/configure.ac \
+ -not -path gnulib/Makefile.am \
+ -not -path gnulib/Makefile.gnulib.inc.in \
+ -not -path gnulib/import \
+ -not -path gnulib/patches \
+ -not -path gnulib/patches/'*' \
+ -delete
+ rm -f move-if-change
+
+bundle/gnulib: bundle-clean/gnulib
+bundle/gnulib: $(bootstrapdir)/src/gnulib-move-if-change
+bundle/gnulib: $(bootstrapdir)/src/gnulib
+ cp -v $(bootstrapdir)/src/gnulib-move-if-change/build-aux/move-if-change .
+ cd gnulib && NO_AUTOTOOLS=y sh -e ./update-gnulib.sh $(bootstrapdir)/src/gnulib
+ $(eval autotools-dirs += ./gnulib)
new file mode 100644
@@ -0,0 +1,47 @@
+# bundle-licenses.mk - Bundle standard license files published by the FSF.
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+bundles += licenses
+
+downloads/http += https://www.gnu.org/licenses/gpl-2.0.txt
+downloads/http += https://www.gnu.org/licenses/gpl-3.0.txt
+downloads/http += https://www.gnu.org/licenses/lgpl-2.0.txt
+downloads/http += https://www.gnu.org/licenses/lgpl-3.0.txt
+
+_licenses/files = COPYING
+_licenses/files += COPYING3
+_licenses/files += COPYING.LIB
+_licenses/files += COPYING3.LIB
+_licenses/files += bfd/COPYING
+_licenses/files += gas/COPYING
+_licenses/files += gdb/COPYING
+_licenses/files += sim/COPYING
+
+bundle-clean/licenses:
+ rm -f $(_licenses/files)
+
+bundle/licenses: bundle-clean/licenses .WAIT $(_licenses/files)
+
+COPYING: $(bootstrapdir)/src/gpl-2.0.txt
+ cp -v $< $@
+COPYING3 $(addsuffix /COPYING,bfd gas gdb sim): $(bootstrapdir)/src/gpl-3.0.txt
+ cp -v $< $@
+COPYING.LIB: $(bootstrapdir)/src/lgpl-2.0.txt
+ cp -v $< $@
+COPYING3.LIB: $(bootstrapdir)/src/lgpl-3.0.txt
+ cp -v $< $@
new file mode 100644
@@ -0,0 +1,44 @@
+# bundle-readline.mk - Bundle GNU readline.
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+bundles += readline
+
+# Use a Git snapshot rather than a release tarball so that we get
+# .gitignore and such.
+downloads/http += https://git.savannah.gnu.org/cgit/readline.git/snapshot/readline-readline-8.1.tar.gz # 2021-01-18
+
+bundle-clean/readline:
+ find readline/readline \
+ -type f \
+ -not -name ChangeLog.gdb \
+ -not -name cygwin.cache \
+ -delete
+ find readline/readline -depth -type d -empty -delete
+
+bundle/readline: bundle-clean/readline
+bundle/readline: $(bootstrapdir)/src/readline-readline-8.1
+ cp -aT $(bootstrapdir)/src/readline-readline-8.1 readline/readline
+ rm -rf readline/readline/.git
+ rm -f readline/readline/doc/*.{dvi,html,pdf,ps,0,info,tex}
+ rm -f readline/readline/._*
+ rm -f readline/readline/examples/*.tar.gz
+ @cd readline/readline; for patch in ../patches/*.patch; do echo patch -p1 -i $$patch; patch -p1 -i $$patch; done
+ chmod 755 readline/readline/support/shobj-conf
+ $(eval autotools-dirs += ./readline/readline/examples/rlfe)
+ $(eval autotools-dirs += ./readline/readline)
+ $(eval atexit/clean-dirs/add-missing += ./readline/readline/support)
new file mode 100644
@@ -0,0 +1,45 @@
+# bundle-zlib.mk - Bundle zlib.
+#
+# Copyright (C) 2024 Free Software Foundation, Inc.
+#
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+bundles += zlib
+
+downloads/http += https://zlib.net/fossils/zlib-1.2.10.tar.gz # 2017-01-02
+downloads/http += https://zlib.net/fossils/zlib-1.2.12.tar.gz # 2022-03-27
+
+bundle-clean/zlib:
+ find zlib \
+ -mindepth 1 \
+ -type f \
+ -not -name ChangeLog.bin-gdb \
+ -not -name ChangeLog.gcj \
+ -not -name ChangeLog.jit \
+ -not -name Makefile.am \
+ -not -name configure.ac \
+ -not -name acinclude.m4 \
+ -not -path '*/patches' \
+ -not -path '*/patches/*' \
+ -delete
+ find readline/readline -depth -type d -empty -delete
+
+bundle/zlib: bundle-clean/zlib
+bundle/zlib: $(bootstrapdir)/src/zlib-1.2.10
+bundle/zlib: $(bootstrapdir)/src/zlib-1.2.12
+ cp -aT $(bootstrapdir)/src/zlib-1.2.10 zlib
+ cp -aT $(bootstrapdir)/src/zlib-1.2.12 zlib
+ chmod 644 zlib/zlib2ansi
+ $(eval autotools-dirs += ./zlib)
new file mode 100644
@@ -0,0 +1,703 @@
+From c08d2c52d64baebb0c49290acb4a96d37e2788bf Mon Sep 17 00:00:00 2001
+From: "Luke T. Shumaker" <lukeshu@lukeshu.com>
+Date: Thu, 6 Jun 2024 10:04:05 -0600
+Subject: [PATCH] ltmain.m4sh: Add Ralf's unpublished changes
+
+In 2009, Ralf accidentally checked in to gcc.git his local hacked-up
+copy of ltmain.sh, rather than the copy that he actually checked in
+libtool.git. That ended up getting synced into binutils-gdb.git.
+
+The full relevant log for binutils-gdb.git's ltmain.sh is:
+
+ binutils-gdb.git af5478e1f3c (Do not use HAVE_DOS_BASED_FILE_SYSTEM for Cygwin., Martin Liska, 2023-08-07)
+ binutils-gdb.git 14af24e0a83 (libtool.m4: Sort output of 'find' to enable deterministic builds., Bernhard M. Wiedemann, 2023-08-07)
+ binutils-gdb.git 62a0f723352 (PR target/59788 : Enable on *solaris2*., Rainer Orth, 2014-02-06)
+ binutils-gdb.git 115ef890e50 (Backport from Libtool: Fix relink mode to use absolute path if hardcode_minus_L., Ralf Wildenhues, 2011-01-13)
+ binutils-gdb.git 3725885a656 (Sync Libtool from GCC., Ralf Wildenhues, 2010-01-09)
+ gcc.git 43e02a8a712e (Sync from git Libtool and regenerate., Ralf Wildenhues, 2009-12-05)
+---
+ ChangeLog | 4 +
+ libltdl/config/ltmain.m4sh | 184 +++++++++++++++++++------------------
+ 2 files changed, 100 insertions(+), 88 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 3ba536cb..7e082fb3 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,7 @@
++2009-11-29 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
++
++ Unpublished changes.
++
+ 2009-11-29 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+
+ Fix bindir and dlopen tests for C++ compilers (CC=g++).
+diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
+index 91d08004..7796dbf1 100644
+--- a/libltdl/config/ltmain.m4sh
++++ b/libltdl/config/ltmain.m4sh
+@@ -39,6 +39,7 @@ m4_divert_push([SCRIPT])# @configure_input@
+ # -n, --dry-run display commands without modifying any files
+ # --features display basic configuration information and exit
+ # --mode=MODE use operation mode MODE
++# --no-finish let install mode avoid finish commands
+ # --preserve-dup-deps don't remove duplicate dependency libraries
+ # --quiet, --silent don't print informational messages
+ # --no-quiet, --no-silent
+@@ -146,6 +147,7 @@ extracted_archives=
+ extracted_serial=0
+
+ opt_dry_run=false
++opt_finish=:
+ opt_duplicate_deps=false
+ opt_silent=false
+ opt_debug=:
+@@ -295,6 +297,7 @@ func_enable_tag ()
+ --dry-run | -n) opt_dry_run=: ;;
+ --features) func_features ;;
+ --finish) mode="finish" ;;
++ --no-finish) opt_finish=false ;;
+
+ --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
+ case $1 in
+@@ -435,7 +438,7 @@ $opt_help || {
+
+
+ # Darwin sucks
+- eval std_shrext=\"$shrext_cmds\"
++ eval "std_shrext=\"$shrext_cmds\""
+
+
+ # Only execute mode is allowed to have -dlopen flags.
+@@ -542,7 +545,7 @@ func_execute_cmds ()
+ save_ifs=$IFS; IFS='~'
+ for cmd in $1; do
+ IFS=$save_ifs
+- eval cmd=\"$cmd\"
++ eval "cmd=\"$cmd\""
+ func_show_eval "$cmd" "${2-:}"
+ done
+ IFS=$save_ifs
+@@ -898,7 +901,7 @@ compiler."
+ trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+ if test -n "$fix_srcfile_path"; then
+- eval srcfile=\"$fix_srcfile_path\"
++ eval "srcfile=\"$fix_srcfile_path\""
+ fi
+ func_quote_for_eval "$srcfile"
+ qsrcfile=$func_quote_for_eval_result
+@@ -1300,10 +1303,10 @@ func_mode_execute ()
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+- if eval "test -z \"\$$shlibpath_var\""; then
+- eval "$shlibpath_var=\"\$dir\""
++ if eval test -z \"\$$shlibpath_var\"; then
++ eval $shlibpath_var=\$dir
+ else
+- eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
++ eval $shlibpath_var=\$dir:\$$shlibpath_var
+ fi
+ done
+
+@@ -1419,7 +1422,7 @@ func_mode_finish ()
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+- eval flag=\"$hardcode_libdir_flag_spec\"
++ eval "flag=\"$hardcode_libdir_flag_spec\""
+
+ $ECHO " - use the \`$flag' linker flag"
+ fi
+@@ -1896,7 +1899,7 @@ func_mode_install ()
+ test -n "$future_libdirs" && \
+ func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+- if test -n "$current_libdirs"; then
++ if test -n "$current_libdirs" && $opt_finish; then
+ # Maybe just do a dry run.
+ $opt_dry_run && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+@@ -1969,15 +1972,15 @@ extern \"C\" {
+
+ if test -n "$exclude_expsyms"; then
+ $opt_dry_run || {
+- eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+- eval '$MV "$nlist"T "$nlist"'
++ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
++ $MV "$nlist"T "$nlist"
+ }
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $opt_dry_run || {
+- eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+- eval '$MV "$nlist"T "$nlist"'
++ $EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T
++ $MV "$nlist"T "$nlist"
+ }
+ fi
+
+@@ -1986,23 +1989,23 @@ extern \"C\" {
+ export_symbols="$output_objdir/$outputname.exp"
+ $opt_dry_run || {
+ $RM $export_symbols
+- eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
++ ${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' < "$nlist" > "$export_symbols"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+- eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+- eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
++ echo EXPORTS > "$output_objdir/$outputname.def"
++ cat "$export_symbols" >> "$output_objdir/$outputname.def"
+ ;;
+ esac
+ }
+ else
+ $opt_dry_run || {
+- eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+- eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+- eval '$MV "$nlist"T "$nlist"'
++ ${SED} -e 's/\([].[*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/' < "$export_symbols" > "$output_objdir/$outputname.exp"
++ $GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T
++ $MV "$nlist"T "$nlist"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+- eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+- eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
++ echo EXPORTS > "$output_objdir/$outputname.def"
++ cat "$nlist" >> "$output_objdir/$outputname.def"
+ ;;
+ esac
+ }
+@@ -2014,7 +2017,7 @@ extern \"C\" {
+ func_basename "$dlprefile"
+ name="$func_basename_result"
+ $opt_dry_run || {
+- eval '$ECHO ": $name " >> "$nlist"'
++ $ECHO ": $name " >> "$nlist"
+ eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ done
+@@ -2189,9 +2192,9 @@ func_win32_libid ()
+ win32_libid_type="x86 archive import"
+ ;;
+ *ar\ archive*) # could be an import, or static
+- if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
++ if $OBJDUMP -f "$1" | $SED -e '10q' 2>/dev/null |
+ $EGREP 'file format (pe-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+- win32_nmres=`eval $NM -f posix -A $1 |
++ win32_nmres=`$NM -f posix -A "$1" |
+ $SED -n -e '
+ 1,100{
+ / I /{
+@@ -2471,7 +2474,7 @@ _LTECHO_EOF'
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+- if relink_command_output=\`eval \$relink_command 2>&1\`; then :
++ if relink_command_output=\`eval \"\$relink_command\" 2>&1\`; then :
+ else
+ $ECHO \"\$relink_command_output\" >&2
+ $RM \"\$progdir/\$file\"
+@@ -3615,7 +3618,7 @@ EOF
+ func_win32_import_lib_p ()
+ {
+ $opt_debug
+- case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
++ case `eval "$file_magic_cmd \"\$1\" 2>/dev/null" | $SED -e 10q` in
+ *import*) : ;;
+ *) false ;;
+ esac
+@@ -4151,6 +4154,9 @@ func_mode_link ()
+ # Compiler inserts libc in the correct place for threads to work
+ test "X$arg" = "X-lc" && continue
+ ;;
++ *-*-linux*)
++ test "X$arg" = "X-lc" && continue
++ ;;
+ esac
+ elif test "X$arg" = "X-lc_r"; then
+ case $host in
+@@ -4517,7 +4523,7 @@ func_mode_link ()
+ func_fatal_help "the \`$prevarg' option requires an argument"
+
+ if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+- eval arg=\"$export_dynamic_flag_spec\"
++ eval "arg=\"$export_dynamic_flag_spec\""
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ fi
+@@ -4534,8 +4540,8 @@ func_mode_link ()
+ else
+ shlib_search_path=
+ fi
+- eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+- eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
++ eval "sys_lib_search_path=\"$sys_lib_search_path_spec\""
++ eval "sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\""
+
+ func_dirname "$output" "/" ""
+ output_objdir="$func_dirname_result$objdir"
+@@ -5225,7 +5231,7 @@ func_mode_link ()
+ shift
+ realname="$1"
+ shift
+- libname=`eval "\\$ECHO \"$libname_spec\""`
++ eval "libname=\"$libname_spec\""
+ # use dlname if we got it. it's perfectly good, no?
+ if test -n "$dlname"; then
+ soname="$dlname"
+@@ -5238,7 +5244,7 @@ func_mode_link ()
+ versuffix="-$major"
+ ;;
+ esac
+- eval soname=\"$soname_spec\"
++ eval "soname=\"$soname_spec\""
+ else
+ soname="$realname"
+ fi
+@@ -5520,7 +5526,7 @@ func_mode_link ()
+ case $host in
+ *-*-darwin*)
+ depdepl=
+- eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
++ deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+ if test -n "$deplibrary_names" ; then
+ for tmp in $deplibrary_names ; do
+ depdepl=$tmp
+@@ -5542,7 +5548,7 @@ func_mode_link ()
+ ;;
+ esac
+ else
+- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
++ libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ test "$absdir" != "$libdir" && \
+@@ -5595,7 +5601,7 @@ func_mode_link ()
+ fi
+ for var in $vars dependency_libs; do
+ # Add libraries to $var in reverse order
+- eval tmp_libs=\"\$$var\"
++ eval tmp_libs=\$$var
+ new_libs=
+ for deplib in $tmp_libs; do
+ # FIXME: Pedantically, this is the right thing to do, so
+@@ -5646,7 +5652,7 @@ func_mode_link ()
+ *) tmp_libs="$tmp_libs $deplib" ;;
+ esac
+ done
+- eval $var=\"$tmp_libs\"
++ eval $var=\$tmp_libs
+ done # for var
+ fi
+ # Last step: remove runtime libs from dependency_libs
+@@ -5709,8 +5715,8 @@ func_mode_link ()
+ lib*)
+ func_stripname 'lib' '.la' "$outputname"
+ name=$func_stripname_result
+- eval shared_ext=\"$shrext_cmds\"
+- eval libname=\"$libname_spec\"
++ eval "shared_ext=\"$shrext_cmds\""
++ eval "libname=\"$libname_spec\""
+ ;;
+ *)
+ test "$module" = no && \
+@@ -5720,8 +5726,8 @@ func_mode_link ()
+ # Add the "lib" prefix for modules if required
+ func_stripname '' '.la' "$outputname"
+ name=$func_stripname_result
+- eval shared_ext=\"$shrext_cmds\"
+- eval libname=\"$libname_spec\"
++ eval "shared_ext=\"$shrext_cmds\""
++ eval "libname=\"$libname_spec\""
+ else
+ func_stripname '' '.la' "$outputname"
+ libname=$func_stripname_result
+@@ -6160,8 +6166,8 @@ EOF
+ esac
+ fi
+ if test -n "$i" ; then
+- libname=`eval "\\$ECHO \"$libname_spec\""`
+- deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
++ eval "libname=\"$libname_spec\""
++ eval "deplib_matches=\"$library_names_spec\""
+ set dummy $deplib_matches; shift
+ deplib_match=$1
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+@@ -6203,8 +6209,8 @@ EOF
+ esac
+ fi
+ if test -n "$i" ; then
+- libname=`eval "\\$ECHO \"$libname_spec\""`
+- deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
++ eval "libname=\"$libname_spec\""
++ eval "deplib_matches=\"$library_names_spec\""
+ set dummy $deplib_matches; shift
+ deplib_match=$1
+ if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+@@ -6253,7 +6259,7 @@ EOF
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+- libname=`eval "\\$ECHO \"$libname_spec\""`
++ eval "libname=\"$libname_spec\""
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+@@ -6275,7 +6281,7 @@ EOF
+ *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+ esac
+ done
+- if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
++ if eval "$file_magic_cmd \"\$potlib\"" 2>/dev/null |
+ $SED -e 10q |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
+@@ -6325,7 +6331,7 @@ EOF
+ esac
+ fi
+ if test -n "$a_deplib" ; then
+- libname=`eval "\\$ECHO \"$libname_spec\""`
++ eval "libname=\"$libname_spec\""
+ for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+ for potent_lib in $potential_libs; do
+@@ -6508,7 +6514,7 @@ EOF
+ esac
+ fi
+ else
+- eval flag=\"$hardcode_libdir_flag_spec\"
++ eval "flag=\"$hardcode_libdir_flag_spec\""
+ dep_rpath="$dep_rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+@@ -6523,9 +6529,9 @@ EOF
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+ if test -n "$hardcode_libdir_flag_spec_ld"; then
+- eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
++ eval "dep_rpath=\"$hardcode_libdir_flag_spec_ld\""
+ else
+- eval dep_rpath=\"$hardcode_libdir_flag_spec\"
++ eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+ fi
+ fi
+ if test -n "$runpath_var" && test -n "$perm_rpath"; then
+@@ -6534,7 +6540,8 @@ EOF
+ for dir in $perm_rpath; do
+ rpath="$rpath$dir:"
+ done
+- eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
++ eval $runpath_var=\$rpath\$$runpath_var
++ export $runpath_var
+ fi
+ test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+ fi
+@@ -6542,19 +6549,20 @@ EOF
+ shlibpath="$finalize_shlibpath"
+ test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ if test -n "$shlibpath"; then
+- eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
++ eval $shlibpath_var=\$shlibpath\$$shlibpath_var
++ export $shlibpath_var
+ fi
+
+ # Get the real and link names of the library.
+- eval shared_ext=\"$shrext_cmds\"
+- eval library_names=\"$library_names_spec\"
++ eval "shared_ext=\"$shrext_cmds\""
++ eval "library_names=\"$library_names_spec\""
+ set dummy $library_names
+ shift
+ realname="$1"
+ shift
+
+ if test -n "$soname_spec"; then
+- eval soname=\"$soname_spec\"
++ eval "soname=\"$soname_spec\""
+ else
+ soname="$realname"
+ fi
+@@ -6610,7 +6618,7 @@ EOF
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+- eval cmd=\"$cmd\"
++ eval "cmd=\"$cmd\""
+ func_len " $cmd"
+ len=$func_len_result
+ if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+@@ -6636,7 +6644,7 @@ EOF
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+- $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
++ $opt_dry_run || $ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"
+ fi
+
+ if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+@@ -6674,7 +6682,7 @@ EOF
+ fi
+ if test -n "$whole_archive_flag_spec"; then
+ save_libobjs=$libobjs
+- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
++ eval "libobjs=\"\$libobjs $whole_archive_flag_spec\""
+ test "X$libobjs" = "X " && libobjs=
+ else
+ gentop="$output_objdir/${outputname}x"
+@@ -6687,30 +6695,30 @@ EOF
+ fi
+
+ if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+- eval flag=\"$thread_safe_flag_spec\"
++ eval "flag=\"$thread_safe_flag_spec\""
+ linker_flags="$linker_flags $flag"
+ fi
+
+ # Make a backup of the uninstalled library when relinking
+ if test "$mode" = relink; then
+- $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
++ $opt_dry_run || (cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U) || exit $?
+ fi
+
+ # Do each of the archive commands.
+ if test "$module" = yes && test -n "$module_cmds" ; then
+ if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+- eval test_cmds=\"$module_expsym_cmds\"
++ eval "test_cmds=\"$module_expsym_cmds\""
+ cmds=$module_expsym_cmds
+ else
+- eval test_cmds=\"$module_cmds\"
++ eval "test_cmds=\"$module_cmds\""
+ cmds=$module_cmds
+ fi
+ else
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+- eval test_cmds=\"$archive_expsym_cmds\"
++ eval "test_cmds=\"$archive_expsym_cmds\""
+ cmds=$archive_expsym_cmds
+ else
+- eval test_cmds=\"$archive_cmds\"
++ eval "test_cmds=\"$archive_cmds\""
+ cmds=$archive_cmds
+ fi
+ fi
+@@ -6779,7 +6787,7 @@ EOF
+ if test -n "$save_libobjs"; then
+ func_verbose "creating reloadable object files..."
+ output=$output_objdir/$output_la-${k}.$objext
+- eval test_cmds=\"$reload_cmds\"
++ eval "test_cmds=\"$reload_cmds\""
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+@@ -6799,12 +6807,12 @@ EOF
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ reload_objs=$objlist
+- eval concat_cmds=\"$reload_cmds\"
++ eval "concat_cmds=\"$reload_cmds\""
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ reload_objs="$objlist $last_robj"
+- eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
++ eval "concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\""
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ func_arith $k + 1
+@@ -6821,9 +6829,9 @@ EOF
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ reload_objs="$objlist $last_robj"
+- eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
++ eval "concat_cmds=\"\${concat_cmds}$reload_cmds\""
+ if test -n "$last_robj"; then
+- eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
++ eval "concat_cmds=\"\${concat_cmds}~\$RM $last_robj\""
+ fi
+ delfiles="$delfiles $output"
+
+@@ -6838,9 +6846,9 @@ EOF
+ libobjs=$output
+ # Append the command to create the export file.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+- eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
++ eval "concat_cmds=\"\$concat_cmds$export_symbols_cmds\""
+ if test -n "$last_robj"; then
+- eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
++ eval "concat_cmds=\"\$concat_cmds~\$RM $last_robj\""
+ fi
+ fi
+
+@@ -6880,7 +6888,7 @@ EOF
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+- $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
++ $opt_dry_run || $ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"
+ fi
+
+ if test -n "$orig_export_symbols"; then
+@@ -6903,7 +6911,7 @@ EOF
+ output=$save_output
+
+ if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
++ eval "libobjs=\"\$libobjs $whole_archive_flag_spec\""
+ test "X$libobjs" = "X " && libobjs=
+ fi
+ # Expand the library linking commands again to reset the
+@@ -6927,7 +6935,7 @@ EOF
+
+ if test -n "$delfiles"; then
+ # Append the command to remove temporary files to $cmds.
+- eval cmds=\"\$cmds~\$RM $delfiles\"
++ eval "cmds=\"\$cmds~\$RM $delfiles\""
+ fi
+
+ # Add any objects from preloaded convenience libraries
+@@ -6943,7 +6951,7 @@ EOF
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+- eval cmd=\"$cmd\"
++ eval "cmd=\"$cmd\""
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+@@ -6965,7 +6973,7 @@ EOF
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+- $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
++ $opt_dry_run || (cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname) || exit $?
+
+ if test -n "$convenience"; then
+ if test -z "$whole_archive_flag_spec"; then
+@@ -7044,7 +7052,7 @@ EOF
+
+ if test -n "$convenience"; then
+ if test -n "$whole_archive_flag_spec"; then
+- eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
++ eval "tmp_whole_archive_flags=\"$whole_archive_flag_spec\""
+ reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+ else
+ gentop="$output_objdir/${obj}x"
+@@ -7078,7 +7086,7 @@ EOF
+ # Create an invalid libtool object if no PIC, so that we don't
+ # accidentally link it into a program.
+ # $show "echo timestamp > $libobj"
+- # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
++ # $opt_dry_run || echo timestamp > $libobj || exit $?
+ exit $EXIT_SUCCESS
+ fi
+
+@@ -7201,7 +7209,7 @@ EOF
+ esac
+ fi
+ else
+- eval flag=\"$hardcode_libdir_flag_spec\"
++ eval "flag=\"$hardcode_libdir_flag_spec\""
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+@@ -7230,7 +7238,7 @@ EOF
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+- eval rpath=\" $hardcode_libdir_flag_spec\"
++ eval "rpath=\" $hardcode_libdir_flag_spec\""
+ fi
+ compile_rpath="$rpath"
+
+@@ -7252,7 +7260,7 @@ EOF
+ esac
+ fi
+ else
+- eval flag=\"$hardcode_libdir_flag_spec\"
++ eval "flag=\"$hardcode_libdir_flag_spec\""
+ rpath="$rpath $flag"
+ fi
+ elif test -n "$runpath_var"; then
+@@ -7266,7 +7274,7 @@ EOF
+ if test -n "$hardcode_libdir_separator" &&
+ test -n "$hardcode_libdirs"; then
+ libdir="$hardcode_libdirs"
+- eval rpath=\" $hardcode_libdir_flag_spec\"
++ eval "rpath=\" $hardcode_libdir_flag_spec\""
+ fi
+ finalize_rpath="$rpath"
+
+@@ -7557,7 +7565,7 @@ EOF
+ esac
+ done
+ fi
+- eval cmds=\"$old_archive_cmds\"
++ eval "cmds=\"$old_archive_cmds\""
+
+ func_len " $cmds"
+ len=$func_len_result
+@@ -7577,7 +7585,7 @@ EOF
+ do
+ last_oldobj=$obj
+ done
+- eval test_cmds=\"$old_archive_cmds\"
++ eval "test_cmds=\"$old_archive_cmds\""
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+@@ -7596,7 +7604,7 @@ EOF
+ RANLIB=$save_RANLIB
+ fi
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+- eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
++ eval "concat_cmds=\"\${concat_cmds}$old_archive_cmds\""
+ objlist=
+ len=$len0
+ fi
+@@ -7604,9 +7612,9 @@ EOF
+ RANLIB=$save_RANLIB
+ oldobjs=$objlist
+ if test "X$oldobjs" = "X" ; then
+- eval cmds=\"\$concat_cmds\"
++ eval "cmds=\"\$concat_cmds\""
+ else
+- eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
++ eval "cmds=\"\$concat_cmds~\$old_archive_cmds\""
+ fi
+ fi
+ fi
+@@ -7656,7 +7664,7 @@ EOF
+ *.la)
+ func_basename "$deplib"
+ name="$func_basename_result"
+- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
++ libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ newdependency_libs="$newdependency_libs $libdir/$name"
+@@ -7672,7 +7680,7 @@ EOF
+ *.la)
+ func_basename "$lib"
+ name="$func_basename_result"
+- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
++ libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ newdlfiles="$newdlfiles $libdir/$name"
+@@ -7691,7 +7699,7 @@ EOF
+ # the library:
+ func_basename "$lib"
+ name="$func_basename_result"
+- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
++ libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ newdlprefiles="$newdlprefiles $libdir/$name"
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,28 @@
+From 115ef890e502dc45eed8609e51ad6a6ef60c6083 Mon Sep 17 00:00:00 2001
+From: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+Date: Thu, 13 Jan 2011 18:52:53 +0000
+Subject: [PATCH 1000/1003] Backport from Libtool: Fix relink mode to use
+ absolute path if hardcode_minus_L.
+
+/:
+ * ltmain.m4sh (relink): Use absolute path when hardcoding with -L.
+---
+ ltmain.m4sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
+index cba8b4c7a56..a03433f1789 100644
+--- a/libltdl/config/ltmain.m4sh
++++ b/libltdl/config/ltmain.m4sh
+@@ -5928,7 +5928,7 @@ func_mode_link ()
+ test "$hardcode_direct_absolute" = no; then
+ add="$dir/$linklib"
+ elif test "$hardcode_minus_L" = yes; then
+- add_dir="-L$dir"
++ add_dir="-L$absdir"
+ # Try looking first in the location we're being installed to.
+ if test -n "$inst_prefix_dir"; then
+ case $libdir in
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,26 @@
+From 62a0f7233525099a718f61eca2ea7d89a8cad6f7 Mon Sep 17 00:00:00 2001
+From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+Date: Thu, 6 Feb 2014 11:01:57 +0100
+Subject: [PATCH 1001/1003] PR target/59788 * ltmain.m4sh
+ (opt_duplicate_compiler_generated_deps): Enable on *solaris2*.
+
+---
+ ltmain.m4sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
+index a03433f1789..9503ec85d70 100644
+--- a/libltdl/config/ltmain.m4sh
++++ b/libltdl/config/ltmain.m4sh
+@@ -976,7 +976,7 @@ func_enable_tag ()
+
+
+ case $host in
+- *cygwin* | *mingw* | *pw32* | *cegcc*)
++ *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* )
+ # don't eliminate duplications in $postdeps and $predeps
+ opt_duplicate_compiler_generated_deps=:
+ ;;
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,37 @@
+From 14af24e0a83bbda49e26fc8af7c06cfe39611add Mon Sep 17 00:00:00 2001
+From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
+Date: Mon, 7 Aug 2023 13:07:35 +0200
+Subject: [PATCH 1002/1003] libtool.m4: Sort output of 'find' to enable
+ deterministic builds.
+
+ * libtool.m4: Sort output of 'find' to enable deterministic builds.
+ * ltmain.m4sh: Likewise.
+---
+ ltmain.m4sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
+index 9503ec85d70..79f9ba89af5 100644
+--- a/libltdl/config/ltmain.m4sh
++++ b/libltdl/config/ltmain.m4sh
+@@ -2917,7 +2917,7 @@ func_extract_archives ()
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+- darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
++ darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+ $LIPO -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ $RM -rf unfat-$$
+@@ -2932,7 +2932,7 @@ func_extract_archives ()
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+- my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
++ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+ done
+
+ func_extract_archives_result="$my_oldobjs"
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,32 @@
+From af5478e1f3cee5741f68377eb5d60cdcf05ca858 Mon Sep 17 00:00:00 2001
+From: Martin Liska <mliska@suse.cz>
+Date: Mon, 7 Aug 2023 13:07:37 +0200
+Subject: [PATCH 1003/1003] Do not use HAVE_DOS_BASED_FILE_SYSTEM for Cygwin.
+
+ PR gcov-profile/94570
+ * ltmain.m4sh: Do not define HAVE_DOS_BASED_FILE_SYSTEM
+ for CYGWIN.
+
+Co-Authored-By: Jonathan Yong <10walls@gmail.com>
+---
+ ltmain.m4sh | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libltdl/config/ltmain.m4sh b/libltdl/config/ltmain.m4sh
+index 79f9ba89af5..70990740b6c 100644
+--- a/libltdl/config/ltmain.m4sh
++++ b/libltdl/config/ltmain.m4sh
+@@ -3425,8 +3425,8 @@ int setenv (const char *, const char *, int);
+ # define PATH_SEPARATOR ':'
+ #endif
+
+-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+- defined (__OS2__)
++#if (defined (_WIN32) && ! defined(__CYGWIN__)) || defined (__MSDOS__) || \
++ defined (__DJGPP__) || defined (__OS2__)
+ # define HAVE_DOS_BASED_FILE_SYSTEM
+ # define FOPEN_WB "wb"
+ # ifndef DIR_SEPARATOR_2
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,72 @@
+From 822ce8ee21f06a7714074f0994023cc67a8f16eb Mon Sep 17 00:00:00 2001
+From: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+Date: Sun, 13 Feb 2011 21:00:14 +0000
+Subject: [PATCH 2000/2018] Remove freebsd1 from libtool.m4 macros and
+ config.rpath.
+
+/:
+ Import from Libtool and gnulib:
+
+ 2011-01-27 Gerald Pfeifer <gerald@pfeifer.com>
+
+ Prepare for supporting FreeBSD 10.
+ * config.rpath: Remove handling of freebsd1* which soon would
+ match FreeBSD 10.0.
+
+ 2011-01-20 Gerald Pfeifer <gerald@pfeifer.com> (tiny change)
+
+ Remove support for FreeBSD 1.x.
+ * libtool.m4 (_LT_LINKER_SHLIBS)
+ (_LT_SYS_DYNAMIC_LINKER): Remove handling of freebsd1* which
+ soon would incorrectly match FreeBSD 10.0.
+
+bfd/:
+ * configure: Regenerate.
+
+gas/:
+ * configure: Regenerate.
+
+ld/:
+ * configure: Regenerate.
+
+opcodes/:
+ * configure: Regenerate.
+
+binutils/:
+ * configure: Regenerate.
+
+gprof/:
+ * configure: Regenerate.
+---
+ libtool.m4 | 8 --------
+ 1 file changed, 8 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 9abd1478359..71bcee83c87 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -2266,10 +2266,6 @@ dgux*)
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+-freebsd1*)
+- dynamic_linker=no
+- ;;
+-
+ freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+@@ -4796,10 +4792,6 @@ _LT_EOF
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+- freebsd1*)
+- _LT_TAGVAR(ld_shlibs, $1)=no
+- ;;
+-
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,76 @@
+From f87f9c614c974f57911d987b40c3ff19b0e3ee17 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Sun, 26 Aug 2012 14:09:08 +0000
+Subject: [PATCH 2001/2018] Sync libtool.m4 with GCC tree
+
+2012-05-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ Merge upstream change
+ * libtool.m4 (_LT_ENABLE_LOCK): Support x32.
+
+2011-11-21 Andreas Tobler <andreast@fgznet.ch>
+
+ * libtool.m4: Additional FreeBSD 10 fixes.
+---
+ libtool.m4 | 17 ++++++++++++-----
+ 1 file changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 71bcee83c87..a7f99ac7dbc 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -1232,7 +1232,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+- LD="${LD-ld} -m elf_i386"
++ case `/usr/bin/file conftest.o` in
++ *x86-64*)
++ LD="${LD-ld} -m elf32_x86_64"
++ ;;
++ *)
++ LD="${LD-ld} -m elf_i386"
++ ;;
++ esac
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+@@ -2273,7 +2280,7 @@ freebsd* | dragonfly*)
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+- freebsd[[123]]*) objformat=aout ;;
++ freebsd[[23]].*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+@@ -2291,7 +2298,7 @@ freebsd* | dragonfly*)
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+- freebsd2*)
++ freebsd2.*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+@@ -4804,7 +4811,7 @@ _LT_EOF
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+- freebsd2*)
++ freebsd2.*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+@@ -5751,7 +5758,7 @@ if test "$_lt_caught_CXX_error" != yes; then
+ esac
+ ;;
+
+- freebsd[[12]]*)
++ freebsd2.*)
+ # C++ shared libraries reported to be fairly broken before
+ # switch to ELF
+ _LT_TAGVAR(ld_shlibs, $1)=no
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,37 @@
+From 1488e23083edb554fb4217789c42018ea0904600 Mon Sep 17 00:00:00 2001
+From: David Edelsohn <dje.gcc@gmail.com>
+Date: Fri, 14 Sep 2012 23:55:22 +0000
+Subject: [PATCH 2002/2018] PR target/38607 Merge upstream
+ change. * libtool.m4 (_LT_COMPILER_PIC): Add -fPIC to GCC and GXX for
+ AIX.
+
+ * configure.ac: Add target-libquadmath to noconfigdirs for AIX.
+ Add libgomp*.o to compare_exclusions for AIX.
+ * configure: Regenerate.
+---
+ libtool.m4 | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index a7f99ac7dbc..8a14e2b22f9 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -3580,6 +3580,7 @@ m4_if([$1], [CXX], [
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+
+ amigaos*)
+@@ -3891,6 +3892,7 @@ m4_if([$1], [CXX], [
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+
+ amigaos*)
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,51 @@
+From cc9afea3e4788695be7e50621c39c1ae6f75dbc0 Mon Sep 17 00:00:00 2001
+From: Alan Modra <amodra@gmail.com>
+Date: Fri, 20 Sep 2013 09:51:25 +0000
+Subject: [PATCH 2003/2018] * libtool.m4 (_LT_ENABLE_LOCK <ld -m flags>):
+ Remove non-canonical ppc host match. Support little-endian powerpc linux
+ hosts. Regenerate binutils configure files.
+
+---
+ libtool.m4 | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 8a14e2b22f9..797468f02a5 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -1220,7 +1220,7 @@ ia64-*-hpux*)
+ rm -rf conftest*
+ ;;
+
+-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
++x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
+ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+@@ -1241,7 +1241,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ ;;
+ esac
+ ;;
+- ppc64-*linux*|powerpc64-*linux*)
++ powerpc64le-*linux*)
++ LD="${LD-ld} -m elf32lppclinux"
++ ;;
++ powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+@@ -1260,7 +1263,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+- ppc*-*linux*|powerpc*-*linux*)
++ powerpcle-*linux*)
++ LD="${LD-ld} -m elf64lppc"
++ ;;
++ powerpc-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,70 @@
+From 6e733ccea9ed0c822817a06b53ccdbe73f8f5c04 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Mon, 24 Nov 2014 09:14:09 -0800
+Subject: [PATCH 2004/2018] Update libtool.m4 from GCC trunk
+
+ * libtool.m4: Updated from GCC trunk.
+
+bfd/
+
+ * configure: Regenerated.
+
+binutils/
+
+ * configure: Regenerated.
+
+gas/
+
+ * configure: Regenerated.
+
+gprof/
+
+ * configure: Regenerated.
+
+ld/
+
+ * configure: Regenerated.
+
+opcodes/
+
+ * configure: Regenerated.
+---
+ libtool.m4 | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 797468f02a5..4b2d30a1558 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -1006,7 +1006,7 @@ _LT_EOF
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+- 10.[[012]]*)
++ 10.[[012]][[,.]]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+@@ -4459,7 +4459,7 @@ _LT_EOF
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+- tmp_addflag=
++ tmp_addflag=' $pic_flag'
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+@@ -5525,8 +5525,8 @@ if test "$_lt_caught_CXX_error" != yes; then
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
++ _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
++ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,39 @@
+From 1985dc2d048a4134f20dc9cda61255eb33289476 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Tue, 12 Jan 2016 08:44:06 -0800
+Subject: [PATCH 2005/2018] Sync top-level btool.m4 with GCC
+
+ Sync with GCC
+ 2015-11-26 David Edelsohn <dje.gcc@gmail.com>
+
+ * m4/libtool.m4 (export_symbols_cmds) [AIX]: Add global TLS "L"
+ symbols.
+---
+ libtool.m4 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 4b2d30a1558..24d13f34409 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -4230,7 +4230,7 @@ m4_if([$1], [CXX], [
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+- _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
++ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+@@ -4641,7 +4641,7 @@ _LT_EOF
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+- _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
++ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "L")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ aix_use_runtimelinking=no
+
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,377 @@
+From d0ac1c44885daf68f631befa37e3f3bad318fbbf Mon Sep 17 00:00:00 2001
+From: Simon Marchi <simon.marchi@ericsson.com>
+Date: Tue, 19 Jun 2018 16:54:48 -0400
+Subject: [PATCH 2006/2018] Bump to autoconf 2.69 and automake 1.15.1
+
+When trying to run the update-gnulib.sh script in gdb, I get this:
+
+Error: Wrong automake version (Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ =:+{}]+)}/ at /opt/automake/1.11.1/bin/automake line 4113.), we need 1.11.1.
+Aborting.
+
+Apparently, it's an issue with a regex in automake that triggers a
+warning starting with Perl 5.22. It has been fixed in automake 1.15.1.
+So I think it's a good excuse to bump the versions of autoconf and
+automake used in the gnulib import. And to avoid requiring multiple
+builds of autoconf/automake, it was suggested that we bump the required
+version of those tools for all binutils-gdb.
+
+For autoconf, the 2.69 version is universally available, so it's an easy
+choice. For automake, different distros and distro versions have
+different automake versions. But 1.15.1 seems to be the most readily
+available as a package. In any case, it's easy to build it from source.
+
+I removed the version checks from AUTOMAKE_OPTIONS and AC_PREREQ,
+because I don't think they are useful in our case. They only specify a
+lower bound for the acceptable version of automake/autoconf. That's
+useful if you let the user choose the version of the tool they want to
+use, but want to set a minimum version (because you use a feature that
+was introduced in that version). In our case, we force people to use a
+specific version anyway. For the autoconf version, we have the check in
+config/override.m4 that enforces the version we want. It will be one
+less thing to update next time we change autotools version.
+
+I hit a few categories of problems that required some changes. They are
+described below along with the chosen solutions.
+
+Problem 1:
+
+ configure.ac:17: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
+ configure.ac:17: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
+
+Solution 1:
+
+ Adjust the code based on the example at that URL.
+
+Problem 2 (in zlib/):
+
+ Makefile.am: error: required file './INSTALL' not found
+ Makefile.am: 'automake --add-missing' can install 'INSTALL'
+ Makefile.am: error: required file './NEWS' not found
+ Makefile.am: error: required file './AUTHORS' not found
+ Makefile.am: error: required file './COPYING' not found
+ Makefile.am: 'automake --add-missing' can install 'COPYING'
+
+Solution 2:
+
+ Add the foreign option to AUTOMAKE_OPTIONS.
+
+Problem 3:
+
+ doc/Makefile.am:20: error: support for Cygnus-style trees has been removed
+
+Solution 3:
+
+ Remove the cygnus options.
+
+Problem 4:
+
+ Makefile.am:656: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
+
+Solution 4:
+
+ Rename "INCLUDES = " to "AM_CPPFLAGS += " (because AM_CPPFLAGS is
+ already defined earlier).
+
+Problem 5:
+
+ doc/Makefile.am:71: warning: suffix '.texinfo' for Texinfo files is discouraged; use '.texi' instead
+ doc/Makefile.am: warning: Oops!
+ doc/Makefile.am: It appears this file (or files included by it) are triggering
+ doc/Makefile.am: an undocumented, soon-to-be-removed automake hack.
+ doc/Makefile.am: Future automake versions will no longer place in the builddir
+ doc/Makefile.am: (rather than in the srcdir) the generated '.info' files that
+ doc/Makefile.am: appear to be cleaned, by e.g. being listed in CLEANFILES or
+ doc/Makefile.am: DISTCLEANFILES.
+ doc/Makefile.am: If you want your '.info' files to be placed in the builddir
+ doc/Makefile.am: rather than in the srcdir, you have to use the shiny new
+ doc/Makefile.am: 'info-in-builddir' automake option.
+
+Solution 5:
+
+ Rename .texinfo files to .texi.
+
+Problem 6:
+
+ doc/Makefile.am: warning: Oops!
+ doc/Makefile.am: It appears this file (or files included by it) are triggering
+ doc/Makefile.am: an undocumented, soon-to-be-removed automake hack.
+ doc/Makefile.am: Future automake versions will no longer place in the builddir
+ doc/Makefile.am: (rather than in the srcdir) the generated '.info' files that
+ doc/Makefile.am: appear to be cleaned, by e.g. being listed in CLEANFILES or
+ doc/Makefile.am: DISTCLEANFILES.
+ doc/Makefile.am: If you want your '.info' files to be placed in the builddir
+ doc/Makefile.am: rather than in the srcdir, you have to use the shiny new
+ doc/Makefile.am: 'info-in-builddir' automake option.
+
+Solution 6:
+
+ Remove the hack at the bottom of doc/Makefile.am and use
+ the info-in-builddir automake option.
+
+Problem 7:
+
+ doc/Makefile.am:35: error: required file '../texinfo.tex' not found
+ doc/Makefile.am:35: 'automake --add-missing' can install 'texinfo.tex'
+
+Solution 7:
+
+ Use the no-texinfo.tex automake option. We also have one in
+ texinfo/texinfo.tex, not sure if we should point to that, or move it
+ (or a newer version of it added with automake --add-missing) to
+ top-level.
+
+Problem 8:
+
+ Makefile.am:131: warning: source file 'config/tc-aarch64.c' is in a subdirectory,
+ Makefile.am:131: but option 'subdir-objects' is disabled
+ automake: warning: possible forward-incompatibility.
+ automake: At least a source file is in a subdirectory, but the 'subdir-objects'
+ automake: automake option hasn't been enabled. For now, the corresponding output
+ automake: object file(s) will be placed in the top-level directory. However,
+ automake: this behaviour will change in future Automake versions: they will
+ automake: unconditionally cause object files to be placed in the same subdirectory
+ automake: of the corresponding sources.
+ automake: You are advised to start using 'subdir-objects' option throughout your
+ automake: project, to avoid future incompatibilities.
+
+Solution 8:
+
+ Use subdir-objects, that means adjusting references to some .o that will now
+ be in config/.
+
+Problem 9:
+
+ configure.ac:375: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
+ ../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
+ ../../lib/autoconf/general.m4:2601: _AC_COMPILE_IFELSE is expanded from...
+ ../../lib/autoconf/general.m4:2617: AC_COMPILE_IFELSE is expanded from...
+ ../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from...
+ ../../lib/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from...
+ ../../lib/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from...
+ configure.ac:375: the top level
+
+Solution 9:
+
+ Use AC_LANG_SOURCE, or use proper quoting.
+
+Problem 10 (in intl/):
+
+ configure.ac:7: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+ /usr/share/aclocal/threadlib.m4:36: gl_THREADLIB_EARLY_BODY is expanded from...
+ /usr/share/aclocal/threadlib.m4:29: gl_THREADLIB_EARLY is expanded from...
+ /usr/share/aclocal/threadlib.m4:318: gl_THREADLIB is expanded from...
+ /usr/share/aclocal/lock.m4:9: gl_LOCK is expanded from...
+ /usr/share/aclocal/intl.m4:211: gt_INTL_SUBDIR_CORE is expanded from...
+ /usr/share/aclocal/intl.m4:25: AM_INTL_SUBDIR is expanded from...
+ /usr/share/aclocal/gettext.m4:57: AM_GNU_GETTEXT is expanded from...
+ configure.ac:7: the top level
+
+Solution 10:
+
+ Add AC_USE_SYSTEM_EXTENSIONS in configure.ac.
+
+ChangeLog:
+
+ * libtool.m4: Use AC_LANG_SOURCE.
+ * configure.ac: Remove AC_PREREQ, use AC_LANG_SOURCE.
+ * README-maintainer-mode: Update version requirements.
+ * ar-lib: New file.
+ * test-driver: New file.
+ * configure: Re-generate.
+
+bfd/ChangeLog:
+
+ * Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11.
+ (INCLUDES): Rename to ...
+ (AM_CPPFLAGS): ... this.
+ * configure.ac: Remove AC_PREREQ.
+ * doc/Makefile.am (AUTOMAKE_OPTIONS): Remove 1.9, cygnus, add
+ info-in-builddir no-texinfo.tex.
+ (info_TEXINFOS): Rename bfd.texinfo to bfd.texi.
+ * doc/bfd.texinfo: Rename to ...
+ * doc/bfd.texi: ... this.
+ * Makefile.in: Re-generate.
+ * aclocal.m4: Re-generate.
+ * config.in: Re-generate.
+ * configure: Re-generate.
+ * doc/Makefile.in: Re-generate.
+
+binutils/ChangeLog:
+
+ * configure.ac: Remove AC_PREREQ.
+ * doc/Makefile.am (AUTOMAKE_OPTIONS): Remove cygnus, add
+ info-in-builddir no-texinfo.tex.
+ * Makefile.in: Re-generate.
+ * aclocal.m4: Re-generate.
+ * config.in: Re-generate.
+ * configure: Re-generate.
+ * doc/Makefile.in: Re-generate.
+
+config/ChangeLog:
+
+ * override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.
+
+etc/ChangeLog:
+
+ * configure.in: Remove AC_PREREQ.
+ * configure: Re-generate.
+
+gas/ChangeLog:
+
+ * Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11, add subdir-objects.
+ (TARG_CPU_O, OBJ_FORMAT_O, ATOF_TARG_O): Add config/ prefix.
+ * configure.ac (TARG_CPU_O, OBJ_FORMAT_O, ATOF_TARG_O, emfiles,
+ extra_objects): Add config/ prefix.
+ * doc/as.texinfo: Rename to...
+ * doc/as.texi: ... this.
+ * doc/Makefile.am: Rename as.texinfo to as.texi throughout.
+ Remove DISTCLEANFILES hack.
+ (AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add no-texinfo.tex and
+ info-in-builddir.
+ * Makefile.in: Re-generate.
+ * aclocal.m4: Re-generate.
+ * config.in: Re-generate.
+ * configure: Re-generate.
+ * doc/Makefile.in: Re-generate.
+
+gdb/ChangeLog:
+
+ * common/common-defs.h (PACKAGE_NAME, PACKAGE_VERSION,
+ PACKAGE_STRING, PACKAGE_TARNAME): Undefine.
+ * configure.ac: Remove AC_PREREQ, add missing quoting.
+ * gnulib/configure.ac: Modernize usage of
+ AC_INIT/AM_INIT_AUTOMAKE. Remove AC_PREREQ.
+ * gnulib/update-gnulib.sh (AUTOCONF_VERSION): Bump to 2.69.
+ (AUTOMAKE_VERSION): Bump to 1.15.1.
+ * configure: Re-generate.
+ * config.in: Re-generate.
+ * aclocal.m4: Re-generate.
+ * gnulib/aclocal.m4: Re-generate.
+ * gnulib/config.in: Re-generate.
+ * gnulib/configure: Re-generate.
+ * gnulib/import/Makefile.in: Re-generate.
+
+gdb/gdbserver/ChangeLog:
+
+ * configure.ac: Remove AC_PREREQ, add missing quoting.
+ * configure: Re-generate.
+ * config.in: Re-generate.
+ * aclocal.m4: Re-generate.
+
+gdb/testsuite/ChangeLog:
+
+ * configure.ac: Remove AC_PREREQ.
+ * configure: Re-generate.
+
+gold/ChangeLog:
+
+ * configure.ac: Remove AC_PREREQ, add missing quoting and usage
+ of AC_LANG_SOURCE.
+ * Makefile.in: Re-generate.
+ * aclocal.m4: Re-generate.
+ * configure: Re-generate.
+ * testsuite/Makefile.in: Re-generate.
+
+gprof/ChangeLog:
+
+ * configure.ac: Remove AC_PREREQ.
+ * Makefile.am: Remove DISTCLEANFILES hack.
+ (AUTOMAKE_OPTIONS): Remove 1.11, add info-in-builddir.
+ * Makefile.in: Re-generate.
+ * aclocal.m4: Re-generate.
+ * configure: Re-generate.
+ * gconfig.in: Re-generate.
+
+intl/ChangeLog:
+
+ * configure.ac: Add AC_USE_SYSTEM_EXTENSIONS, remove AC_PREREQ.
+ * configure: Re-generate.
+ * config.h.in: Re-generate.
+ * aclocal.m4: Re-generate.
+
+ld/ChangeLog:
+
+ * configure.ac: Remove AC_PREREQ.
+ * Makefile.am: Remove DISTCLEANFILES hack, rename ld.texinfo to
+ ld.texi, ldint.texinfo to ldint.texi throughout.
+ (AUTOMAKE_OPTIONS): Add info-in-builddir.
+ * README: Rename ld.texinfo to ld.texi, ldint.texinfo to
+ ldint.texi throughout.
+ * gen-doc.texi: Likewise.
+ * h8-doc.texi: Likewise.
+ * ld.texinfo: Rename to ...
+ * ld.texi: ... this.
+ * ldint.texinfo: Rename to ...
+ * ldint.texi: ... this.
+ * Makefile.in: Re-generate.
+ * aclocal.m4: Re-generate.
+ * config.in: Re-generate.
+ * configure: Re-generate.
+
+libdecnumber/ChangeLog:
+
+ * configure.ac: Remove AC_PREREQ.
+ * configure: Re-generate.
+ * aclocal.m4.
+
+libiberty/ChangeLog:
+
+ * configure.ac: Remove AC_PREREQ.
+ * configure: Re-generate.
+ * config.in: Re-generate.
+
+opcodes/ChangeLog:
+
+ * Makefile.am (AUTOMAKE_OPTIONS): Remove 1.11.
+ * configure.ac: Remove AC_PREREQ.
+ * Makefile.in: Re-generate.
+ * aclocal.m4: Re-generate.
+ * configure: Re-generate.
+
+readline/ChangeLog.gdb:
+
+ * configure: Re-generate.
+ * examples/rlfe/configure: Re-generate.
+
+sim/ChangeLog:
+
+ * All configure.ac: Remove AC_PREREQ.
+ * All configure: Re-generate.
+
+zlib/ChangeLog.bin-gdb:
+
+ * configure.ac: Modernize AC_INIT call, remove AC_PREREQ.
+ * Makefile.am (AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add
+ foreign.
+ * Makefile.in: Re-generate.
+ * aclocal.m4: Re-generate.
+ * configure: Re-generate.
+---
+ libtool.m4 | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 24d13f34409..434530059fa 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -1079,7 +1079,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
+ # to the aix ld manual.
+ m4_defun([_LT_SYS_MODULE_PATH_AIX],
+ [m4_require([_LT_DECL_SED])dnl
+-AC_LINK_IFELSE(AC_LANG_PROGRAM,[
++AC_LINK_IFELSE([AC_LANG_SOURCE([AC_LANG_PROGRAM])],[
+ lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+@@ -4932,7 +4932,7 @@ _LT_EOF
+ # implicitly export all symbols.
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+- AC_LINK_IFELSE(int foo(void) {},
++ AC_LINK_IFELSE([AC_LANG_SOURCE([int foo(void) {}])],
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ )
+ LDFLAGS="$save_LDFLAGS"
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,50 @@
+From f478212851a25cd9849ad7f41112d08f91ab308b Mon Sep 17 00:00:00 2001
+From: Samuel Thibault <samuel.thibault@gnu.org>
+Date: Thu, 7 Jan 2021 16:47:36 +0000
+Subject: [PATCH 2007/2018] libtool.m4: update GNU/Hurd test from upstream. In
+ upstream libtool, 47a889a4ca20 ("Improve GNU/Hurd support.") fixed detection
+ of shlibpath_overrides_runpath, thus avoiding unnecessary relink. This
+ backports it.
+
+. * libtool.m4: Match gnu* along other GNU systems.
+
+*/ChangeLog:
+
+ * configure: Re-generate.
+---
+ libtool.m4 | 12 +-----------
+ 1 file changed, 1 insertion(+), 11 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 434530059fa..e993b621ac2 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -2323,16 +2323,6 @@ freebsd* | dragonfly*)
+ esac
+ ;;
+
+-gnu*)
+- version_type=linux
+- need_lib_prefix=no
+- need_version=no
+- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+- soname_spec='${libname}${release}${shared_ext}$major'
+- shlibpath_var=LD_LIBRARY_PATH
+- hardcode_into_libs=yes
+- ;;
+-
+ haiku*)
+ version_type=linux
+ need_lib_prefix=no
+@@ -2449,7 +2439,7 @@ linux*oldld* | linux*aout* | linux*coff*)
+ ;;
+
+ # This must be Linux ELF.
+-linux* | k*bsd*-gnu | kopensolaris*-gnu)
++linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,85 @@
+From 50ad1254d5030d0804cbf89c758359ae202e8d55 Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Sat, 9 Jan 2021 06:43:11 -0800
+Subject: [PATCH 2008/2018] GCC: Pass --plugin to AR and RANLIB
+
+Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support LTO
+build.
+
+ * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
+ (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
+ * configure.ac: Include config/gcc-plugin.m4.
+ AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
+ * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
+ RANLIB if possible.
+ * Makefile.in: Regenerated.
+ * configure: Likewise.
+
+config/
+
+ * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
+
+libiberty/
+
+ * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
+ (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
+ (configure_deps): Depend on ../config/gcc-plugin.m4.
+ * aclocal.m4: Include ../config/gcc-plugin.m4.
+ * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
+ RANLIB_PLUGIN_OPTION.
+ * configure: Regenerated.
+
+zlib/
+
+ * configure: Regenerated.
+---
+ libtool.m4 | 25 ++++++++++++++++++++++++-
+ 1 file changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index e993b621ac2..3672e9516e2 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -1323,8 +1323,26 @@ need_locks="$enable_libtool_lock"
+ # _LT_CMD_OLD_ARCHIVE
+ # -------------------
+ m4_defun([_LT_CMD_OLD_ARCHIVE],
+-[AC_CHECK_TOOL(AR, ar, false)
++[plugin_option=
++plugin_names="liblto_plugin.so liblto_plugin-0.dll cyglto_plugin-0.dll"
++for plugin in $plugin_names; do
++ plugin_so=`${CC} ${CFLAGS} --print-prog-name $plugin`
++ if test x$plugin_so = x$plugin; then
++ plugin_so=`${CC} ${CFLAGS} --print-file-name $plugin`
++ fi
++ if test x$plugin_so != x$plugin; then
++ plugin_option="--plugin $plugin_so"
++ break
++ fi
++done
++
++AC_CHECK_TOOL(AR, ar, false)
+ test -z "$AR" && AR=ar
++if test -n "$plugin_option"; then
++ if $AR --help 2>&1 | grep -q "\--plugin"; then
++ AR="$AR $plugin_option"
++ fi
++fi
+ test -z "$AR_FLAGS" && AR_FLAGS=cru
+ _LT_DECL([], [AR], [1], [The archiver])
+ _LT_DECL([], [AR_FLAGS], [1])
+@@ -1335,6 +1353,11 @@ _LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+ AC_CHECK_TOOL(RANLIB, ranlib, :)
+ test -z "$RANLIB" && RANLIB=:
++if test -n "$plugin_option" && test "$RANLIB" != ":"; then
++ if $RANLIB --help 2>&1 | grep -q "\--plugin"; then
++ RANLIB="$RANLIB $plugin_option"
++ fi
++fi
+ _LT_DECL([], [RANLIB], [1],
+ [Commands used to install an old-style archive])
+
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,69 @@
+From 03c02f3116d75721f917c4155cefb18b940a43ff Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Mon, 11 Jan 2021 16:26:39 -0800
+Subject: [PATCH 2009/2018] GCC: Check if AR works with --plugin and rc
+
+AR from older binutils doesn't work with --plugin and rc:
+
+[hjl@gnu-cfl-2 bin]$ touch foo.c
+[hjl@gnu-cfl-2 bin]$ ar --plugin /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c
+[hjl@gnu-cfl-2 bin]$ ./ar --plugin /usr/libexec/gcc/x86_64-redhat-linux/10/liblto_plugin.so rc libfoo.a foo.c
+./ar: no operation specified
+[hjl@gnu-cfl-2 bin]$ ./ar --version
+GNU ar (Linux/GNU Binutils) 2.29.51.0.1.20180112
+Copyright (C) 2018 Free Software Foundation, Inc.
+This program is free software; you may redistribute it under the terms of
+the GNU General Public License version 3 or (at your option) any later version.
+This program has absolutely no warranty.
+[hjl@gnu-cfl-2 bin]$
+
+Check if AR works with --plugin and rc before passing --plugin to AR and
+RANLIB.
+
+ PR ld/27173
+ * configure: Regenerated.
+ * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Check if AR works with
+ --plugin and rc before enabling --plugin.
+
+config/
+
+ PR ld/27173
+ * gcc-plugin.m4 (GCC_PLUGIN_OPTION): Check if AR works with
+ --plugin and rc before enabling --plugin.
+
+libiberty/
+
+ PR ld/27173
+ * configure: Regenerated.
+
+zlib/
+
+ PR ld/27173
+ * configure: Regenerated.
+---
+ libtool.m4 | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 3672e9516e2..9a13f3b117a 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -1340,7 +1340,14 @@ AC_CHECK_TOOL(AR, ar, false)
+ test -z "$AR" && AR=ar
+ if test -n "$plugin_option"; then
+ if $AR --help 2>&1 | grep -q "\--plugin"; then
+- AR="$AR $plugin_option"
++ touch conftest.c
++ $AR $plugin_option rc conftest.a conftest.c
++ if test "$?" != 0; then
++ AC_MSG_WARN([Failed: $AR $plugin_option rc])
++ else
++ AR="$AR $plugin_option"
++ fi
++ rm -f conftest.*
+ fi
+ fi
+ test -z "$AR_FLAGS" && AR_FLAGS=cru
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,28 @@
+From d85e70a35bffa755fd3e9f4ccc6bf6c64953e85d Mon Sep 17 00:00:00 2001
+From: Alexander von Gluck IV <kallisti5@unixzen.com>
+Date: Thu, 2 Sep 2021 12:19:14 +0100
+Subject: [PATCH 2010/2018] Add support for the haiku operating system. These
+ are the os support patches we have been grooming and maintaining for quite a
+ few years over on git.haiku-os.org. All of these architectures are working
+ and most have been stable for quite some time.
+
+---
+ libtool.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 9a13f3b117a..f69fc99f691 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -2362,7 +2362,7 @@ haiku*)
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+- sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib'
++ sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+ hardcode_into_libs=yes
+ ;;
+
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,33 @@
+From bc4b1401129c755eb78d434ae88605478f4299f1 Mon Sep 17 00:00:00 2001
+From: Nick Alcock <nick.alcock@oracle.com>
+Date: Mon, 27 Sep 2021 20:31:21 +0100
+Subject: [PATCH 2011/2018] libtool.m4: augment symcode for Solaris 11
+
+This reports common symbols like GNU nm, via a type code of 'C'.
+
+ChangeLog
+2021-09-27 Nick Alcock <nick.alcock@oracle.com>
+
+ PR libctf/27967
+ * libtool.m4 (lt_cv_sys_global_symbol_pipe): Augment symcode for
+ Solaris 11.
+---
+ libtool.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index f69fc99f691..7a711249304 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -3395,7 +3395,7 @@ osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+ solaris*)
+- symcode='[[BDRT]]'
++ symcode='[[BCDRT]]'
+ ;;
+ sco3.2v5*)
+ symcode='[[DT]]'
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,161 @@
+From bef9ef8ca0f941d743c77cc55b5fe7985990b2a7 Mon Sep 17 00:00:00 2001
+From: Nick Alcock <nick.alcock@oracle.com>
+Date: Mon, 27 Sep 2021 20:31:21 +0100
+Subject: [PATCH 2012/2018] libtool.m4: fix nm BSD flag detection
+
+Libtool needs to get BSD-format (or MS-format) output out of the system
+nm, so that it can scan generated object files for symbol names for
+-export-symbols-regex support. Some nms need specific flags to turn on
+BSD-formatted output, so libtool checks for this in its AC_PATH_NM.
+Unfortunately the code to do this has a pair of interlocking flaws:
+
+ - it runs the test by doing an nm of /dev/null. Some platforms
+ reasonably refuse to do an nm on a device file, but before now this
+ has only been worked around by assuming that the error message has a
+ specific textual form emitted by Tru64 nm, and that getting this
+ error means this is Tru64 nm and that nm -B would work to produce
+ BSD-format output, even though the test never actually got anything
+ but an error message out of nm -B. This is fixable by nm'ing *nm
+ itself* (since we necessarily have a path to it).
+
+ - the test is entirely skipped if NM is set in the environment, on the
+ grounds that the user has overridden the test: but the user cannot
+ reasonably be expected to know that libtool wants not only nm but
+ also flags forcing BSD-format output. Worse yet, one such "user" is
+ the top-level Cygnus configure script, which neither tests for
+ nor specifies any BSD-format flags. So platforms needing BSD-format
+ flags always fail to set them when run in a Cygnus tree, breaking
+ -export-symbols-regex on such platforms. Libtool also needs to
+ augment $LD on some platforms, but this is done unconditionally,
+ augmenting whatever the user specified: the nm check should do the
+ same.
+
+ One wrinkle: if the user has overridden $NM, a path might have been
+ provided: so we use the user-specified path if there was one, and
+ otherwise do the path search as usual. (If the nm specified doesn't
+ work, this might lead to a few extra pointless path searches -- but
+ the test is going to fail anyway, so that's not a problem.)
+
+(Tested with NM unset, and set to nm, /usr/bin/nm, my-nm where my-nm is a
+symlink to /usr/bin/nm on the PATH, and /not-on-the-path/my-nm where
+*that* is a symlink to /usr/bin/nm.)
+
+ChangeLog
+2021-09-27 Nick Alcock <nick.alcock@oracle.com>
+
+ PR libctf/27967
+ * libtool.m4 (LT_PATH_NM): Try BSDization flags with a user-provided
+ NM, if there is one. Run nm on itself, not on /dev/null, to avoid
+ errors from nms that refuse to work on non-regular files. Remove
+ other workarounds for this problem. Strip out blank lines from the
+ nm output.
+---
+ libtool.m4 | 88 ++++++++++++++++++++++++++++--------------------------
+ 1 file changed, 45 insertions(+), 43 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 7a711249304..a216bb14e99 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -3200,53 +3200,55 @@ _LT_DECL([], [file_magic_cmd], [1],
+
+ # LT_PATH_NM
+ # ----------
+-# find the pathname to a BSD- or MS-compatible name lister
++# find the pathname to a BSD- or MS-compatible name lister, and any flags
++# needed to make it compatible
+ AC_DEFUN([LT_PATH_NM],
+ [AC_REQUIRE([AC_PROG_CC])dnl
+ AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+ [if test -n "$NM"; then
+- # Let the user override the test.
+- lt_cv_path_NM="$NM"
+-else
+- lt_nm_to_check="${ac_tool_prefix}nm"
+- if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+- lt_nm_to_check="$lt_nm_to_check nm"
+- fi
+- for lt_tmp_nm in $lt_nm_to_check; do
+- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+- for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+- IFS="$lt_save_ifs"
+- test -z "$ac_dir" && ac_dir=.
+- tmp_nm="$ac_dir/$lt_tmp_nm"
+- if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+- # Check to see if the nm accepts a BSD-compat flag.
+- # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+- # nm: unknown option "B" ignored
+- # Tru64's nm complains that /dev/null is an invalid object file
+- case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+- */dev/null* | *'Invalid file or object type'*)
+- lt_cv_path_NM="$tmp_nm -B"
+- break
+- ;;
+- *)
+- case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+- */dev/null*)
+- lt_cv_path_NM="$tmp_nm -p"
+- break
+- ;;
+- *)
+- lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+- continue # so that we can try to find one that supports BSD flags
+- ;;
+- esac
+- ;;
+- esac
+- fi
+- done
+- IFS="$lt_save_ifs"
+- done
+- : ${lt_cv_path_NM=no}
+-fi])
++ # Let the user override the nm to test.
++ lt_nm_to_check="$NM"
++ else
++ lt_nm_to_check="${ac_tool_prefix}nm"
++ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
++ lt_nm_to_check="$lt_nm_to_check nm"
++ fi
++ fi
++ for lt_tmp_nm in $lt_nm_to_check; do
++ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
++ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
++ IFS="$lt_save_ifs"
++ test -z "$ac_dir" && ac_dir=.
++ case "$lt_tmp_nm" in
++ */*|*\\*) tmp_nm="$lt_tmp_nm";;
++ *) tmp_nm="$ac_dir/$lt_tmp_nm";;
++ esac
++ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
++ # Check to see if the nm accepts a BSD-compat flag.
++ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
++ # nm: unknown option "B" ignored
++ case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
++ *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
++ break
++ ;;
++ *)
++ case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
++ *$tmp_nm*)
++ lt_cv_path_NM="$tmp_nm -p"
++ break
++ ;;
++ *)
++ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
++ continue # so that we can try to find one that supports BSD flags
++ ;;
++ esac
++ ;;
++ esac
++ fi
++ done
++ IFS="$lt_save_ifs"
++ done
++ : ${lt_cv_path_NM=no}])
+ if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+ else
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,99 @@
+From caf606c90d55305967b9253447dda93d2f1835ab Mon Sep 17 00:00:00 2001
+From: Nick Alcock <nick.alcock@oracle.com>
+Date: Fri, 3 Dec 2021 16:33:25 +0000
+Subject: [PATCH 2013/2018] libtool.m4: fix the NM="/nm/over/here
+ -B/option/with/path" case
+
+My previous nm patch handled all cases but one -- if the user set NM in
+the environment to a path which contained an option, libtool's nm
+detection tries to run nm against a copy of nm with the options in it:
+e.g. if NM was set to "nm --blargle", and nm was found in /usr/bin, the
+test would try to run "/usr/bin/nm --blargle /usr/bin/nm --blargle".
+This is unlikely to be desirable: in this case we should run
+"/usr/bin/nm --blargle /usr/bin/nm".
+
+Furthermore, as part of this nm has to detect when the passed-in $NM
+contains a path, and in that case avoid doing a path search itself.
+This too was thrown off if an option contained something that looked
+like a path, e.g. NM="nm -B../prev-gcc"; libtool then tries to run
+"nm -B../prev-gcc nm" which rarely works well (and indeed it looks
+to see whether that nm exists, finds it doesn't, and wrongly concludes
+that nm -p or whatever does not work).
+
+Fix all of these by clipping all options (defined as everything
+including and after the first " -") before deciding whether nm
+contains a path (but not using the clipped value for anything else),
+and then removing all options from the path-modified nm before
+looking to see whether that nm existed.
+
+NM=my-nm now does a path search and runs e.g.
+ /usr/bin/my-nm -B /usr/bin/my-nm
+
+NM=/usr/bin/my-nm now avoids a path search and runs e.g.
+ /usr/bin/my-nm -B /usr/bin/my-nm
+
+NM="my-nm -p../wombat" now does a path search and runs e.g.
+ /usr/bin/my-nm -p../wombat -B /usr/bin/my-nm
+
+NM="../prev-binutils/new-nm -B../prev-gcc" now avoids a path search:
+ ../prev-binutils/my-nm -B../prev-gcc -B ../prev-binutils/my-nm
+
+This seems to be all combinations, including those used by GCC bootstrap
+(which, before this commit, fails to bootstrap when configured
+--with-build-config=bootstrap-lto, because the lto plugin is now using
+--export-symbols-regex, which requires libtool to find a working nm,
+while also using -B../prev-gcc to point at the lto plugin associated
+with the GCC just built.)
+
+Regenerate all affected configure scripts.
+
+ * libtool.m4 (LT_PATH_NM): Handle user-specified NM with
+ options, including options containing paths.
+---
+ libtool.m4 | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index a216bb14e99..ad63ebbb385 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -3214,25 +3214,31 @@ AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ fi
+- for lt_tmp_nm in $lt_nm_to_check; do
++ for lt_tmp_nm in "$lt_nm_to_check"; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+- case "$lt_tmp_nm" in
++ # Strip out any user-provided options from the nm to test twice,
++ # the first time to test to see if nm (rather than its options) has
++ # an explicit path, the second time to yield a file which can be
++ # nm'ed itself.
++ tmp_nm_path="`$ECHO "$lt_tmp_nm" | sed 's, -.*$,,'`"
++ case "$tmp_nm_path" in
+ */*|*\\*) tmp_nm="$lt_tmp_nm";;
+ *) tmp_nm="$ac_dir/$lt_tmp_nm";;
+ esac
+- if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
++ tmp_nm_to_nm="`$ECHO "$tmp_nm" | sed 's, -.*$,,'`"
++ if test -f "$tmp_nm_to_nm" || test -f "$tmp_nm_to_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+- case `"$tmp_nm" -B "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
++ case `"$tmp_nm" -B "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+ *$tmp_nm*) lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+- case `"$tmp_nm" -p "$tmp_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
++ case `"$tmp_nm" -p "$tmp_nm_to_nm" 2>&1 | grep -v '^ *$' | sed '1q'` in
+ *$tmp_nm*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,73 @@
+From 047b13da37d308778c91bfb744e8d695e56af77d Mon Sep 17 00:00:00 2001
+From: Iain Sandoe <iain@sandoe.co.uk>
+Date: Mon, 7 Aug 2023 13:07:09 +0200
+Subject: [PATCH 2014/2018] Darwin : Update libtool and dependencies for
+ Darwin20 [PR97865]
+
+The change in major version (and the increment from Darwin19 to 20)
+caused libtool tests to fail which resulted in incorrect build settings
+for shared libraries.
+
+ PR target/97865
+ * libtool.m4: Update handling of Darwin platform link flags
+ for Darwin20.
+---
+ libtool.m4 | 32 +++++++++++++++++---------------
+ 1 file changed, 17 insertions(+), 15 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index ad63ebbb385..cb502dabe83 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -994,23 +994,25 @@ _LT_EOF
+ rm -f conftest.err libconftest.a conftest conftest.c
+ rm -rf conftest.dSYM
+ ])
+- case $host_os in
+- rhapsody* | darwin1.[[012]])
++ # Allow for Darwin 4-7 (macOS 10.0-10.3) although these are not expect to
++ # build without first building modern cctools / linker.
++ case $host_cpu-$host_os in
++ *-rhapsody* | *-darwin1.[[012]])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+- darwin1.*)
++ *-darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+- darwin*) # darwin 5.x on
+- # if running on 10.5 or later, the deployment target defaults
+- # to the OS version, if on x86, and 10.4, the deployment
+- # target defaults to 10.4. Don't you love it?
+- case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+- 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
++ *-darwin*)
++ # darwin 5.x (macOS 10.1) onwards we only need to adjust when the
++ # deployment target is forced to an earlier version.
++ case ${MACOSX_DEPLOYMENT_TARGET-UNSET},$host in
++ UNSET,*-darwin[[89]]*|UNSET,*-darwin[[12]][[0123456789]]*)
++ ;;
+ 10.[[012]][[,.]]*)
+- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+- 10.*)
+- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+- esac
++ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
++ ;;
++ *)
++ ;;
++ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+@@ -1033,7 +1035,7 @@ _LT_EOF
+
+ # _LT_DARWIN_LINKER_FEATURES
+ # --------------------------
+-# Checks for linker and compiler features on darwin
++# Checks for linker and compiler features on Darwin / macOS / iOS
+ m4_defun([_LT_DARWIN_LINKER_FEATURES],
+ [
+ m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,81 @@
+From f34b00a4362dd9bd6a05ca796d40e42656291d23 Mon Sep 17 00:00:00 2001
+From: Olivier Hainque <hainque@adacore.com>
+Date: Mon, 7 Aug 2023 13:07:33 +0200
+Subject: [PATCH 2015/2018] Generic configury support for shared libs on
+ VxWorks
+
+This change adds the configury bits to activate the build of
+shared libs on VxWorks ports configured with --enable-shared,
+for libraries variants where this is generally supported (rtp,
+code model !large - currently not compatible with -fPIC).
+
+Set lt_cv_deplibs_check_method in libtool.m4, so the build of
+libraries know how to establish dependencies. This is useful in
+configurations such as aarch64 where proper support of LSE relies
+on accurate dependency information between libstdc++ and libgcc_s
+to begin with.
+
+ * libtool.m4 (*vxworks*): When enable_shared, set dynamic_linker
+ and friends for rtp !large. Assume the linker has the required
+ abilities and set lt_cv_deplibs_check_method.
+---
+ libtool.m4 | 29 +++++++++++++++++++++++++++--
+ 1 file changed, 27 insertions(+), 2 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index cb502dabe83..8c8399f600e 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -2700,6 +2700,25 @@ uts4*)
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
++# Shared libraries for VwWorks, >= 7 only at this stage
++# and (fpic) still incompatible with "large" code models
++# in a few configurations. Only for RTP mode in any case,
++# and upon explicit request at configure time.
++vxworks7*)
++ dynamic_linker=no
++ case ${with_multisubdir}-${enable_shared} in
++ *large*)
++ ;;
++ *mrtp*-yes)
++ version_type=linux
++ need_lib_prefix=no
++ need_version=no
++ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
++ soname_spec='${libname}${release}${shared_ext}$major'
++ dynamic_linker="$host_os module_loader"
++ ;;
++ esac
++ ;;
+ *)
+ dynamic_linker=no
+ ;;
+@@ -3187,6 +3206,11 @@ sysv4 | sysv4.3*)
+ tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
++vxworks*)
++ # Assume VxWorks cross toolchains are built on Linux, possibly
++ # as canadian for Windows hosts.
++ lt_cv_deplibs_check_method=pass_all
++ ;;
+ esac
+ ])
+ file_magic_cmd=$lt_cv_file_magic_cmd
+@@ -6429,8 +6453,9 @@ if test "$_lt_caught_CXX_error" != yes; then
+ ;;
+
+ vxworks*)
+- # FIXME: insert proper C++ library support
+- _LT_TAGVAR(ld_shlibs, $1)=no
++ # For VxWorks ports, we assume the use of a GNU linker with
++ # standard elf conventions.
++ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ *)
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,58 @@
+From a55212c34e401e667808d0bf0a2f6b6b9f8db3ed Mon Sep 17 00:00:00 2001
+From: John David Anglin <danglin@gcc.gnu.org>
+Date: Mon, 7 Aug 2023 13:07:34 +0200
+Subject: [PATCH 2016/2018] Fix hppa64-hpux11 build to remove source paths from
+ embedded path.
+
+This change adds the +nodefaultrpath ld option to remove all library
+paths that were specified with the -L option from the embedded path.
+
+ * libtool.m4 (archive_cmds): Add +nodefaultrpath ld option on
+ hppa64-*-hpux11*.
+---
+ libtool.m4 | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 8c8399f600e..7d0593ae340 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -4927,7 +4927,7 @@ _LT_EOF
+ if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+- _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+@@ -4939,7 +4939,7 @@ _LT_EOF
+ else
+ case $host_cpu in
+ hppa*64*)
+- _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
++ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+@@ -5916,7 +5916,7 @@ if test "$_lt_caught_CXX_error" != yes; then
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+- _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
++ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+@@ -5940,7 +5940,7 @@ if test "$_lt_caught_CXX_error" != yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,44 @@
+From 14af24e0a83bbda49e26fc8af7c06cfe39611add Mon Sep 17 00:00:00 2001
+From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
+Date: Mon, 7 Aug 2023 13:07:35 +0200
+Subject: [PATCH 2017/2018] libtool.m4: Sort output of 'find' to enable
+ deterministic builds.
+
+ * libtool.m4: Sort output of 'find' to enable deterministic builds.
+ * ltmain.sh: Likewise.
+---
+ libtool.m4 | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 7d0593ae340..1f726c93c8c 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -6059,20 +6059,20 @@ if test "$_lt_caught_CXX_error" != yes; then
+ _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+- compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
++ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+ _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+- $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
++ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+ $RANLIB $oldlib'
+ _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
++ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
++ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ *) # Version 6 and above use weak symbols
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,53 @@
+From 445ae0cf004aeb0d0f9eadd407dbcfe11b745a9f Mon Sep 17 00:00:00 2001
+From: Christophe Lyon <christophe.lyon@st.com>
+Date: Mon, 7 Aug 2023 13:07:36 +0200
+Subject: [PATCH 2018/2018] FDPIC: Handle arm*-*-uclinuxfdpiceabi in configure
+ scripts
+
+In libtool.m4, we use uclinuxfdpiceabi in cases where ELF shared
+libraries support is required, as uclinux does not guarantee that.
+
+ * libtool.m4: Handle uclinuxfdpiceabi.
+---
+ libtool.m4 | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/libltdl/m4/libtool.m4 b/libltdl/m4/libtool.m4
+index 1f726c93c8c..e36fdd3c0e2 100644
+--- a/libltdl/m4/libtool.m4
++++ b/libltdl/m4/libtool.m4
+@@ -2471,7 +2471,12 @@ linux*oldld* | linux*aout* | linux*coff*)
+ ;;
+
+ # This must be Linux ELF.
+-linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
++
++# uclinux* changes (here and below) have been submitted to the libtool
++# project, but have not yet been accepted: they are GCC-local changes
++# for the time being. (See
++# https://lists.gnu.org/archive/html/libtool-patches/2018-05/msg00000.html)
++linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu* | uclinuxfdpiceabi)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+@@ -3130,7 +3135,7 @@ irix5* | irix6* | nonstopux*)
+ ;;
+
+ # This must be Linux ELF.
+-linux* | k*bsd*-gnu | kopensolaris*-gnu)
++linux* | k*bsd*-gnu | kopensolaris*-gnu | uclinuxfdpiceabi)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+@@ -4503,7 +4508,7 @@ _LT_EOF
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+- gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
++ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu | uclinuxfdpiceabi)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,24 @@
+# The 0XXX-*.patch series was created basically manually.
+
+# The 1XXX-*.patch series was extracted from the binutils-gdb.git
+# history with the commands:
+
+rm -f bootstrap.d/libtool-patches/1???-*.patch
+git format-patch --output-directory=bootstrap.d/libtool-patches \
+ --start-number=1000 \
+ --src-prefix=a/libltdl/config/ \
+ --dst-prefix=b/libltdl/config/ \
+ 3725885a6563fe9c77b251ab5328633279fdeafa..af5478e1f3cee5741f68377eb5d60cdcf05ca858 \
+ -- ltmain.sh
+sed -i 's/ltmain\.sh/ltmain.m4sh/g' bootstrap.d/libtool-patches/1*.patch
+
+# The 2XXX-*.patch series was extracted from the binutils-gdb.git
+# history with the commands:
+
+rm -f bootstrap.d/libtool-patches/2???-*.patch
+git format-patch --output-directory=bootstrap.d/libtool-patches \
+ --start-number=2000 \
+ --src-prefix=a/libltdl/m4/ \
+ --dst-prefix=b/libltdl/m4/ \
+ 3725885a6563fe9c77b251ab5328633279fdeafa..89bd22ef5b7fec9ac9e760de276781b181f58ee0 \
+ -- libtool.m4
new file mode 100644
@@ -0,0 +1,830 @@
+diff --git a/config/ChangeLog b/config/ChangeLog
+index b42f2bc2e08..d14ec0f9a82 100644
+--- a/config/ChangeLog
++++ b/config/ChangeLog
+@@ -1,137 +1,18 @@
+-2023-08-11 Joseph Myers <joseph@codesourcery.com>
++2022-12-31 Nick Clifton <nickc@redhat.com>
+
+- * gcc-plugin.m4 (GCC_ENABLE_PLUGINS): Use
+- export_sym_check="$ac_cv_prog_OBJDUMP -T" also when host is not
+- build or target.
++ * 2.40 branch created.
+
+-2023-08-07 H.J. Lu <hjl.tools@gmail.com>
++2022-07-08 Nick Clifton <nickc@redhat.com>
+
+- * pkg.m4 (PKG_CHECK_MODULES): Use AC_TRY_LINK only if
+- $pkg_failed = no.
+-
+-2023-08-07 H.J. Lu <hjl.tools@gmail.com>
+-
+- * pkg.m4 (PKG_CHECK_MODULES): Add AC_TRY_LINK to check if
+- $pkg_cv_[]$1[]_LIBS works.
+-
+-2023-08-07 John Ericson <git@JohnEricson.me>
+-
+- * picflag.m4: Simplify SHmedia NetBSD match by presuming ELF.
+-
+-2023-08-07 Alan Modra <amodra@gmail.com>
+-
+- * override.m4: Correct comment grammar.
+-
+-2023-08-07 Alan Modra <amodra@gmail.com>
+-
+- * lib-ld.m4 (AC_LIB_PROG_LD_GNU): Require AC_PROG_EGREP and
+- invoke $EGREP.
+- (AC_LIB_PROG_LD): Likewise.
+-
+-2023-08-07 Christophe Lyon <christophe.lyon@arm.com>
+-
+- * zstd.m4: Add minimum version requirement of 1.4.0.
+-
+-2023-08-07 Fangrui Song <maskray@google.com>
+-
+- * zstd.m4: New file.
+-
+-2023-08-07 H.J. Lu <hjl.tools@gmail.com>
+-
+- * gcc-plugin.m4 (GCC_PLUGIN_OPTION): Check if AR works with
+- --plugin and rc before enabling --plugin.
+-
+-2023-08-07 H.J. Lu <hjl.tools@gmail.com>
+-
+- * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
+-
+-2023-07-21 Sergei Trofimovich <siarheit@google.com>
+-
+- * mh-mingw: Drop assignment of unused BOOT_CXXFLAGS variable.
+-
+-2022-11-14 Martin Liska <mliska@suse.cz>
+-
+- Revert:
+- 2022-11-09 Martin Liska <mliska@suse.cz>
+-
+- * acx.m4: Do not wrap REPORT_BUGS_TO.
+-
+-2022-11-09 Martin Liska <mliska@suse.cz>
+-
+- * acx.m4: Do not wrap REPORT_BUGS_TO.
+-
+-2022-10-19 LIU Hao <lh_mouse@126.com>
+-
+- * gthr.m4 (GCC_AC_THREAD_HEADER): Add new case for `mcf` thread
+- model
+-
+-2022-08-31 Martin Liska <mliska@suse.cz>
+-
+- * mh-pa-hpux10: Removed.
+-
+-2022-08-01 Roger Sayle <roger@nextmovesoftware.com>
+- Arnaud Charlet <charlet@adacore.com>
+-
+- * acx.m4 (AC_PROG_GNAT): Update conftest.adb to include
+- features required of the host gnat compiler.
+-
+-2022-06-01 David Seifert <soap@gentoo.org>
+-
+- PR plugins/95648
+- * gcc-plugin.m4: Use libtool's $ac_cv_prog_OBJDUMP.
+-
+-2022-05-20 Christophe Lyon <christophe.lyon@arm.com>
+-
+- * dfp.m4: Add aarch64 support.
+-
+-2022-05-03 Christophe Lyon <christophe.lyon@arm.com>
+-
+- * dfp.m4: Add license header.
+-
+-2022-03-29 Chenghua Xu <xuchenghua@loongson.cn>
+- Lulu Cheng <chenglulu@loongson.cn>
+-
+- * picflag.m4: Default add build option '-fpic' for LoongArch.
+-
+-2021-12-21 Iain Buclaw <ibuclaw@gdcproject.org>
+-
+- PR d/103528
+- * acx.m4 (ACX_PROG_GDC): Add check whether D compiler works.
+-
+-2021-12-16 H.J. Lu <hjl.tools@gmail.com>
++ * 2.39 branch created.
+
+- Revert:
+- 2021-12-16 H.J. Lu <hjl.tools@gmail.com>
+-
+- * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
+-
+-2021-12-15 H.J. Lu <hjl.tools@gmail.com>
+-
+- * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
+-
+-2021-12-15 Iain Sandoe <iain@sandoe.co.uk>
+-
+- * gcc-plugin.m4: Save and process CXXFLAGS.
+-
+-2021-11-30 Iain Buclaw <ibuclaw@gdcproject.org>
+-
+- * acx.m4 (ACX_PROG_GDC): New m4 function.
+-
+-2021-09-19 Andrew Pinski <apinski@marvell.com>
+-
+- PR bootstrap/102389
+- * bootstrap-lto-lean.mk: Handle NM like RANLIB AND AR.
+- * bootstrap-lto.mk: Likewise.
++2022-01-22 Nick Clifton <nickc@redhat.com>
+
+-2021-08-18 Iain Sandoe <iain@sandoe.co.uk>
++ * 2.38 release branch created.
+
+- * mh-darwin: Require a non-shared host configuration to
+- enable mdynamic-no-pic where that is supported.
++2021-07-03 Nick Clifton <nickc@redhat.com>
+
+-2021-07-09 Iain Sandoe <iain@sandoe.co.uk>
+-
+- * mh-darwin: Make this specific to handling the
+- mdynamic-no-pic case.
++ * 2.37 release branch created.
+
+ 2021-06-14 Michael Forney <mforney@mforney.org>
+
+@@ -144,39 +25,48 @@
+
+ * acinclude.m4 (CYG_AC_PATH_SIM, CYG_AC_PATH_DEVO): Delete.
+
+-2021-05-03 H.J. Lu <hjl.tools@gmail.com>
++2021-03-18 H.J. Lu <hongjiu.lu@intel.com>
+
+- PR bootstrap/99703
++ PR binutils/27397
+ * cet.m4 (GCC_CET_HOST_FLAGS): Check if host supports multi-byte
+ NOPs.
+
+-2021-04-13 Martin Storsjö <martin@martin.st>
++2021-02-13 Mike Frysinger <vapier@gentoo.org>
++
++ * debuginfod.m4: Delete m4_include(../config/pkg.m4).
++
++2021-01-12 H.J. Lu <hongjiu.lu@intel.com>
+
+- * mh-mingw: Set __USE_MINGW_ACCESS in missed C++ flags
+- variables
++ PR binutils/26792
++ * jobserver.m4: New file.
+
+-2021-01-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
++2021-01-11 H.J. Lu <hongjiu.lu@intel.com>
++
++ PR ld/27173
++ * gcc-plugin.m4 (GCC_PLUGIN_OPTION): Check if AR works with
++ --plugin and rc before enabling --plugin.
+
+- PR c++/98316
+- * ax_lib_socket_nsl.m4: Import from autoconf-archive.
++2021-01-09 H.J. Lu <hongjiu.lu@intel.com>
+
+-2021-01-03 Mike Frysinger <vapier@gentoo.org>
++ * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.
+
+- * pkg.m4: New file from pkg-config-0.29.2.
++2021-01-09 Nick Clifton <nickc@redhat.com>
+
+-2020-11-25 Matthew Malcomson <matthew.malcomson@arm.com>
++ * 2.36 release branch crated.
+
+- * bootstrap-hwasan.mk: Disable random frame tags for stack-tagging
+- during bootstrap.
++2021-01-01 Nicolas Boulenguez <nicolas@debian.org>
+
+-2020-11-25 Matthew Malcomson <matthew.malcomson@arm.com>
++ * override.m4: Correct comment grammar.
+
+- * bootstrap-hwasan.mk: New file.
++2020-09-08 Alan Modra <amodra@gmail.com>
+
+-2020-09-09 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
++ Sync from gcc
++ 2020-07-15 H.J. Lu <hjl.tools@gmail.com>
++ PR bootstrap/96202
++ * cet.m4 (GCC_CET_HOST_FLAGS): Don't enable CET without CET
++ support in stage1 nor for build support.
+
+- Sync from binutils-gdb.
+- 2020-07-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
++2020-07-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * largefile.m4 (ACX_LARGEFILE) <sparc-*-solaris*|i?86-*-solaris*>:
+ Check for <sys/procfs.h> incompatilibity with large-file support
+@@ -184,195 +74,188 @@
+ Only disable large-file support and perhaps plugins if needed.
+ Set, substitute LARGEFILE_CPPFLAGS if so.
+
+-2020-08-20 Tobias Burnus <tobias@codesourcery.com>
++2020-07-28 H.J. Lu <hongjiu.lu@intel.com>
+
+- PR bootstrap/96612
+- * ax_cxx_compile_stdcxx.m4: Add fourth argument to check also
+- the CXX_FOR_BUILD compiler.
++ PR binutils/26301
++ * pkg.m4 (PKG_CHECK_MODULES): Use AC_TRY_LINK only if
++ $pkg_failed = no.
+
+-2020-07-30 H.J. Lu <hjl.tools@gmail.com>
++2020-07-28 H.J. Lu <hongjiu.lu@intel.com>
+
+- PR bootstrap/96202
+- * cet.m4 (GCC_CET_HOST_FLAGS): Don't enable CET without CET
+- support in stage1 nor for build support.
++ PR binutils/26301
++ * pkg.m4 (PKG_CHECK_MODULES): Add AC_TRY_LINK to check if
++ $pkg_cv_[]$1[]_LIBS works.
++
++2020-07-24 Aaron Merey <amerey@redhat.com>
++
++ * debuginfod.m4: use PKG_CHECK_MODULES.
++ * pkg.m4: New file.
++
++2020-07-04 Nick Clifton <nickc@redhat.com>
++
++ Binutils 2.35 branch created.
++
++2020-06-24 H.J. Lu <hongjiu.lu@intel.com>
+
+-2020-05-29 H.J. Lu <hjl.tools@gmail.com>
++ Sync with GCC
++ 2020-05-29 H.J. Lu <hjl.tools@gmail.com>
+
+ PR bootstrap/95413
+ * cet.m4: Replace save_CFLAGS and save_LDFLAGS with
+ cet_save_CFLAGS and cet_save_LDFLAGS.
+
+-2020-05-18 Jason Merrill <jason@redhat.com>
++2020-05-16 H.J. Lu <hongjiu.lu@intel.com>
+
+- * ax_cxx_compile_stdcxx.m4: Import from autoconf archive with
+- an adjustment to try the default mode.
+-
+-2020-05-15 H.J. Lu <hongjiu.lu@intel.com>
++ Sync with GCC
++ 2020-05-15 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR bootstrap/95147
+ * cet.m4 (GCC_CET_FLAGS): Also check if -fcf-protection works
+ when defaulting to auto.
+
+-2020-05-14 H.J. Lu <hongjiu.lu@intel.com>
++ 2020-05-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * cet.m4 (GCC_CET_FLAGS): Change default to auto.
+
+ 2020-05-12 H.J. Lu <hongjiu.lu@intel.com>
+
++ Sync with GCC
++ 2020-05-12 H.J. Lu <hongjiu.lu@intel.com>
++
+ PR bootstrap/94998
+ * cet.m4 (GCC_CET_HOST_FLAGS): Enable CET in cross compiler if
+ possible.
+
+-2020-04-28 H.J. Lu <hongjiu.lu@intel.com>
++2020-04-29 H.J. Lu <hongjiu.lu@intel.com>
++
++ Sync with GCC
++ 2020-04-28 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR bootstrap/94739
+ * cet.m4 (GCC_CET_HOST_FLAGS): Add -fcf-protection=none to
+ -Wl,-z,ibt,-z,shstk. Check whether -fcf-protection=none
+ -Wl,-z,ibt,-z,shstk works first.
+
+-2020-04-25 H.J. Lu <hongjiu.lu@intel.com>
++ 2020-04-25 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR bootstrap/94739
+ * cet.m4 (GCC_CET_HOST_FLAGS): New.
+
+-2020-04-22 Jakub Jelinek <jakub@redhat.com>
++ 2020-04-22 Jakub Jelinek <jakub@redhat.com>
+
+ PR libfortran/94694
+ PR libfortran/94586
+ * math.m4 (GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK1,
+ GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK2): New.
+
+-2020-02-12 Sandra Loosemore <sandra@codesourcery.com>
+-
+- PR libstdc++/79193
+- PR libstdc++/88999
+- * no-executables.m4: Use a non-empty program to test for linker
+- support.
+-
+-2020-02-01 Andrew Burgess <andrew.burgess@embecosm.com>
+-
+- * lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Update shell syntax.
+-
+-2020-01-27 Andrew Burgess <andrew.burgess@embecosm.com>
+-
+- * lib-link.m4 (AC_LIB_LINKFLAGS_BODY): Add new
+- --with-libXXX-type=... option. Use this to guide the selection of
+- either a shared library or a static library.
+-
+-2020-01-24 Maciej W. Rozycki <macro@wdc.com>
+-
+- * toolexeclibdir.m4: New file.
+-
+-2019-09-10 Christophe Lyon <christophe.lyon@st.com>
+-
+- * futex.m4: Handle *-uclinux*.
+- * tls.m4 (GCC_CHECK_TLS): Likewise.
++2020-02-19 Andrew Burgess <andrew.burgess@embecosm.com>
+
+-2019-09-06 Florian Weimer <fweimer@redhat.com>
++ * ax_count_cpus.m4: New file, backported from GCC.
++ * bootstrap-Og.mk: New file, backported from GCC.
++ * bootstrap-lto-lean.mk: New file, backported from GCC.
++ * bootstrap-lto.mk: Changes backported from GCC.
++ * futex.m4: Changes backported from GCC.
++ * gthr.m4: Changes backported from GCC.
++ * lib-link.m4: Changes backported from GCC.
++ * mh-mingw: Changes backported from GCC.
++ * no-executables.m4: Changes backported from GCC.
++ * tls.m4: Changes backported from GCC.
++ * toolexeclibdir.m4: New file, backported from GCC.
+
+- * futex.m4 (GCC_LINUX_FUTEX): Include <unistd.h> for the syscall
+- function.
++2020-01-18 Nick Clifton <nickc@redhat.com>
+
+-2019-07-08 Richard Sandiford <richard.sandiford@arm.com>
++ Binutils 2.34 branch created.
+
+- * bootstrap-Og.mk: New file.
++2019-09-09 Phil Blundell <pb@pbcl.net>
+
+-2019-06-25 Kwok Cheung Yeung <kcy@codesourcery.com>
+- Andrew Stubbs <ams@codesourcery.com>
++ binutils 2.33 branch created.
+
+- * gthr.m4 (GCC_AC_THREAD_HEADER): Add case for gcn.
++2018-06-24 Nick Clifton <nickc@redhat.com>
+
+-2019-05-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
++ 2.32 branch created.
+
+- * ax_count_cpus.m4: New file.
++2018-11-09 Hafiz Abid Qadeer <abidh@codesourcery.com>
+
+-2019-05-02 Richard Biener <rguenther@suse.de>
++ * iconv.m4 (AM_ICONV_LINK): Don't overwrite CPPFLAGS.
++ Append $INCICONV to it.
+
+- PR bootstrap/85574
+- * bootstrap-lto.mk (extra-compare): Set to gcc/lto1$(exeext).
+-
+-2019-04-16 Martin Liska <mliska@suse.cz>
+-
+- * bootstrap-lto-lean.mk: Filter out -flto in STAGEtrain_CFLAGS.
+-
+-2019-04-09 Martin Liska <mliska@suse.cz>
++2018-10-31 Joseph Myers <joseph@codesourcery.com>
+
+- * bootstrap-lto-lean.mk: New file.
++ Merge from GCC:
++ 2018-10-28 Iain Buclaw <ibuclaw@gdcproject.org>
+
+-2019-03-02 Johannes Pfau <johannespfau@gmail.com>
++ * multi.m4: Set GDC.
+
+- * mh-mingw: Also set __USE_MINGW_ACCESS flag for C++ code.
++ 2018-07-05 James Clarke <jrtc27@jrtc27.com>
+
+-2018-10-31 Joseph Myers <joseph@codesourcery.com>
++ * dfp.m4 (enable_decimal_float): Enable for x86_64*-*-gnu* to
++ catch x86_64 kFreeBSD and Hurd.
+
++ Merge from GCC:
+ PR bootstrap/82856
+ * math.m4, tls.m4: Use AC_LANG_SOURCE.
+
+- Merge from binutils-gdb:
+- 2018-06-19 Simon Marchi <simon.marchi@ericsson.com>
++2018-06-19 Simon Marchi <simon.marchi@ericsson.com>
+
+ * override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.
+
+-2018-10-28 Iain Buclaw <ibuclaw@gdcproject.org>
+-
+- * multi.m4: Set GDC.
+-
+-2018-07-05 James Clarke <jrtc27@jrtc27.com>
++2018-06-18 Simon Marchi <simon.marchi@ericsson.com>
+
+- * dfp.m4 (enable_decimal_float): Enable for x86_64*-*-gnu* to
+- catch x86_64 kFreeBSD and Hurd.
+-
+-2018-06-08 Martin Liska <mliska@suse.cz>
++ Sync with GCC
++ 2018-06-08 Martin Liska <mliska@suse.cz>
+
+ * bootstrap-mpx.mk: Remove.
+
+-2018-05-10 Martin Liska <mliska@suse.cz>
++ 2018-05-10 Martin Liska <mliska@suse.cz>
+
+ PR bootstrap/64914
+ * bootstrap-ubsan.mk: Define UBSAN_BOOTSTRAP.
+
+-2018-05-09 Joshua Watt <jpewhacker@gmail.com>
++ 2018-05-09 Joshua Watt <jpewhacker@gmail.com>
+
+- * ax_pthread.m4: Add file.
++ * ax_pthread.m4: Add file.
+
+-2018-05-08 Richard Biener <rguenther@suse.de>
++ 2018-05-08 Richard Biener <rguenther@suse.de>
+
+ PR bootstrap/85571
+ * bootstrap-lto-noplugin.mk: Disable compare.
+ * bootstrap-lto.mk: Supply contrib/compare-lto for do-compare.
+
+-2018-04-24 H.J. Lu <hongjiu.lu@intel.com>
++ 2018-04-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR bootstrap/85490
+ * bootstrap-cet.mk (STAGE4_CFLAGS): New.
+
+-2018-04-24 H.J. Lu <hongjiu.lu@intel.com>
++ 2018-04-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/85485
+ * bootstrap-cet.mk (STAGE2_CFLAGS): Remove -mcet.
+ (STAGE3_CFLAGS): Likewise.
+
+-2018-04-24 H.J. Lu <hongjiu.lu@intel.com>
++ 2018-04-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/85485
+ * cet.m4 (GCC_CET_FLAGS): Replace -mcet with -mshstk.
+
+-2018-04-19 Jakub Jelinek <jakub@redhat.com>
++ 2018-04-19 Jakub Jelinek <jakub@redhat.com>
+
+ * cet.m4 (GCC_CET_FLAGS): Default to --disable-cet, replace
+ --enable-cet=default with --enable-cet=auto.
+
+-2018-04-18 David Malcolm <dmalcolm@redhat.com>
++ 2018-04-18 David Malcolm <dmalcolm@redhat.com>
+
+ PR jit/85384
+ * acx.m4 (GCC_BASE_VER): Remove \$\$ from sed expression.
+
+ 2018-04-05 H.J. Lu <hongjiu.lu@intel.com>
+
++ Sync with GCC
++ 2018-04-05 H.J. Lu <hongjiu.lu@intel.com>
++
+ PR gas/22318
+ * plugins.m4 (AC_PLUGINS): Use dlsym to check if libdl is needed.
+
+-2018-02-14 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
++ 2018-02-14 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
+
+ PR target/84148
+ * cet.m4: Check if target support multi-byte NOPS (SSE).
+@@ -381,125 +264,129 @@
+
+ * gcc-plugin.m4 (GCC_ENABLE_PLUGINS): Remove -q option passed to grep.
+
+-2017-11-14 Boris Kolpackov <boris@codesynthesis.com>
++2018-01-10 Nick Clifton <nickc@redhat.com>
++
++ * Sync with GCC sources:
++
++ 2017-11-14 Boris Kolpackov <boris@codesynthesis.com>
+
+ * gcc-plugin.m4: Add support for MinGW.
+
+-2017-11-17 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
++ 2017-11-17 Igor Tsimbalist <igor.v.tsimbalist@intel.com>
+
+ * cet.m4: New file.
+
+-2017-11-15 Alexandre Oliva <aoliva@redhat.com>
++ 2017-11-15 Alexandre Oliva <aoliva@redhat.com>
+
+ * bootstrap-debug-lean.mk (do-compare): Use the
+ contrib/compare-debug script.
+
+-2017-10-24 H.J. Lu <hongjiu.lu@intel.com>
++ 2017-10-24 H.J. Lu <hongjiu.lu@intel.com>
+
+ * bootstrap-cet.mk: New file.
+
+-2017-06-19 Martin Liska <mliska@suse.cz>
++ 2017-06-19 Martin Liska <mliska@suse.cz>
+
+ * bootstrap-lto-noplugin.mk: Enable -flto in all PGO stages.
+ * bootstrap-lto.mk: Likewise.
+
+-2017-06-03 Eric Botcazou <ebotcazou@adacore.com>
++ 2017-06-03 Eric Botcazou <ebotcazou@adacore.com>
+
+ * mt-android: New file.
+
+-2017-02-13 Richard Biener <rguenther@suse.de>
++ 2017-02-13 Richard Biener <rguenther@suse.de>
+
+ * isl.m4: Remove support for ISL 0.14.
+
+-2017-01-19 Uros Bizjak <ubizjak@gmail.com>
++ 2017-01-19 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/78478
+ * ax_check_define.m4: New file.
+
+-2017-01-17 Jakub Jelinek <jakub@redhat.com>
++ 2017-01-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR other/79046
+ * acx.m4 (GCC_BASE_VER): New m4 function.
+ (ACX_TOOL_DIRS): Require GCC_BASE_VER, for
+ --with-gcc-major-version-only use just major number from BASE-VER.
+
+-2017-01-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
++ 2017-01-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ PR go/78978
+ * hwcaps.m4 (GCC_CHECK_ASSEMBLER_HWCAP): New macro.
+
+-2017-01-04 Alan Modra <amodra@gmail.com>
+-
+- * picflag.m4: Remove stray \xA0 in comment.
+-
+-2016-12-12 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
++2017-01-05 Alan Modra <amodra@gmail.com>
+
+- * hwcaps.m4: New file.
++ * picflag.m4: Import from gcc.
+
+ 2016-12-08 Alan Modra <amodra@gmail.com>
+
+- * elf.m4: Revert 2016-06-21 change.
+- * picflag.m4: Likewise. Revert 2016-04-30 change too.
+- * override.m4 (AC_PROG_LEX): Import 2016-01-18 binutils fix
+- for PR binutils/19481.
++ * acx.m4: Import from gcc.
++ * bootstrap-asan.mk: Likewise.
++ * multi.m4: Likewise.
+
+-2016-12-02 Maxim Ostapenko <m.ostapenko@samsung.com>
++2016-01-18 Alan Modra <amodra@gmail.com>
+
+- * bootstrap-asan.mk: Replace LSAN_OPTIONS=detect_leaks=0 with
+- ASAN_OPTIONS=detect_leaks=0:use_odr_indicator=1.
++ PR binutils/19481
++ * override.m4 (AC_PROG_LEX): Define.
+
+-2016-12-01 Ma Jiang <ma.jiang@zte.com.cn>
++2015-10-21 Maxim Ostapenko <m.ostapenko@partner.samsung.com>
+
+- * acx.m4: Change "tail +16c" to "tail -c +17".
++ * bootstrap-asan.mk: Replace ASAN_OPTIONS=detect_leaks with
++ LSAN_OPTIONS=detect_leaks.
+
+-2016-12-01 Matthias Klose <doko@ubuntu.com>
++2015-08-24 Yaakov Selkowitz <yselkowi@redhat.com>
+
+- * pkg.m4: Remove.
++ * iconv.m4 (AM_ICONV_LINK): Use in-tree libiconv when present.
+
+-2016-11-30 Matthias Klose <doko@ubuntu.com>
++2015-07-27 H.J. Lu <hongjiu.lu@intel.com>
+
+- * pkg.m4: New file.
++ Sync with GCC
++ 2015-07-24 Micahel Darling <darlingm@gmail.com>
+
+-2016-11-15 Matthias Klose <doko@ubuntu.com>
++ PR other/66259
++ * gettext.m4: Reflects renaming of configure.in to configure.ac
++ * po.m4: Likewise
++ * stdint.m4: Likewise
++ * tcl.m4: Likewise
+
+- multi.m4: Don't set GCJ.
++2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
+
+-2016-06-21 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
++ Sync with GCC
++ 2015-05-13 Eric Botcazou <ebotcazou@adacore.com>
+
+- * elf.m4: Remove interix support.
+- * picflag.m4: Likewise.
++ * sjlj.m4: New file.
+
+-2016-04-30 Oleg Endo <olegendo@gcc.gnu.org>
++ 2015-05-04 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
+
+- * picflag.m4: Remove SH5 support.
++ * bitfields.m4: Change int to long long, and use bitfields of
++ width 1 instead of 0.
+
+-2015-10-21 Maxim Ostapenko <m.ostapenko@partner.samsung.com>
++ 2015-05-01 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
+
+- * bootstrap-asan.mk: Replace ASAN_OPTIONS=detect_leaks with
+- LSAN_OPTIONS=detect_leaks.
++ * bitfields.m4: New file.
+
+-2015-08-24 Yaakov Selkowitz <yselkowi@redhat.com>
++ 2015-04-14 H.J. Lu <hongjiu.lu@intel.com>
+
+- * iconv.m4 (AM_ICONV_LINK): Use in-tree libiconv when present.
++ * bootstrap-mpx.mk: New file.
+
+-2015-07-24 Micahel Darling <darlingm@gmail.com>
++ 2015-03-25 Uros Bizjak <ubizjak@gmail.com>
+
+- PR other/66259
+- * gettext.m4: Reflects renaming of configure.in to configure.ac
+- * po.m4: Likewise
+- * stdint.m4: Likewise
+- * tcl.m4: Likewise
++ PR bootstrap/65537
++ * bootstrap-lto-noplugin.mk: New build configuration.
+
+-2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
++ 2014-11-13 Kirill Yukhin <kirill.yukhin@intel.com>
+
+- * zlib.m4: Sync with binutils-gdb.
++ * target-posix: New file.
+
+-2015-06-30 H.J. Lu <hongjiu.lu@intel.com>
++ 2014-10-27 Tom Tromey <tromey@redhat.com>
+
+- * dfp.m4 (enable_decimal_float): Also set to yes for
+- i?86*-*-elfiamcu target.
++ * gcc-plugin.m4: New file.
+
+-2015-05-27 Jason Merrill <jason@redhat.com>
++2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
++
++ Sync with GCC
++ 2015-05-27 Jason Merrill <jason@redhat.com>
+
+ PR bootstrap/66304
+ * warnings.m4 (ACX_PROG_CXX_WARNING_OPTS)
+@@ -508,22 +395,15 @@
+ (ACX_PROG_CC_WARNING_OPTS, ACX_PROG_CC_WARNING_ALMOST_PEDANTIC)
+ (ACX_PROG_CC_WARNINGS_ARE_ERRORS): Push into C language context.
+
+-2015-05-13 Eric Botcazou <ebotcazou@adacore.com>
+-
+- * sjlj.m4: New file.
+-
+-2015-05-04 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
+-
+- * bitfields.m4: Change int to long long, and use bitfields of
+- width 1 instead of 0.
+-
+-2015-05-01 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
++2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
+
+- * bitfields.m4: New file.
++ Sync with GCC
++ * mh-alpha-linux: Restored.
+
+-2015-04-14 H.J. Lu <hongjiu.lu@intel.com>
++2015-06-30 H.J. Lu <hongjiu.lu@intel.com>
+
+- * bootstrap-mpx.mk: New file.
++ * dfp.m4 (enable_decimal_float): Also set to yes for
++ i?86*-*-elfiamcu target.
+
+ 2015-04-10 Jakub Jelinek <jakub@redhat.com>
+ Iain Sandoe <iain@codesourcery.com>
+@@ -540,77 +420,72 @@
+ PR target/65351
+ * picflag.m4: Append -mno-dynamic-no-pic for Darwin.
+
+-2015-03-25 Uros Bizjak <ubizjak@gmail.com>
++2015-04-02 H.J. Lu <hongjiu.lu@intel.com>
+
+- PR bootstrap/65537
+- * bootstrap-lto-noplugin.mk: New build configuration.
++ * zlib.m4 (AM_ZLIB): Set zlibdir to -L\$(top_builddir)/../zlib
++ and set zlibinc to -I\$(top_srcdir)/../zlib.
+
+-2015-02-18 Thomas Schwinge <thomas@codesourcery.com>
++2015-04-01 H.J. Lu <hongjiu.lu@intel.com>
+
+- * elf.m4 (ACX_ELF_TARGET_IFELSE): nvptx-*-none isn't ELF.
++ * zlib.m4 (AM_ZLIB): Unset zlibdir and zlibinc only for
++ --with-system-zlib.
+
+-2014-11-17 Bob Dunlop <bob.dunlop@xyzzy.org.uk>
++2015-03-31 H.J. Lu <hongjiu.lu@intel.com>
+
+- * mt-ospace (CFLAGS_FOR_TARGET): Append -g -Os rather than
+- overwriting.
+- (CXXFLAGS_FOR_TARGET): Similarly.
++ * zlib.m4 (AM_ZLIB): Replace --with-zlib with --with-system-zlib.
+
+-2014-11-17 H.J. Lu <hongjiu.lu@intel.com>
++2015-03-16 H.J. Lu <hongjiu.lu@intel.com>
+
+- PR bootstrap/63888
+- * bootstrap-asan.mk (ASAN_OPTIONS): Export "detect_leaks=0".
++ * isl.m4: Sync with GCC tree.
+
+-2014-11-13 Kirill Yukhin <kirill.yukhin@intel.com>
++2015-03-16 H.J. Lu <hongjiu.lu@intel.com>
+
+- * target-posix: New file.
++ Sync with GCC
++ 2015-02-18 Thomas Schwinge <thomas@codesourcery.com>
+
+-2014-11-11 Tobias Burnus <burnus@net-b.de>
++ * elf.m4 (ACX_ELF_TARGET_IFELSE): nvptx-*-none isn't ELF.
+
+- * cloog.m4: Remove.
++2015-03-16 H.J. Lu <hongjiu.lu@intel.com>
+
+-2014-10-27 Tom Tromey <tromey@redhat.com>
++ Sync with GCC
++ 2014-11-17 Bob Dunlop <bob.dunlop@xyzzy.org.uk>
+
+- * gcc-plugin.m4: New file.
++ * mt-ospace (CFLAGS_FOR_TARGET): Append -g -Os rather than
++ overwriting.
++ (CXXFLAGS_FOR_TARGET): Similarly.
++
++2015-03-16 H.J. Lu <hongjiu.lu@intel.com>
++
++ Sync with GCC
++ 2014-04-25 Marc Glisse <marc.glisse@inria.fr>
++
++ PR target/43538
++ * mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
+
+-2014-09-01 Andi Kleen <ak@linux.intel.com>
++2015-03-16 H.J. Lu <hongjiu.lu@intel.com>
+
+- * bootstrap-lto.mk: Implement slim bootstrap.
++ * bootstrap-asan.mk: Sync with GCC tree.
++ * bootstrap-lto.mk: Likewise.
+
+-2014-08-21 Bin Cheng <bin.cheng@arm.com>
++2015-03-16 H.J. Lu <hongjiu.lu@intel.com>
+
+- * isl.m4 (ISL_CHECK_VERSION): Check link of isl library
+- for cross_compiling.
++ * cloog.m4: Removed.
+
+ 2014-08-19 Alan Modra <amodra@gmail.com>
+
+ * plugins.m4 (AC_PLUGINS): If plugins are enabled, add -ldl to
+ LIBS via AC_SEARCH_LIBS.
+
+-2014-08-18 Roman Gareev <gareevroman@gmail.com>
+-
+- * cloog.m4: Remove the path to isllibs from clooglibs.
+- * isl.m4: Add paths to islinc, isllibs.
+-
+ 2014-08-14 Alan Modra <amodra@gmail.com>
+
+ * plugins.m4: Test for dlfcn.h or windows.h here to set default
+ for --enable-plugins. Report error if someone tries to enable
+ plugins on a host we don't support.
+
+-2014-07-26 Uros Bizjak <ubizjak@gmail.com>
+-
+- PR target/47230
+- * mh-alpha-linux: New file.
+-
+ 2014-05-14 Sandra Loosemore <sandra@codesourcery.com>
+
+ * mt-nios2-elf: New file.
+
+-2014-04-25 Marc Glisse <marc.glisse@inria.fr>
+-
+- PR target/43538
+- * mt-gnu: Don't reset CXXFLAGS_FOR_TARGET.
+-
+ 2013-12-07 Mike Frysinger <vapier@gentoo.org>
+
+ * acinclude.m4: Remove +x file mode.
+@@ -728,7 +603,7 @@
+ 2012-07-02 Richard Guenther <rguenther@suse.de>
+
+ * isl.m4 (_ISL_CHECK_CT_PROG): Omit main function header/footer.
+- Fix version test.
++ Fix version test.
+
+ 2012-07-02 Richard Guenther <rguenther@suse.de>
+ Michael Matz <matz@suse.de>
+@@ -2455,4 +2330,3 @@ Thu Jan 30 16:17:30 1992 Stu Grossman (grossman at cygnus.com)
+ Tue Dec 10 00:10:55 1991 K. Richard Pixley (rich at rtl.cygnus.com)
+
+ * ChangeLog: fresh changelog.
+-
new file mode 100644
@@ -0,0 +1,1082 @@
+From 862776f26a59516467c98091994c3dac90383159 Mon Sep 17 00:00:00 2001
+From: Arsen Arsenovi? <arsen@aarsen.me>
+Date: Wed, 15 Nov 2023 12:53:04 +0000
+Subject: [PATCH] Finalized intl-update patches
+
+ * intl: Remove directory. Replaced with out-of-tree GNU gettext.
+ * .gitignore: Add '/gettext*'.
+ * configure.ac (host_libs): Replace intl with gettext. (hbaseargs, bbaseargs, baseargs): Split baseargs into {h,b}baseargs. (skip_barg): New flag. Skips appending current flag to bbaseargs. <library exemptions>: Exempt --with-libintl-{type,prefix} from target and build machine argument passing.
+ * configure: Regenerate.
+ * Makefile.def (host_modules): Replace intl module with gettext module. (configure-ld): Depend on configure-gettext.
+ * Makefile.in: Regenerate.
+ * src-release.sh: Remove references to the intl/ directory.
+---
+ config/ChangeLog | 8 +
+ config/gettext-sister.m4 | 35 ++--
+ config/gettext.m4 | 361 +++++++++++++++++----------------------
+ config/iconv.m4 | 313 +++++++++++++++++++++++++--------
+ config/intlmacosx.m4 | 69 ++++++++
+ 5 files changed, 495 insertions(+), 291 deletions(-)
+ create mode 100644 config/intlmacosx.m4
+
+diff --git a/config/ChangeLog b/config/ChangeLog
+index b42f2bc2e08..514f5560cab 100644
+--- a/config/ChangeLog
++++ b/config/ChangeLog
+@@ -1,3 +1,11 @@
++2023-11-15 Arsen Arsenović <arsen@aarsen.me>
++
++ * intlmacosx.m4: Import from gettext-0.22 (serial 8).
++ * gettext.m4: Sync with gettext-0.22 (serial 77).
++ * gettext-sister.m4 (ZW_GNU_GETTEXT_SISTER_DIR): Load gettexts
++ uninstalled-config.sh, or call AM_GNU_GETTEXT if missing.
++ * iconv.m4: Sync with gettext-0.22 (serial 26).
++
+ 2022-12-31 Nick Clifton <nickc@redhat.com>
+
+ * 2.40 branch created.
+diff --git a/config/gettext-sister.m4 b/config/gettext-sister.m4
+index e8e6b668416..5bb385fd0de 100644
+--- a/config/gettext-sister.m4
++++ b/config/gettext-sister.m4
+@@ -10,19 +10,30 @@
+ # the necessary substitutions and definitions for this directory.
+
+ AC_DEFUN([ZW_GNU_GETTEXT_SISTER_DIR],
+-[# If we haven't got the data from the intl directory,
+-# assume NLS is disabled.
+-USE_NLS=no AC_SUBST(USE_NLS)
+-LIBINTL= AC_SUBST(LIBINTL)
+-LIBINTL_DEP= AC_SUBST(LIBINTL_DEP)
+-INCINTL= AC_SUBST(INCINTL)
+-XGETTEXT= AC_SUBST(XGETTEXT)
+-GMSGFMT= AC_SUBST(GMSGFMT)
+-POSUB= AC_SUBST(POSUB)
+-
+-if test -f ifelse([$1],,[../intl],[$1])/config.intl; then
+- . ifelse([$1],,[../intl],[$1])/config.intl
++[
++m4_pushdef([gettext_builddir],
++ m4_default([$1], [../gettext]))
++m4_pushdef([gettext_cfg],
++ gettext_builddir[/uninstalled-config.sh])
++if test -f gettext_cfg; then
++ relative_builddir='[$(top_builddir)/]gettext_builddir'
++ . gettext_cfg
++else
++ # The sister gettext directory doesn't exist and won't collect information on
++ # using gettext for us. Call a bundled AM_GNU_GETTEXT.
++ AM_GNU_GETTEXT([external])
+ fi
++m4_popdef([gettext_cfg])
++m4_popdef([gettext_builddir])
++
++AC_SUBST([USE_NLS])
++AC_SUBST([LIBINTL])
++AC_SUBST([LIBINTL_DEP])
++AC_SUBST([INCINTL])
++AC_SUBST([XGETTEXT])
++AC_SUBST([GMSGFMT])
++AC_SUBST([POSUB])
++
+ AC_MSG_CHECKING([whether NLS is requested])
+ if test x"$USE_NLS" != xyes; then
+ AC_MSG_RESULT(no)
+diff --git a/config/gettext.m4 b/config/gettext.m4
+index 5b42bb16523..f4492405bd2 100644
+--- a/config/gettext.m4
++++ b/config/gettext.m4
+@@ -1,43 +1,39 @@
+-# gettext.m4 serial 20 (gettext-0.12)
+-dnl Copyright (C) 1995-2003 Free Software Foundation, Inc.
+-dnl This file is free software, distributed under the terms of the GNU
+-dnl General Public License. As a special exception to the GNU General
+-dnl Public License, this file may be distributed as part of a program
+-dnl that contains a configuration script generated by Autoconf, under
+-dnl the same distribution terms as the rest of that program.
++# gettext.m4 serial 72 (gettext-0.21.1)
++dnl Copyright (C) 1995-2014, 2016, 2018-2020 Free Software Foundation, Inc.
++dnl This file is free software; the Free Software Foundation
++dnl gives unlimited permission to copy and/or distribute it,
++dnl with or without modifications, as long as this notice is preserved.
+ dnl
+-dnl This file can can be used in projects which are not available under
+-dnl the GNU General Public License or the GNU Library General Public
++dnl This file can be used in projects which are not available under
++dnl the GNU General Public License or the GNU Lesser General Public
+ dnl License but which still want to provide support for the GNU gettext
+ dnl functionality.
+ dnl Please note that the actual code of the GNU gettext library is covered
+-dnl by the GNU Library General Public License, and the rest of the GNU
+-dnl gettext package package is covered by the GNU General Public License.
++dnl by the GNU Lesser General Public License, and the rest of the GNU
++dnl gettext package is covered by the GNU General Public License.
+ dnl They are *not* in the public domain.
+
+ dnl Authors:
+ dnl Ulrich Drepper <drepper@cygnus.com>, 1995-2000.
+-dnl Bruno Haible <haible@clisp.cons.org>, 2000-2003.
++dnl Bruno Haible <haible@clisp.cons.org>, 2000-2006, 2008-2010.
+
+ dnl Macro to add for using GNU gettext.
+
+ dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]).
+-dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The
+-dnl default (if it is not specified or empty) is 'no-libtool'.
+-dnl INTLSYMBOL should be 'external' for packages with no intl directory,
+-dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory.
++dnl INTLSYMBOL must be one of 'external', 'use-libtool'.
++dnl INTLSYMBOL should be 'external' for packages other than GNU gettext, and
++dnl 'use-libtool' for the packages 'gettext-runtime' and 'gettext-tools'.
+ dnl If INTLSYMBOL is 'use-libtool', then a libtool library
+ dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
+ dnl depending on --{enable,disable}-{shared,static} and on the presence of
+-dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library
+-dnl $(top_builddir)/intl/libintl.a will be created.
++dnl AM-DISABLE-SHARED).
+ dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
+ dnl implementations (in libc or libintl) without the ngettext() function
+ dnl will be ignored. If NEEDSYMBOL is specified and is
+ dnl 'need-formatstring-macros', then GNU gettext implementations that don't
+ dnl support the ISO C 99 <inttypes.h> formatstring macros will be ignored.
+ dnl INTLDIR is used to find the intl libraries. If empty,
+-dnl the value `$(top_builddir)/intl/' is used.
++dnl the value '$(top_builddir)/intl/' is used.
+ dnl
+ dnl The result of the configuration is one of three cases:
+ dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
+@@ -59,17 +55,22 @@ dnl
+ AC_DEFUN([AM_GNU_GETTEXT],
+ [
+ dnl Argument checking.
+- ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], ,
++ m4_if([$1], [], , [m4_if([$1], [external], , [m4_if([$1], [use-libtool], ,
+ [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT
+-])])])])])
+- ifelse([$2], [], , [ifelse([$2], [need-ngettext], , [ifelse([$2], [need-formatstring-macros], ,
++])])])])
++ m4_if(m4_if([$1], [], [old])[]m4_if([$1], [no-libtool], [old]), [old],
++ [errprint([ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported.
++])])
++ m4_if([$2], [], , [m4_if([$2], [need-ngettext], , [m4_if([$2], [need-formatstring-macros], ,
+ [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT
+ ])])])])
+- define(gt_included_intl, ifelse([$1], [external], [no], [yes]))
+- define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], []))
++ define([gt_included_intl],
++ m4_if([$1], [external], [no], [yes]))
++ gt_NEEDS_INIT
++ AM_GNU_GETTEXT_NEED([$2])
+
+ AC_REQUIRE([AM_PO_SUBDIRS])dnl
+- ifelse(gt_included_intl, yes, [
++ m4_if(gt_included_intl, yes, [
+ AC_REQUIRE([AM_INTL_SUBDIR])dnl
+ ])
+
+@@ -80,22 +81,24 @@ AC_DEFUN([AM_GNU_GETTEXT],
+ dnl Sometimes libintl requires libiconv, so first search for libiconv.
+ dnl Ideally we would do this search only after the
+ dnl if test "$USE_NLS" = "yes"; then
+- dnl if test "$gt_cv_func_gnugettext_libc" != "yes"; then
+- dnl tests. But if configure.ac invokes AM_ICONV after AM_GNU_GETTEXT
++ dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
++ dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT
+ dnl the configure script would need to contain the same shell code
+ dnl again, outside any 'if'. There are two solutions:
+ dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'.
+ dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE.
+- dnl Since AC_PROVIDE_IFELSE is only in autoconf >= 2.52 and not
+- dnl documented, we avoid it.
+- ifelse(gt_included_intl, yes, , [
++ dnl Since AC_PROVIDE_IFELSE is not documented, we avoid it.
++ m4_if(gt_included_intl, yes, , [
+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+ ])
+
++ dnl Sometimes, on Mac OS X, libintl requires linking with CoreFoundation.
++ gt_INTL_MACOSX
++
+ dnl Set USE_NLS.
+- AM_NLS
++ AC_REQUIRE([AM_NLS])
+
+- ifelse(gt_included_intl, yes, [
++ m4_if(gt_included_intl, yes, [
+ BUILD_INCLUDED_LIBINTL=no
+ USE_INCLUDED_LIBINTL=no
+ ])
+@@ -103,16 +106,25 @@ AC_DEFUN([AM_GNU_GETTEXT],
+ LTLIBINTL=
+ POSUB=
+
++ dnl Add a version number to the cache macros.
++ case " $gt_needs " in
++ *" need-formatstring-macros "*) gt_api_version=3 ;;
++ *" need-ngettext "*) gt_api_version=2 ;;
++ *) gt_api_version=1 ;;
++ esac
++ gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc"
++ gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl"
++
+ dnl If we use NLS figure out what method
+ if test "$USE_NLS" = "yes"; then
+ gt_use_preinstalled_gnugettext=no
+- ifelse(gt_included_intl, yes, [
++ m4_if(gt_included_intl, yes, [
+ AC_MSG_CHECKING([whether included gettext is requested])
+- AC_ARG_WITH(included-gettext,
++ AC_ARG_WITH([included-gettext],
+ [ --with-included-gettext use the GNU gettext library included here],
+ nls_cv_force_use_gnu_gettext=$withval,
+ nls_cv_force_use_gnu_gettext=no)
+- AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
++ AC_MSG_RESULT([$nls_cv_force_use_gnu_gettext])
+
+ nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
+ if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
+@@ -121,13 +133,29 @@ AC_DEFUN([AM_GNU_GETTEXT],
+ dnl to use. If GNU gettext is available we use this. Else we have
+ dnl to fall back to GNU NLS library.
+
+- dnl Add a version number to the cache macros.
+- define([gt_api_version], ifelse([$2], [need-formatstring-macros], 3, ifelse([$2], [need-ngettext], 2, 1)))
+- define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc])
+- define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl])
++ if test $gt_api_version -ge 3; then
++ gt_revision_test_code='
++#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
++#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
++#endif
++changequote(,)dnl
++typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
++changequote([,])dnl
++'
++ else
++ gt_revision_test_code=
++ fi
++ if test $gt_api_version -ge 2; then
++ gt_expression_test_code=' + * ngettext ("", "", 0)'
++ else
++ gt_expression_test_code=
++ fi
+
+- AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
+- [AC_TRY_LINK([#include <libintl.h>
++ AC_CACHE_CHECK([for GNU gettext in libc], [$gt_func_gnugettext_libc],
++ [AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [[
++#include <libintl.h>
+ #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+ extern int _nl_msg_cat_cntr;
+ extern int *_nl_domain_bindings;
+@@ -135,22 +163,18 @@ extern int *_nl_domain_bindings;
+ #else
+ #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
+ #endif
+-]ifelse([$2], [need-formatstring-macros],
+-[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+-#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+-#endif
+-changequote(,)dnl
+-typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+-changequote([,])dnl
+-], []),
+- [bindtextdomain ("", "");
+-return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + __GNU_GETTEXT_SYMBOL_EXPRESSION],
+- gt_cv_func_gnugettext_libc=yes,
+- gt_cv_func_gnugettext_libc=no)])
+-
+- if test "$gt_cv_func_gnugettext_libc" != "yes"; then
++$gt_revision_test_code
++ ]],
++ [[
++bindtextdomain ("", "");
++return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
++ ]])],
++ [eval "$gt_func_gnugettext_libc=yes"],
++ [eval "$gt_func_gnugettext_libc=no"])])
++
++ if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then
+ dnl Sometimes libintl requires libiconv, so first search for libiconv.
+- ifelse(gt_included_intl, yes, , [
++ m4_if(gt_included_intl, yes, , [
+ AM_ICONV_LINK
+ ])
+ dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL
+@@ -159,65 +183,63 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
+ dnl even if libiconv doesn't exist.
+ AC_LIB_LINKFLAGS_BODY([intl])
+ AC_CACHE_CHECK([for GNU gettext in libintl],
+- gt_cv_func_gnugettext_libintl,
++ [$gt_func_gnugettext_libintl],
+ [gt_save_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $INCINTL"
+ gt_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBINTL"
+ dnl Now see whether libintl exists and does not depend on libiconv.
+- AC_TRY_LINK([#include <libintl.h>
++ AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [[
++#include <libintl.h>
+ #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+ extern int _nl_msg_cat_cntr;
+ extern
+ #ifdef __cplusplus
+ "C"
+ #endif
+-const char *_nl_expand_alias ();
+-#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (0))
++const char *_nl_expand_alias (const char *);
++#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
+ #else
+ #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
+ #endif
+-]ifelse([$2], [need-formatstring-macros],
+-[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+-#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+-#endif
+-changequote(,)dnl
+-typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+-changequote([,])dnl
+-], []),
+- [bindtextdomain ("", "");
+-return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + __GNU_GETTEXT_SYMBOL_EXPRESSION],
+- gt_cv_func_gnugettext_libintl=yes,
+- gt_cv_func_gnugettext_libintl=no)
++$gt_revision_test_code
++ ]],
++ [[
++bindtextdomain ("", "");
++return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
++ ]])],
++ [eval "$gt_func_gnugettext_libintl=yes"],
++ [eval "$gt_func_gnugettext_libintl=no"])
+ dnl Now see whether libintl exists and depends on libiconv.
+- if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then
++ if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then
+ LIBS="$LIBS $LIBICONV"
+- AC_TRY_LINK([#include <libintl.h>
++ AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [[
++#include <libintl.h>
+ #ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+ extern int _nl_msg_cat_cntr;
+ extern
+ #ifdef __cplusplus
+ "C"
+ #endif
+-const char *_nl_expand_alias ();
+-#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (0))
++const char *_nl_expand_alias (const char *);
++#define __GNU_GETTEXT_SYMBOL_EXPRESSION (_nl_msg_cat_cntr + *_nl_expand_alias (""))
+ #else
+ #define __GNU_GETTEXT_SYMBOL_EXPRESSION 0
+ #endif
+-]ifelse([$2], [need-formatstring-macros],
+-[#ifndef __GNU_GETTEXT_SUPPORTED_REVISION
+-#define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1)
+-#endif
+-changequote(,)dnl
+-typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1];
+-changequote([,])dnl
+-], []),
+- [bindtextdomain ("", "");
+-return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + __GNU_GETTEXT_SYMBOL_EXPRESSION],
+- [LIBINTL="$LIBINTL $LIBICONV"
+- LTLIBINTL="$LTLIBINTL $LTLIBICONV"
+- gt_cv_func_gnugettext_libintl=yes
+- ])
++$gt_revision_test_code
++ ]],
++ [[
++bindtextdomain ("", "");
++return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION
++ ]])],
++ [LIBINTL="$LIBINTL $LIBICONV"
++ LTLIBINTL="$LTLIBINTL $LTLIBICONV"
++ eval "$gt_func_gnugettext_libintl=yes"
++ ])
+ fi
+ CPPFLAGS="$gt_save_CPPFLAGS"
+ LIBS="$gt_save_LIBS"])
+@@ -227,8 +249,8 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
+ dnl use it. But if this macro is used in GNU gettext, and GNU
+ dnl gettext is already preinstalled in libintl, we update this
+ dnl libintl. (Cf. the install rule in intl/Makefile.in.)
+- if test "$gt_cv_func_gnugettext_libc" = "yes" \
+- || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
++ if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \
++ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \
+ && test "$PACKAGE" != gettext-runtime \
+ && test "$PACKAGE" != gettext-tools; }; then
+ gt_use_preinstalled_gnugettext=yes
+@@ -239,7 +261,7 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
+ INCINTL=
+ fi
+
+- ifelse(gt_included_intl, yes, [
++ m4_if(gt_included_intl, yes, [
+ if test "$gt_use_preinstalled_gnugettext" != "yes"; then
+ dnl GNU gettext is not found in the C library.
+ dnl Fall back on included GNU gettext library.
+@@ -251,11 +273,12 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
+ dnl Mark actions used to generate GNU NLS library.
+ BUILD_INCLUDED_LIBINTL=yes
+ USE_INCLUDED_LIBINTL=yes
+- LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV"
+- LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV"
++ LIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD"
++ LTLIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD"
+ LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
+ fi
+
++ CATOBJEXT=
+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
+ dnl Mark actions to use GNU gettext tools.
+@@ -263,9 +286,18 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
+ fi
+ ])
+
++ if test -n "$INTL_MACOSX_LIBS"; then
++ if test "$gt_use_preinstalled_gnugettext" = "yes" \
++ || test "$nls_cv_use_gnu_gettext" = "yes"; then
++ dnl Some extra flags are needed during linking.
++ LIBINTL="$LIBINTL $INTL_MACOSX_LIBS"
++ LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS"
++ fi
++ fi
++
+ if test "$gt_use_preinstalled_gnugettext" = "yes" \
+ || test "$nls_cv_use_gnu_gettext" = "yes"; then
+- AC_DEFINE(ENABLE_NLS, 1,
++ AC_DEFINE([ENABLE_NLS], [1],
+ [Define to 1 if translation of program messages to the user's native language
+ is requested.])
+ else
+@@ -278,7 +310,7 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
+ if test "$USE_NLS" = "yes"; then
+ AC_MSG_CHECKING([where the gettext function comes from])
+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+- if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
++ if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
+ gt_source="external libintl"
+ else
+ gt_source="libc"
+@@ -292,16 +324,16 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
+ if test "$USE_NLS" = "yes"; then
+
+ if test "$gt_use_preinstalled_gnugettext" = "yes"; then
+- if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
++ if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then
+ AC_MSG_CHECKING([how to link with libintl])
+ AC_MSG_RESULT([$LIBINTL])
+ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL])
+ fi
+
+ dnl For backward compatibility. Some packages may be using this.
+- AC_DEFINE(HAVE_GETTEXT, 1,
++ AC_DEFINE([HAVE_GETTEXT], [1],
+ [Define if the GNU gettext() function is already present or preinstalled.])
+- AC_DEFINE(HAVE_DCGETTEXT, 1,
++ AC_DEFINE([HAVE_DCGETTEXT], [1],
+ [Define if the GNU dcgettext() function is already present or preinstalled.])
+ fi
+
+@@ -309,125 +341,46 @@ return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("",
+ POSUB=po
+ fi
+
+- ifelse(gt_included_intl, yes, [
+- dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
+- dnl to 'yes' because some of the testsuite requires it.
+- if test "$PACKAGE" = gettext-runtime || test "$PACKAGE" = gettext-tools; then
+- BUILD_INCLUDED_LIBINTL=yes
+- fi
++ m4_if(gt_included_intl, yes, [
++ dnl In GNU gettext we have to set BUILD_INCLUDED_LIBINTL to 'yes'
++ dnl because some of the testsuite requires it.
++ BUILD_INCLUDED_LIBINTL=yes
+
+ dnl Make all variables we use known to autoconf.
+- AC_SUBST(BUILD_INCLUDED_LIBINTL)
+- AC_SUBST(USE_INCLUDED_LIBINTL)
+- AC_SUBST(CATOBJEXT)
+-
+- dnl For backward compatibility. Some configure.acs may be using this.
+- nls_cv_header_intl=
+- nls_cv_header_libgt=
+-
+- dnl For backward compatibility. Some Makefiles may be using this.
+- DATADIRNAME=share
+- AC_SUBST(DATADIRNAME)
+-
+- dnl For backward compatibility. Some Makefiles may be using this.
+- INSTOBJEXT=.mo
+- AC_SUBST(INSTOBJEXT)
+-
+- dnl For backward compatibility. Some Makefiles may be using this.
+- GENCAT=gencat
+- AC_SUBST(GENCAT)
+-
+- dnl For backward compatibility. Some Makefiles may be using this.
+- if test "$USE_INCLUDED_LIBINTL" = yes; then
+- INTLOBJS="\$(GETTOBJS)"
+- fi
+- AC_SUBST(INTLOBJS)
+-
+- dnl Enable libtool support if the surrounding package wishes it.
+- INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix
+- AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
++ AC_SUBST([BUILD_INCLUDED_LIBINTL])
++ AC_SUBST([USE_INCLUDED_LIBINTL])
++ AC_SUBST([CATOBJEXT])
+ ])
+
+ dnl For backward compatibility. Some Makefiles may be using this.
+ INTLLIBS="$LIBINTL"
+- AC_SUBST(INTLLIBS)
++ AC_SUBST([INTLLIBS])
+
+ dnl Make all documented variables known to autoconf.
+- AC_SUBST(LIBINTL)
+- AC_SUBST(LTLIBINTL)
+- AC_SUBST(POSUB)
++ AC_SUBST([LIBINTL])
++ AC_SUBST([LTLIBINTL])
++ AC_SUBST([POSUB])
+ ])
+
+
+-dnl Checks for all prerequisites of the intl subdirectory,
+-dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS,
+-dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL.
+-AC_DEFUN([AM_INTL_SUBDIR],
++dnl gt_NEEDS_INIT ensures that the gt_needs variable is initialized.
++m4_define([gt_NEEDS_INIT],
+ [
+- AC_REQUIRE([AC_PROG_INSTALL])dnl
+- AC_REQUIRE([AM_MKINSTALLDIRS])dnl
+- AC_REQUIRE([AC_PROG_CC])dnl
+- AC_REQUIRE([AC_CANONICAL_HOST])dnl
+- AC_REQUIRE([AC_PROG_RANLIB])dnl
+- AC_REQUIRE([AC_ISC_POSIX])dnl
+- AC_REQUIRE([AC_HEADER_STDC])dnl
+- AC_REQUIRE([AC_C_CONST])dnl
+- AC_REQUIRE([AC_C_INLINE])dnl
+- AC_REQUIRE([AC_TYPE_OFF_T])dnl
+- AC_REQUIRE([AC_TYPE_SIZE_T])dnl
+- AC_REQUIRE([AC_FUNC_ALLOCA])dnl
+- AC_REQUIRE([AC_FUNC_MMAP])dnl
+- AC_REQUIRE([jm_GLIBC21])dnl
+- AC_REQUIRE([gt_INTDIV0])dnl
+- AC_REQUIRE([jm_AC_TYPE_UINTMAX_T])dnl
+- AC_REQUIRE([gt_HEADER_INTTYPES_H])dnl
+- AC_REQUIRE([gt_INTTYPES_PRI])dnl
+-
+- AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
+-stdlib.h string.h unistd.h sys/param.h])
+- AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \
+-geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \
+-strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next \
+-__fsetlocking])
+-
+- AM_ICONV
+- AM_LANGINFO_CODESET
+- if test $ac_cv_header_locale_h = yes; then
+- AM_LC_MESSAGES
+- fi
++ m4_divert_text([DEFAULTS], [gt_needs=])
++ m4_define([gt_NEEDS_INIT], [])
++])
+
+- dnl intl/plural.c is generated from intl/plural.y. It requires bison,
+- dnl because plural.y uses bison specific features. It requires at least
+- dnl bison-1.26 because earlier versions generate a plural.c that doesn't
+- dnl compile.
+- dnl bison is only needed for the maintainer (who touches plural.y). But in
+- dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
+- dnl the rule in general Makefile. Now, some people carelessly touch the
+- dnl files or have a broken "make" program, hence the plural.c rule will
+- dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
+- dnl present or too old.
+- AC_CHECK_PROGS([INTLBISON], [bison])
+- if test -z "$INTLBISON"; then
+- ac_verc_fail=yes
+- else
+- dnl Found it, now check the version.
+- AC_MSG_CHECKING([version of bison])
+-changequote(<<,>>)dnl
+- ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
+- case $ac_prog_version in
+- '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
+- 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
+-changequote([,])dnl
+- ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
+- *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
+- esac
+- AC_MSG_RESULT([$ac_prog_version])
+- fi
+- if test $ac_verc_fail = yes; then
+- INTLBISON=:
+- fi
++
++dnl Usage: AM_GNU_GETTEXT_NEED([NEEDSYMBOL])
++AC_DEFUN([AM_GNU_GETTEXT_NEED],
++[
++ m4_divert_text([INIT_PREPARE], [gt_needs="$gt_needs $1"])
+ ])
+
+
+ dnl Usage: AM_GNU_GETTEXT_VERSION([gettext-version])
+ AC_DEFUN([AM_GNU_GETTEXT_VERSION], [])
++
++
++dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version])
++AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], [])
+diff --git a/config/iconv.m4 b/config/iconv.m4
+index f1e54c5aedc..ff5d5261139 100644
+--- a/config/iconv.m4
++++ b/config/iconv.m4
+@@ -1,13 +1,17 @@
+-# iconv.m4 serial AM4 (gettext-0.11.3)
+-dnl Copyright (C) 2000-2002 Free Software Foundation, Inc.
+-dnl This file is free software, distributed under the terms of the GNU
+-dnl General Public License. As a special exception to the GNU General
+-dnl Public License, this file may be distributed as part of a program
+-dnl that contains a configuration script generated by Autoconf, under
+-dnl the same distribution terms as the rest of that program.
++# iconv.m4 serial 26
++dnl Copyright (C) 2000-2002, 2007-2014, 2016-2023 Free Software Foundation,
++dnl Inc.
++dnl This file is free software; the Free Software Foundation
++dnl gives unlimited permission to copy and/or distribute it,
++dnl with or without modifications, as long as this notice is preserved.
+
+ dnl From Bruno Haible.
+-dnl with modifications to support building with in-tree libiconv
++
++AC_PREREQ([2.64])
++
++dnl Note: AM_ICONV is documented in the GNU gettext manual
++dnl <https://www.gnu.org/software/gettext/manual/html_node/AM_005fICONV.html>.
++dnl Don't make changes that are incompatible with that documentation!
+
+ AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
+ [
+@@ -24,107 +28,266 @@ AC_DEFUN([AM_ICONV_LINK],
+ [
+ dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+ dnl those with the standalone portable GNU libiconv installed).
++ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+ dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+ dnl accordingly.
+ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+
+- AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
++ dnl Add $INCICONV to CPPFLAGS before performing the following checks,
++ dnl because if the user has installed libiconv and not disabled its use
++ dnl via --without-libiconv-prefix, he wants to use it. The first
++ dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
++ am_save_CPPFLAGS="$CPPFLAGS"
++ AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
++
++ AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
+ am_cv_func_iconv="no, consider installing GNU libiconv"
+ am_cv_lib_iconv=no
+- dnl Add $INCICONV to CPPFLAGS before performing the first check,
+- dnl because if the user has installed libiconv and not disabled its use
+- dnl via --without-libiconv-prefix, he wants to use it. This first
+- dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
+- am_save_CPPFLAGS="$CPPFLAGS"
+- CPPFLAGS="$CPPFLAGS $INCICONV"
+- AC_TRY_LINK([#include <stdlib.h>
+-#include <iconv.h>],
+- [iconv_t cd = iconv_open("","");
+- iconv(cd,NULL,NULL,NULL,NULL);
+- iconv_close(cd);],
+- am_cv_func_iconv=yes)
+- CPPFLAGS="$am_save_CPPFLAGS"
+-
+- if test "$am_cv_func_iconv" != yes && test -d ../libiconv; then
+- for _libs in .libs _libs; do
+- am_save_CPPFLAGS="$CPPFLAGS"
+- am_save_LIBS="$LIBS"
+- CPPFLAGS="$CPPFLAGS -I../libiconv/include"
+- LIBS="$LIBS ../libiconv/lib/$_libs/libiconv.a"
+- AC_TRY_LINK([#include <stdlib.h>
+-#include <iconv.h>],
+- [iconv_t cd = iconv_open("","");
++ AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [[
++#include <stdlib.h>
++#include <iconv.h>
++ ]],
++ [[iconv_t cd = iconv_open("","");
+ iconv(cd,NULL,NULL,NULL,NULL);
+- iconv_close(cd);],
+- INCICONV="-I../libiconv/include"
+- LIBICONV='${top_builddir}'/../libiconv/lib/$_libs/libiconv.a
+- LTLIBICONV='${top_builddir}'/../libiconv/lib/libiconv.la
+- am_cv_lib_iconv=yes
+- am_cv_func_iconv=yes)
+- CPPFLAGS="$am_save_CPPFLAGS"
+- LIBS="$am_save_LIBS"
+- if test "$am_cv_func_iconv" = "yes"; then
+- break
+- fi
+- done
+- fi
+-
++ iconv_close(cd);]])],
++ [am_cv_func_iconv=yes])
+ if test "$am_cv_func_iconv" != yes; then
+- am_save_CPPFLAGS="$CPPFLAGS"
+ am_save_LIBS="$LIBS"
+- CPPFLAGS="$CPPFLAGS $INCICONV"
+ LIBS="$LIBS $LIBICONV"
+- AC_TRY_LINK([#include <stdlib.h>
+-#include <iconv.h>],
+- [iconv_t cd = iconv_open("","");
+- iconv(cd,NULL,NULL,NULL,NULL);
+- iconv_close(cd);],
+- am_cv_lib_iconv=yes
+- am_cv_func_iconv=yes)
+- CPPFLAGS="$am_save_CPPFLAGS"
++ AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [[
++#include <stdlib.h>
++#include <iconv.h>
++ ]],
++ [[iconv_t cd = iconv_open("","");
++ iconv(cd,NULL,NULL,NULL,NULL);
++ iconv_close(cd);]])],
++ [am_cv_lib_iconv=yes]
++ [am_cv_func_iconv=yes])
+ LIBS="$am_save_LIBS"
+ fi
+ ])
+ if test "$am_cv_func_iconv" = yes; then
+- AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
++ AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
++ dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
++ dnl Solaris 10.
++ am_save_LIBS="$LIBS"
++ if test $am_cv_lib_iconv = yes; then
++ LIBS="$LIBS $LIBICONV"
++ fi
++ am_cv_func_iconv_works=no
++ for ac_iconv_const in '' 'const'; do
++ AC_RUN_IFELSE(
++ [AC_LANG_PROGRAM(
++ [[
++#include <iconv.h>
++#include <string.h>
++
++#ifndef ICONV_CONST
++# define ICONV_CONST $ac_iconv_const
++#endif
++ ]],
++ [[int result = 0;
++ /* Test against AIX 5.1...7.2 bug: Failures are not distinguishable from
++ successful returns. This is even documented in
++ <https://www.ibm.com/support/knowledgecenter/ssw_aix_72/i_bostechref/iconv.html> */
++ {
++ iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
++ if (cd_utf8_to_88591 != (iconv_t)(-1))
++ {
++ static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
++ char buf[10];
++ ICONV_CONST char *inptr = input;
++ size_t inbytesleft = strlen (input);
++ char *outptr = buf;
++ size_t outbytesleft = sizeof (buf);
++ size_t res = iconv (cd_utf8_to_88591,
++ &inptr, &inbytesleft,
++ &outptr, &outbytesleft);
++ if (res == 0)
++ result |= 1;
++ iconv_close (cd_utf8_to_88591);
++ }
++ }
++ /* Test against Solaris 10 bug: Failures are not distinguishable from
++ successful returns. */
++ {
++ iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
++ if (cd_ascii_to_88591 != (iconv_t)(-1))
++ {
++ static ICONV_CONST char input[] = "\263";
++ char buf[10];
++ ICONV_CONST char *inptr = input;
++ size_t inbytesleft = strlen (input);
++ char *outptr = buf;
++ size_t outbytesleft = sizeof (buf);
++ size_t res = iconv (cd_ascii_to_88591,
++ &inptr, &inbytesleft,
++ &outptr, &outbytesleft);
++ if (res == 0)
++ result |= 2;
++ iconv_close (cd_ascii_to_88591);
++ }
++ }
++ /* Test against AIX 6.1..7.1 bug: Buffer overrun. */
++ {
++ iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
++ if (cd_88591_to_utf8 != (iconv_t)(-1))
++ {
++ static ICONV_CONST char input[] = "\304";
++ static char buf[2] = { (char)0xDE, (char)0xAD };
++ ICONV_CONST char *inptr = input;
++ size_t inbytesleft = 1;
++ char *outptr = buf;
++ size_t outbytesleft = 1;
++ size_t res = iconv (cd_88591_to_utf8,
++ &inptr, &inbytesleft,
++ &outptr, &outbytesleft);
++ if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
++ result |= 4;
++ iconv_close (cd_88591_to_utf8);
++ }
++ }
++#if 0 /* This bug could be worked around by the caller. */
++ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
++ {
++ iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
++ if (cd_88591_to_utf8 != (iconv_t)(-1))
++ {
++ static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
++ char buf[50];
++ ICONV_CONST char *inptr = input;
++ size_t inbytesleft = strlen (input);
++ char *outptr = buf;
++ size_t outbytesleft = sizeof (buf);
++ size_t res = iconv (cd_88591_to_utf8,
++ &inptr, &inbytesleft,
++ &outptr, &outbytesleft);
++ if ((int)res > 0)
++ result |= 8;
++ iconv_close (cd_88591_to_utf8);
++ }
++ }
++#endif
++ /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
++ provided. */
++ {
++ /* Try standardized names. */
++ iconv_t cd1 = iconv_open ("UTF-8", "EUC-JP");
++ /* Try IRIX, OSF/1 names. */
++ iconv_t cd2 = iconv_open ("UTF-8", "eucJP");
++ /* Try AIX names. */
++ iconv_t cd3 = iconv_open ("UTF-8", "IBM-eucJP");
++ /* Try HP-UX names. */
++ iconv_t cd4 = iconv_open ("utf8", "eucJP");
++ if (cd1 == (iconv_t)(-1) && cd2 == (iconv_t)(-1)
++ && cd3 == (iconv_t)(-1) && cd4 == (iconv_t)(-1))
++ result |= 16;
++ if (cd1 != (iconv_t)(-1))
++ iconv_close (cd1);
++ if (cd2 != (iconv_t)(-1))
++ iconv_close (cd2);
++ if (cd3 != (iconv_t)(-1))
++ iconv_close (cd3);
++ if (cd4 != (iconv_t)(-1))
++ iconv_close (cd4);
++ }
++ return result;
++]])],
++ [am_cv_func_iconv_works=yes], ,
++ [case "$host_os" in
++ aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
++ *) am_cv_func_iconv_works="guessing yes" ;;
++ esac])
++ test "$am_cv_func_iconv_works" = no || break
++ done
++ LIBS="$am_save_LIBS"
++ ])
++ case "$am_cv_func_iconv_works" in
++ *no) am_func_iconv=no am_cv_lib_iconv=no ;;
++ *) am_func_iconv=yes ;;
++ esac
++ else
++ am_func_iconv=no am_cv_lib_iconv=no
++ fi
++ if test "$am_func_iconv" = yes; then
++ AC_DEFINE([HAVE_ICONV], [1],
++ [Define if you have the iconv() function and it works.])
+ fi
+ if test "$am_cv_lib_iconv" = yes; then
+- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
+ AC_MSG_CHECKING([how to link with libiconv])
+ AC_MSG_RESULT([$LIBICONV])
+ else
++ dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
++ dnl either.
++ CPPFLAGS="$am_save_CPPFLAGS"
+ LIBICONV=
+ LTLIBICONV=
+ fi
+- AC_SUBST(LIBICONV)
+- AC_SUBST(LTLIBICONV)
++ AC_SUBST([LIBICONV])
++ AC_SUBST([LTLIBICONV])
+ ])
+
+-AC_DEFUN([AM_ICONV],
++dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like
++dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
++AC_DEFUN_ONCE([AM_ICONV],
+ [
+ AM_ICONV_LINK
+ if test "$am_cv_func_iconv" = yes; then
+- AC_MSG_CHECKING([for iconv declaration])
+- AC_CACHE_VAL(am_cv_proto_iconv, [
+- AC_TRY_COMPILE([
++ AC_CACHE_CHECK([whether iconv is compatible with its POSIX signature],
++ [gl_cv_iconv_nonconst],
++ [AC_COMPILE_IFELSE(
++ [AC_LANG_PROGRAM(
++ [[
+ #include <stdlib.h>
+ #include <iconv.h>
+ extern
+ #ifdef __cplusplus
+ "C"
+ #endif
+-#if defined(__STDC__) || defined(__cplusplus)
+ size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+-#else
+-size_t iconv();
+-#endif
+-], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
+- am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+- am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+- AC_MSG_RESULT([$]{ac_t:-
+- }[$]am_cv_proto_iconv)
+- AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
+- [Define as const if the declaration of iconv() needs const.])
++ ]],
++ [[]])],
++ [gl_cv_iconv_nonconst=yes],
++ [gl_cv_iconv_nonconst=no])
++ ])
++ else
++ dnl When compiling GNU libiconv on a system that does not have iconv yet,
++ dnl pick the POSIX compliant declaration without 'const'.
++ gl_cv_iconv_nonconst=yes
++ fi
++ if test $gl_cv_iconv_nonconst = yes; then
++ iconv_arg1=""
++ else
++ iconv_arg1="const"
++ fi
++ AC_DEFINE_UNQUOTED([ICONV_CONST], [$iconv_arg1],
++ [Define as const if the declaration of iconv() needs const.])
++ dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
++ m4_ifdef([gl_ICONV_H_DEFAULTS],
++ [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
++ if test $gl_cv_iconv_nonconst != yes; then
++ ICONV_CONST="const"
++ fi
++ ])
++
++ dnl A summary result, for those packages which want to print a summary at the
++ dnl end of the configuration.
++ if test "$am_func_iconv" = yes; then
++ if test -n "$LIBICONV"; then
++ am_cv_func_iconv_summary='yes, in libiconv'
++ else
++ am_cv_func_iconv_summary='yes, in libc'
++ fi
++ else
++ if test "$am_cv_func_iconv" = yes; then
++ am_cv_func_iconv_summary='not working, consider installing GNU libiconv'
++ else
++ am_cv_func_iconv_summary='no, consider installing GNU libiconv'
++ fi
+ fi
+ ])
+diff --git a/config/intlmacosx.m4 b/config/intlmacosx.m4
+new file mode 100644
+index 00000000000..3141bf8c5e4
+--- /dev/null
++++ b/config/intlmacosx.m4
+@@ -0,0 +1,69 @@
++# intlmacosx.m4 serial 9 (gettext-0.22.3)
++dnl Copyright (C) 2004-2014, 2016, 2019-2023 Free Software Foundation, Inc.
++dnl This file is free software; the Free Software Foundation
++dnl gives unlimited permission to copy and/or distribute it,
++dnl with or without modifications, as long as this notice is preserved.
++dnl
++dnl This file can be used in projects which are not available under
++dnl the GNU General Public License or the GNU Lesser General Public
++dnl License but which still want to provide support for the GNU gettext
++dnl functionality.
++dnl Please note that the actual code of the GNU gettext library is covered
++dnl by the GNU Lesser General Public License, and the rest of the GNU
++dnl gettext package is covered by the GNU General Public License.
++dnl They are *not* in the public domain.
++
++dnl Checks for special options needed on Mac OS X.
++dnl Defines INTL_MACOSX_LIBS.
++AC_DEFUN([gt_INTL_MACOSX],
++[
++ dnl Check for API introduced in Mac OS X 10.4.
++ AC_CACHE_CHECK([for CFPreferencesCopyAppValue],
++ [gt_cv_func_CFPreferencesCopyAppValue],
++ [gt_save_LIBS="$LIBS"
++ LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
++ AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [[#include <CoreFoundation/CFPreferences.h>]],
++ [[CFPreferencesCopyAppValue(NULL, NULL)]])],
++ [gt_cv_func_CFPreferencesCopyAppValue=yes],
++ [gt_cv_func_CFPreferencesCopyAppValue=no])
++ LIBS="$gt_save_LIBS"])
++ if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then
++ AC_DEFINE([HAVE_CFPREFERENCESCOPYAPPVALUE], [1],
++ [Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in the CoreFoundation framework.])
++ fi
++ dnl Don't check for the API introduced in Mac OS X 10.5, CFLocaleCopyCurrent,
++ dnl because in macOS 10.13.4 it has the following behaviour:
++ dnl When two or more languages are specified in the
++ dnl "System Preferences > Language & Region > Preferred Languages" panel,
++ dnl it returns en_CC where CC is the territory (even when English is not among
++ dnl the preferred languages!). What we want instead is what
++ dnl CFLocaleCopyCurrent returned in earlier macOS releases and what
++ dnl CFPreferencesCopyAppValue still returns, namely ll_CC where ll is the
++ dnl first among the preferred languages and CC is the territory.
++ AC_CACHE_CHECK([for CFLocaleCopyPreferredLanguages], [gt_cv_func_CFLocaleCopyPreferredLanguages],
++ [gt_save_LIBS="$LIBS"
++ LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation"
++ AC_LINK_IFELSE(
++ [AC_LANG_PROGRAM(
++ [[#include <CoreFoundation/CFLocale.h>]],
++ [[CFLocaleCopyPreferredLanguages();]])],
++ [gt_cv_func_CFLocaleCopyPreferredLanguages=yes],
++ [gt_cv_func_CFLocaleCopyPreferredLanguages=no])
++ LIBS="$gt_save_LIBS"])
++ if test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
++ AC_DEFINE([HAVE_CFLOCALECOPYPREFERREDLANGUAGES], [1],
++ [Define to 1 if you have the Mac OS X function CFLocaleCopyPreferredLanguages in the CoreFoundation framework.])
++ fi
++ INTL_MACOSX_LIBS=
++ if test $gt_cv_func_CFPreferencesCopyAppValue = yes \
++ || test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
++ dnl Starting with macOS version 14, CoreFoundation relies on CoreServices,
++ dnl and we have to link it in explicitly, otherwise an exception
++ dnl NSInvalidArgumentException "unrecognized selector sent to instance"
++ dnl occurs.
++ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreServices"
++ fi
++ AC_SUBST([INTL_MACOSX_LIBS])
++])
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,52 @@
+From 56006f79386f261f637809296585153b09f84ee1 Mon Sep 17 00:00:00 2001
+From: Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+Date: Thu, 30 Nov 2023 10:14:30 +0100
+Subject: [PATCH] libiberty: Disable hwcaps for sha1.o
+
+This patch
+
+commit bf4f40cc3195eb7b900bf5535cdba1ee51fdbb8e
+Author: Jakub Jelinek <jakub@redhat.com>
+Date: Tue Nov 28 13:14:05 2023 +0100
+
+ libiberty: Use x86 HW optimized sha1
+
+broke Solaris/x86 bootstrap with the native as:
+
+libtool: compile: /var/gcc/regression/master/11.4-gcc/build/./gcc/gccgo -B/var/gcc/regression/master/11.4-gcc/build/./gcc/ -B/vol/gcc/i386-pc-solaris2.11/bin/ -B/vol/gcc/i386-pc-solaris2.11/lib/ -isystem /vol/gcc/i386-pc-solaris2.11/include -isystem /vol/gcc/i386-pc-solaris2.11/sys-include -fchecking=1 -minline-all-stringops -O2 -g -I . -c -fgo-pkgpath=internal/goarch /vol/gcc/src/hg/master/local/libgo/go/internal/goarch/goarch.go zgoarch.go
+ld.so.1: go1: fatal: /var/gcc/regression/master/11.4-gcc/build/gcc/go1: hardware capability (CA_SUNW_HW_2) unsupported: 0x4000000 [ SHA1 ]
+gccgo: fatal error: Killed signal terminated program go1
+
+As is already done in a couple of other similar cases, this patches
+disables hwcaps support for libiberty.
+
+Initially, this didn't work because config/hwcaps.m4 uses target_os, but
+didn't ensure it is defined.
+
+Tested on i386-pc-solaris2.11 with as and gas.
+
+diff --git a/config/ChangeLog b/config/ChangeLog
+index bb82cc873ea..b8943c95cad 100644
+--- a/config/ChangeLog
++++ b/config/ChangeLog
+@@ -1,3 +1,8 @@
++2023-11-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
++
++ * hwcaps.m4 (GCC_CHECK_ASSEMBLER_HWCAP): Require
++ AC_CANONICAL_TARGET.
++
+ 2023-11-15 Arsen Arsenović <arsen@aarsen.me>
+
+ * intlmacosx.m4: Import from gettext-0.22 (serial 8).
+diff --git a/config/hwcaps.m4 b/config/hwcaps.m4
+index ff352fdd3a6..33f090574cf 100644
+--- a/config/hwcaps.m4
++++ b/config/hwcaps.m4
+@@ -7,6 +7,7 @@ dnl HWCAP_CFLAGS='-Wa,-nH' if possible.
+ dnl
+ AC_DEFUN([GCC_CHECK_ASSEMBLER_HWCAP], [
+ test -z "$HWCAP_CFLAGS" && HWCAP_CFLAGS=''
++ AC_REQUIRE([AC_CANONICAL_TARGET])
+
+ # Restrict the test to Solaris, other assemblers (e.g. AIX as) have -nH
+ # with a different meaning.
new file mode 100644
@@ -0,0 +1,101 @@
+From 219822fd5db6305592b45677a3b38c02b523360e Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Tue, 9 Apr 2024 06:39:21 -0700
+Subject: [PATCH] mmap: Avoid the sanitizer configure check failure
+
+When -fsanitize=address,undefined is used to build, the mmap configure
+check failed with
+
+=================================================================
+==231796==ERROR: LeakSanitizer: detected memory leaks
+
+Direct leak of 4096 byte(s) in 1 object(s) allocated from:
+ #0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
+ #1 0x5750c7f6d72b in main /home/alan/build/gas-san/all/bfd/conftest.c:239
+
+Direct leak of 4096 byte(s) in 1 object(s) allocated from:
+ #0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
+ #1 0x5750c7f6d2e1 in main /home/alan/build/gas-san/all/bfd/conftest.c:190
+
+SUMMARY: AddressSanitizer: 8192 byte(s) leaked in 2 allocation(s).
+
+Define GCC_AC_FUNC_MMAP with export ASAN_OPTIONS=detect_leaks=0 to avoid
+the sanitizer configure check failure.
+
+config/
+
+ * mmap.m4 (GCC_AC_FUNC_MMAP): New.
+ * no-executables.m4 (AC_FUNC_MMAP): Renamed to GCC_AC_FUNC_MMAP.
+ Change AC_FUNC_MMAP to GCC_AC_FUNC_MMAP.
+
+libiberty/
+
+ * Makefile.in (aclocal_deps): Add $(srcdir)/../config/mmap.m4.
+ * acinclude.m4: Change AC_FUNC_MMAP to GCC_AC_FUNC_MMAP.
+ * aclocal.m4: Regenerated.
+ * configure: Likewise.
+
+zlib/
+
+ * acinclude.m4: Include ../config/mmap.m4.
+ * Makefile.in: Regenerated.
+ * configure: Likewise.
+---
+ config/mmap.m4 | 22 ++++++++++++++++++++++
+ config/no-executables.m4 | 4 ++--
+ 2 files changed, 24 insertions(+), 2 deletions(-)
+
+diff --git a/config/mmap.m4 b/config/mmap.m4
+index fba0d9d3657..326b97b91f4 100644
+--- a/config/mmap.m4
++++ b/config/mmap.m4
+@@ -95,3 +95,25 @@ if test $gcc_cv_func_mmap_anon = yes; then
+ [Define if mmap with MAP_ANON(YMOUS) works.])
+ fi
+ ])
++
++dnl
++dnl Avoid the sanitizer run-time memory leak failure in the mmap configure
++dnl test. This should be removed when autoconf with commit:
++dnl
++dnl commit 09b6e78d1592ce10fdc975025d699ee41444aa3f
++dnl Author: Paul Eggert <eggert@cs.ucla.edu>
++dnl Date: Fri Feb 5 21:06:20 2016 -0800
++dnl Fix memory leak in AC_FUNC_MMAP
++dnl
++dnl * lib/autoconf/functions.m4 (AC_FUNC_MMAP): Fix memory leak
++dnl in test case, found by configuring with gcc -fsanitize=address.
++dnl
++dnl is in use.
++dnl
++AC_DEFUN([GCC_AC_FUNC_MMAP],
++ save_ASAN_OPTIONS="$ASAN_OPTIONS"
++ ASAN_OPTIONS=detect_leaks=0
++ export ASAN_OPTIONS
++ m4_defn([AC_FUNC_MMAP])
++ ASAN_OPTIONS="$save_ASAN_OPTIONS"
++)
+diff --git a/config/no-executables.m4 b/config/no-executables.m4
+index 6842f84fba3..e8e2537bde5 100644
+--- a/config/no-executables.m4
++++ b/config/no-executables.m4
+@@ -49,14 +49,14 @@ m4_defn([AC_LINK_IFELSE]))
+
+ dnl This is a shame. We have to provide a default for some link tests,
+ dnl similar to the default for run tests.
+-m4_define([AC_FUNC_MMAP],
++m4_define([GCC_AC_FUNC_MMAP],
+ if test x$gcc_no_link = xyes; then
+ if test "x${ac_cv_func_mmap_fixed_mapped+set}" != xset; then
+ ac_cv_func_mmap_fixed_mapped=no
+ fi
+ fi
+ if test "x${ac_cv_func_mmap_fixed_mapped}" != xno; then
+- m4_defn([AC_FUNC_MMAP])
++ m4_defn([GCC_AC_FUNC_MMAP])
+ fi)
+
+ m4_divert_pop()dnl
+--
+2.45.1
+
@@ -191,6 +191,9 @@ apply_patches "patches/0001-use-windows-stat"
apply_patches "patches/0002-no-solaris-_gl_attribute_dealloc"
# Regenerate all necessary files...
+if [ -n "$NO_AUTOTOOLS" ]; then
+ exit 0
+fi
aclocal &&
autoconf &&
autoheader &&
new file mode 100644
@@ -0,0 +1,37 @@
+From 53bef1c10759f1fd7faf675459871b2f4cc12e53 Mon Sep 17 00:00:00 2001
+From: Eli Zaretskii <eliz@gnu.org>
+Date: Thu, 22 Jan 2015 21:07:31 +0200
+Subject: [PATCH] Another part of fixing "make TAGS".
+
+libdecnumber/
+2015-01-22 Eli Zaretskii <eliz@gnu.org>
+
+ * Makefile.in (TAGS): New target, to avoid failures in "make TAGS".
+diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog
+index 65d20fcdbd9..ec6ea1a5dcc 100644
+--- a/libdecnumber/ChangeLog
++++ b/libdecnumber/ChangeLog
+@@ -64,6 +64,10 @@
+
+ * ChangeLog.jit: New.
+
++2015-01-22 Eli Zaretskii <eliz@gnu.org>
++
++ * Makefile.in (TAGS): New target, to avoid failures in "make TAGS".
++
+ 2014-01-23 Marek Polacek <polacek@redhat.com>
+
+ PR c/59871
+diff --git a/libdecnumber/Makefile.in b/libdecnumber/Makefile.in
+index b6f3842b0d2..8dbada97b66 100644
+--- a/libdecnumber/Makefile.in
++++ b/libdecnumber/Makefile.in
+@@ -167,6 +167,8 @@ maintainer-clean: distclean
+ @echo "it deletes files that may require special tools to rebuild."
+ -rm -f $(srcdir)/configure $(srcdir)/aclocal.m4
+
++TAGS:
++
+ check:
+ installcheck:
+ dvi:
new file mode 100644
@@ -0,0 +1,198 @@
+From d0ac1c44885daf68f631befa37e3f3bad318fbbf Mon Sep 17 00:00:00 2001
+From: Simon Marchi <simon.marchi@ericsson.com>
+Date: Tue, 19 Jun 2018 16:54:48 -0400
+Subject: [PATCH] Bump to autoconf 2.69 and automake 1.15.1
+
+When trying to run the update-gnulib.sh script in gdb, I get this:
+
+Error: Wrong automake version (Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ =:+{}]+)}/ at /opt/automake/1.11.1/bin/automake line 4113.), we need 1.11.1.
+Aborting.
+
+Apparently, it's an issue with a regex in automake that triggers a
+warning starting with Perl 5.22. It has been fixed in automake 1.15.1.
+So I think it's a good excuse to bump the versions of autoconf and
+automake used in the gnulib import. And to avoid requiring multiple
+builds of autoconf/automake, it was suggested that we bump the required
+version of those tools for all binutils-gdb.
+
+For autoconf, the 2.69 version is universally available, so it's an easy
+choice. For automake, different distros and distro versions have
+different automake versions. But 1.15.1 seems to be the most readily
+available as a package. In any case, it's easy to build it from source.
+
+I removed the version checks from AUTOMAKE_OPTIONS and AC_PREREQ,
+because I don't think they are useful in our case. They only specify a
+lower bound for the acceptable version of automake/autoconf. That's
+useful if you let the user choose the version of the tool they want to
+use, but want to set a minimum version (because you use a feature that
+was introduced in that version). In our case, we force people to use a
+specific version anyway. For the autoconf version, we have the check in
+config/override.m4 that enforces the version we want. It will be one
+less thing to update next time we change autotools version.
+
+I hit a few categories of problems that required some changes. They are
+described below along with the chosen solutions.
+
+Problem 1:
+
+ configure.ac:17: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see:
+ configure.ac:17: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
+
+Solution 1:
+
+ Adjust the code based on the example at that URL.
+
+Problem 2 (in zlib/):
+
+ Makefile.am: error: required file './INSTALL' not found
+ Makefile.am: 'automake --add-missing' can install 'INSTALL'
+ Makefile.am: error: required file './NEWS' not found
+ Makefile.am: error: required file './AUTHORS' not found
+ Makefile.am: error: required file './COPYING' not found
+ Makefile.am: 'automake --add-missing' can install 'COPYING'
+
+Solution 2:
+
+ Add the foreign option to AUTOMAKE_OPTIONS.
+
+Problem 3:
+
+ doc/Makefile.am:20: error: support for Cygnus-style trees has been removed
+
+Solution 3:
+
+ Remove the cygnus options.
+
+Problem 4:
+
+ Makefile.am:656: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
+
+Solution 4:
+
+ Rename "INCLUDES = " to "AM_CPPFLAGS += " (because AM_CPPFLAGS is
+ already defined earlier).
+
+Problem 5:
+
+ doc/Makefile.am:71: warning: suffix '.texinfo' for Texinfo files is discouraged; use '.texi' instead
+ doc/Makefile.am: warning: Oops!
+ doc/Makefile.am: It appears this file (or files included by it) are triggering
+ doc/Makefile.am: an undocumented, soon-to-be-removed automake hack.
+ doc/Makefile.am: Future automake versions will no longer place in the builddir
+ doc/Makefile.am: (rather than in the srcdir) the generated '.info' files that
+ doc/Makefile.am: appear to be cleaned, by e.g. being listed in CLEANFILES or
+ doc/Makefile.am: DISTCLEANFILES.
+ doc/Makefile.am: If you want your '.info' files to be placed in the builddir
+ doc/Makefile.am: rather than in the srcdir, you have to use the shiny new
+ doc/Makefile.am: 'info-in-builddir' automake option.
+
+Solution 5:
+
+ Rename .texinfo files to .texi.
+
+Problem 6:
+
+ doc/Makefile.am: warning: Oops!
+ doc/Makefile.am: It appears this file (or files included by it) are triggering
+ doc/Makefile.am: an undocumented, soon-to-be-removed automake hack.
+ doc/Makefile.am: Future automake versions will no longer place in the builddir
+ doc/Makefile.am: (rather than in the srcdir) the generated '.info' files that
+ doc/Makefile.am: appear to be cleaned, by e.g. being listed in CLEANFILES or
+ doc/Makefile.am: DISTCLEANFILES.
+ doc/Makefile.am: If you want your '.info' files to be placed in the builddir
+ doc/Makefile.am: rather than in the srcdir, you have to use the shiny new
+ doc/Makefile.am: 'info-in-builddir' automake option.
+
+Solution 6:
+
+ Remove the hack at the bottom of doc/Makefile.am and use
+ the info-in-builddir automake option.
+
+Problem 7:
+
+ doc/Makefile.am:35: error: required file '../texinfo.tex' not found
+ doc/Makefile.am:35: 'automake --add-missing' can install 'texinfo.tex'
+
+Solution 7:
+
+ Use the no-texinfo.tex automake option. We also have one in
+ texinfo/texinfo.tex, not sure if we should point to that, or move it
+ (or a newer version of it added with automake --add-missing) to
+ top-level.
+
+Problem 8:
+
+ Makefile.am:131: warning: source file 'config/tc-aarch64.c' is in a subdirectory,
+ Makefile.am:131: but option 'subdir-objects' is disabled
+ automake: warning: possible forward-incompatibility.
+ automake: At least a source file is in a subdirectory, but the 'subdir-objects'
+ automake: automake option hasn't been enabled. For now, the corresponding output
+ automake: object file(s) will be placed in the top-level directory. However,
+ automake: this behaviour will change in future Automake versions: they will
+ automake: unconditionally cause object files to be placed in the same subdirectory
+ automake: of the corresponding sources.
+ automake: You are advised to start using 'subdir-objects' option throughout your
+ automake: project, to avoid future incompatibilities.
+
+Solution 8:
+
+ Use subdir-objects, that means adjusting references to some .o that will now
+ be in config/.
+
+Problem 9:
+
+ configure.ac:375: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
+ ../../lib/autoconf/lang.m4:193: AC_LANG_CONFTEST is expanded from...
+ ../../lib/autoconf/general.m4:2601: _AC_COMPILE_IFELSE is expanded from...
+ ../../lib/autoconf/general.m4:2617: AC_COMPILE_IFELSE is expanded from...
+ ../../lib/m4sugar/m4sh.m4:639: AS_IF is expanded from...
+ ../../lib/autoconf/general.m4:2042: AC_CACHE_VAL is expanded from...
+ ../../lib/autoconf/general.m4:2063: AC_CACHE_CHECK is expanded from...
+ configure.ac:375: the top level
+
+Solution 9:
+
+ Use AC_LANG_SOURCE, or use proper quoting.
+
+Problem 10 (in intl/):
+
+ configure.ac:7: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
+ /usr/share/aclocal/threadlib.m4:36: gl_THREADLIB_EARLY_BODY is expanded from...
+ /usr/share/aclocal/threadlib.m4:29: gl_THREADLIB_EARLY is expanded from...
+ /usr/share/aclocal/threadlib.m4:318: gl_THREADLIB is expanded from...
+ /usr/share/aclocal/lock.m4:9: gl_LOCK is expanded from...
+ /usr/share/aclocal/intl.m4:211: gt_INTL_SUBDIR_CORE is expanded from...
+ /usr/share/aclocal/intl.m4:25: AM_INTL_SUBDIR is expanded from...
+ /usr/share/aclocal/gettext.m4:57: AM_GNU_GETTEXT is expanded from...
+ configure.ac:7: the top level
+
+Solution 10:
+
+ Add AC_USE_SYSTEM_EXTENSIONS in configure.ac.
+
+diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog
+index 7edd6bfb657..950cde5e27d 100644
+--- a/libdecnumber/ChangeLog
++++ b/libdecnumber/ChangeLog
+@@ -1,3 +1,9 @@
++2018-06-19 Simon Marchi <simon.marchi@ericsson.com>
++
++ * configure.ac: Remove AC_PREREQ.
++ * configure: Re-generate.
++ * aclocal.m4.
++
+ 2018-02-19 Martin Liska <mliska@suse.cz>
+
+ PR c/81272
+diff --git a/libdecnumber/configure.ac b/libdecnumber/configure.ac
+index 108df624c26..16c7465b327 100644
+--- a/libdecnumber/configure.ac
++++ b/libdecnumber/configure.ac
+@@ -19,7 +19,6 @@
+ # along with GCC; see the file COPYING3. If not see
+ # <http://www.gnu.org/licenses/>.
+
+-AC_PREREQ(2.64)
+ AC_INIT(libdecnumber, [ ], gcc-bugs@gcc.gnu.org, libdecnumber)
+ AC_CONFIG_SRCDIR(decNumber.h)
+ AC_CONFIG_MACRO_DIR(../config)
new file mode 100644
@@ -0,0 +1,42 @@
+From 60b42421e900f9bb186c306a657f41b88e422bcd Mon Sep 17 00:00:00 2001
+From: Marek Polacek <polacek@redhat.com>
+Date: Mon, 7 Aug 2023 13:07:12 +0200
+Subject: [PATCH] configure: Implement --enable-host-pie
+
+This patch implements the --enable-host-pie configure option which
+makes the compiler executables PIE. This can be used to enhance
+protection against ROP attacks, and can be viewed as part of a wider
+trend to harden binaries.
+
+Co-Authored by: Iain Sandoe <iain@sandoe.co.uk>
+
+diff --git a/libdecnumber/configure.ac b/libdecnumber/configure.ac
+index 16c7465b327..2e95b829dc0 100644
+--- a/libdecnumber/configure.ac
++++ b/libdecnumber/configure.ac
+@@ -99,8 +99,23 @@ AC_C_BIGENDIAN
+ # Enable --enable-host-shared.
+ AC_ARG_ENABLE(host-shared,
+ [AS_HELP_STRING([--enable-host-shared],
+- [build host code as shared libraries])],
+-[PICFLAG=-fPIC], [PICFLAG=])
++ [build host code as shared libraries])])
++AC_SUBST(enable_host_shared)
++
++# Enable --enable-host-pie.
++AC_ARG_ENABLE(host-pie,
++[AS_HELP_STRING([--enable-host-pie],
++ [build host code as PIE])])
++AC_SUBST(enable_host_pie)
++
++if test x$enable_host_shared = xyes; then
++ PICFLAG=-fPIC
++elif test x$enable_host_pie = xyes; then
++ PICFLAG=-fPIE
++else
++ PICFLAG=
++fi
++
+ AC_SUBST(PICFLAG)
+
+ # Output.
new file mode 100644
@@ -0,0 +1,52 @@
+diff --git a/libdecnumber/ChangeLog b/libdecnumber/ChangeLog
+index cb1dceb21c8..0bc98232249 100644
+--- a/libdecnumber/ChangeLog
++++ b/libdecnumber/ChangeLog
+@@ -1,3 +1,11 @@
++2020-07-29 Simon Marchi <simon.marchi@efficios.com>
++
++ * aclocal.m4, configure: Re-generate.
++
++2018-10-31 Joseph Myers <joseph@codesourcery.com>
++
++ * configure: Regenerate.
++
+ 2018-06-19 Simon Marchi <simon.marchi@ericsson.com>
+
+ * configure.ac: Remove AC_PREREQ.
+@@ -54,21 +62,13 @@
+
+ Update copyright years.
+
+-2015-06-30 H.J. Lu <hongjiu.lu@intel.com>
++2015-07-14 H.J. Lu <hongjiu.lu@intel.com>
+
+ * configure: Regenerated.
+
+-2015-05-13 Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
+-
+- * aclocal.m4: Regenerated with automake-1.11.6.
+-
+-2015-01-05 Jakub Jelinek <jakub@redhat.com>
+-
+- Update copyright years.
+-
+-2014-11-11 David Malcolm <dmalcolm@redhat.com>
++2015-06-30 H.J. Lu <hongjiu.lu@intel.com>
+
+- * ChangeLog.jit: New.
++ * configure: Regenerated.
+
+ 2015-01-22 Eli Zaretskii <eliz@gnu.org>
+
+@@ -79,10 +79,6 @@
+ PR c/59871
+ * decNumberLocal.h (UBFROMUS, UBFROMUI): Remove last argument.
+
+-2014-01-02 Richard Sandiford <rdsandiford@googlemail.com>
+-
+- Update copyright years
+-
+ 2013-10-15 David Malcolm <dmalcolm@redhat.com>
+
+ * Makefile.in (PICFLAG): New.
new file mode 100644
@@ -0,0 +1,45 @@
+From b1741ab0dafd899889faab6e862094a325a6b83c Mon Sep 17 00:00:00 2001
+From: Tom Tromey <tom@tromey.com>
+Date: Sat, 30 Mar 2024 13:48:30 -0600
+Subject: [PATCH] libiberty: Invoke D demangler when --format=auto
+
+Investigating GDB PR d/31580 showed that the libiberty demangler
+doesn't automatically demangle D mangled names. However, I think it
+should -- like C++ and Rust (new-style), D mangled names are readily
+distinguished by the leading "_D", and so the likelihood of confusion
+is low. The other non-"auto" cases in this code are Ada (where the
+encoded form could more easily be confused by ordinary programs) and
+Java (which is long gone, but which also shared the C++ mangling and
+thus was just an output style preference).
+
+This patch also fixed another GDB bug, though of course that part
+won't apply to the GCC repository.
+
+Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31580
+Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30276
+diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c
+index 8b92946981f..ee9e84f5d6b 100644
+--- a/libiberty/cplus-dem.c
++++ b/libiberty/cplus-dem.c
+@@ -186,7 +186,7 @@ cplus_demangle (const char *mangled, int options)
+ if (GNAT_DEMANGLING)
+ return ada_demangle (mangled, options);
+
+- if (DLANG_DEMANGLING)
++ if (DLANG_DEMANGLING || AUTO_DEMANGLING)
+ {
+ ret = dlang_demangle (mangled, options);
+ if (ret)
+diff --git a/libiberty/testsuite/d-demangle-expected b/libiberty/testsuite/d-demangle-expected
+index 47b059c4298..cfbdf2a52cb 100644
+--- a/libiberty/testsuite/d-demangle-expected
++++ b/libiberty/testsuite/d-demangle-expected
+@@ -1470,3 +1470,8 @@ demangle.anonymous
+ --format=dlang
+ _D8demangle9anonymous03fooZ
+ demangle.anonymous.foo
++#
++# Test that 'auto' works.
++--format=auto
++_D8demangle9anonymous03fooZ
++demangle.anonymous.foo
new file mode 100644
@@ -0,0 +1,49 @@
+From 219822fd5db6305592b45677a3b38c02b523360e Mon Sep 17 00:00:00 2001
+From: "H.J. Lu" <hjl.tools@gmail.com>
+Date: Tue, 9 Apr 2024 06:39:21 -0700
+Subject: [PATCH] mmap: Avoid the sanitizer configure check failure
+
+When -fsanitize=address,undefined is used to build, the mmap configure
+check failed with
+
+=================================================================
+==231796==ERROR: LeakSanitizer: detected memory leaks
+
+Direct leak of 4096 byte(s) in 1 object(s) allocated from:
+ #0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
+ #1 0x5750c7f6d72b in main /home/alan/build/gas-san/all/bfd/conftest.c:239
+
+Direct leak of 4096 byte(s) in 1 object(s) allocated from:
+ #0 0x7cdd3d0defdf in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:69
+ #1 0x5750c7f6d2e1 in main /home/alan/build/gas-san/all/bfd/conftest.c:190
+
+SUMMARY: AddressSanitizer: 8192 byte(s) leaked in 2 allocation(s).
+
+Define GCC_AC_FUNC_MMAP with export ASAN_OPTIONS=detect_leaks=0 to avoid
+the sanitizer configure check failure.
+
+diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
+index 85c4b6b6ef8..b77a41c781c 100644
+--- a/libiberty/Makefile.in
++++ b/libiberty/Makefile.in
+@@ -508,6 +508,7 @@ aclocal_deps = \
+ $(srcdir)/../config/cet.m4 \
+ $(srcdir)/../config/enable.m4 \
+ $(srcdir)/../config/gcc-plugin.m4 \
++ $(srcdir)/../config/mmap.m4 \
+ $(srcdir)/../config/no-executables.m4 \
+ $(srcdir)/../config/override.m4 \
+ $(srcdir)/../config/picflag.m4 \
+diff --git a/libiberty/acinclude.m4 b/libiberty/acinclude.m4
+index 9974dcd4ec5..d08e31bc0b5 100644
+--- a/libiberty/acinclude.m4
++++ b/libiberty/acinclude.m4
+@@ -19,7 +19,7 @@ dnl On some versions of SunOS4 at least, strncmp reads a word at a time
+ dnl but erroneously reads past the end of strings. This can cause
+ dnl a SEGV in some cases.
+ AC_DEFUN([libiberty_AC_FUNC_STRNCMP],
+-[AC_REQUIRE([AC_FUNC_MMAP])
++[AC_REQUIRE([GCC_AC_FUNC_MMAP])
+ AC_CACHE_CHECK([for working strncmp], ac_cv_func_strncmp_works,
+ [AC_TRY_RUN([
+ /* Test by Jim Wilson and Kaveh Ghazi.
new file mode 100644
@@ -0,0 +1,102 @@
+diff --git a/Makefile.in b/Makefile.in
+index 8dd5ca578c8..bcbd18b662a 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -228,7 +228,17 @@ examples: force
+
+ force:
+
+-install: $(INSTALL_TARGETS)
++## GDB LOCAL
++## Don't mess with people's installed readline's.
++## This tries to install this version of readline over whatever
++## version is already installed on the system (which could be a
++## newer version). There is no real reason for us to install
++## readline along with GDB. GDB links statically against readline,
++## so it doesn't depend on us installing it on the system.
++
++install:
++
++#install: $(INSTALL_TARGETS)
+
+ install-headers: installdirs ${INSTALLED_HEADERS}
+ for f in ${INSTALLED_HEADERS}; do \
+diff --git a/configure.ac b/configure.ac
+index 147bae57733..912c99b6575 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -22,13 +22,17 @@ dnl Process this file with autoconf to produce a configure script.
+
+ AC_REVISION([for Readline 8.1, version 2.90])
+
++m4_include([../../config/override.m4])
++
+ AC_INIT(readline, 8.1, bug-readline@gnu.org)
+
+ dnl make sure we are using a recent autoconf version
+ AC_PREREQ(2.50)
+
+ AC_CONFIG_SRCDIR(readline.h)
+-AC_CONFIG_AUX_DIR(./support)
++dnl GDB LOCAL
++dnl AC_CONFIG_AUX_DIR(./support)
++AC_CONFIG_AUX_DIR(../..)
+ AC_CONFIG_HEADERS(config.h)
+
+ dnl update the value of RL_READLINE_VERSION in readline.h when this changes
+@@ -50,12 +54,12 @@ fi
+ dnl option parsing for optional features
+ opt_multibyte=yes
+ opt_static_libs=yes
+-opt_shared_libs=yes
+-opt_install_examples=yes
++opt_shared_libs=no
++opt_install_examples=no
+ opt_bracketed_paste_default=yes
+
+ AC_ARG_ENABLE(multibyte, AC_HELP_STRING([--enable-multibyte], [enable multibyte characters if OS supports them]), opt_multibyte=$enableval)
+-AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
++dnl AC_ARG_ENABLE(shared, AC_HELP_STRING([--enable-shared], [build shared libraries [[default=YES]]]), opt_shared_libs=$enableval)
+ AC_ARG_ENABLE(static, AC_HELP_STRING([--enable-static], [build static libraries [[default=YES]]]), opt_static_libs=$enableval)
+ AC_ARG_ENABLE(install-examples, AC_HELP_STRING([--disable-install-examples], [don't install examples [[default=install]]]), opt_install_examples=$enableval)
+
+diff --git a/doc/hsuser.texi b/doc/hsuser.texi
+index 521ccc708ba..e92c794b39c 100644
+--- a/doc/hsuser.texi
++++ b/doc/hsuser.texi
+@@ -26,9 +26,10 @@ into another language, under the above conditions for modified versions.
+ @node Using History Interactively
+ @chapter Using History Interactively
+
+-@ifclear BashFeatures
+-@defcodeindex bt
+-@end ifclear
++@c GDB bundling modification:
++@c @ifclear BashFeatures
++@c @defcodeindex bt
++@c @end ifclear
+
+ @ifset BashFeatures
+ This chapter describes how to use the @sc{gnu} History Library
+@@ -41,7 +42,8 @@ see the @sc{gnu} Readline Library Manual.
+ This chapter describes how to use the @sc{gnu} History Library interactively,
+ from a user's standpoint. It should be considered a user's guide. For
+ information on using the @sc{gnu} History Library in your own programs,
+-@pxref{Programming with GNU History}.
++@c GDB bundling modification:
++@pxref{Programming with GNU History, , , history, GNU History Library}.
+ @end ifclear
+
+ @ifset BashFeatures
+diff --git a/examples/rlfe/configure.in b/examples/rlfe/configure.in
+index ad7ce65fc06..5c0678ab4d8 100644
+--- a/examples/rlfe/configure.in
++++ b/examples/rlfe/configure.in
+@@ -1,5 +1,7 @@
+ dnl Process this file with autoconf to produce a configure script.
+
++m4_include([../../../../config/override.m4])
++
+ AC_INIT(rlfe.c)
+ AC_CONFIG_HEADER(config.h)
+ VERSION=0.4
new file mode 100644
@@ -0,0 +1,40 @@
+From 19a918553721d68a742929295d6a34ce3266d3c1 Mon Sep 17 00:00:00 2001
+From: Tom Tromey <tom@tromey.com>
+Date: Tue, 2 Mar 2021 13:42:37 -0700
+Subject: [PATCH 2/5] Fix Readline 8.1 build on mingw
+
+The mingw build fails with Readline 8.1, because sigprocmask is called
+unconditionally. This patch adds the missing check for
+HAVE_POSIX_SIGNALS.
+
+I reported this upstream here:
+
+ https://lists.gnu.org/archive/html/bug-readline/2021-01/msg00011.html
+
+readline/ChangeLog
+2021-03-02 Tom Tromey <tom@tromey.com>
+
+ * readline/signals.c (_rl_handle_signal): Add missing check for
+ HAVE_POSIX_SIGNALS.
+---
+ readline/readline/signals.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/signals.c b/signals.c
+index f9174ab8a01..8fedc370a1a 100644
+--- a/signals.c
++++ b/signals.c
+@@ -266,8 +266,10 @@ _rl_handle_signal (int sig)
+ case SIGQUIT:
+ #endif
+
++#if defined (HAVE_POSIX_SIGNALS)
+ if (block_sig)
+ sigprocmask (SIG_BLOCK, &set, &oset);
++#endif
+
+ rl_echo_signal_char (sig);
+ rl_cleanup_after_signal ();
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,255 @@
+From 4fb7bc4b147fd30b781ea2dad533956d0362295a Mon Sep 17 00:00:00 2001
+From: Andrew Burgess <aburgess@redhat.com>
+Date: Mon, 7 Mar 2022 13:49:21 +0000
+Subject: [PATCH 3/5] readline: back-port changes needed to properly detect EOF
+
+This commit is a partial back-port of this upstream readline commit:
+
+ commit 002d31aa5f5929eb32d0e0e2e8b8d35d99e59961
+ Author: Chet Ramey <chet.ramey@case.edu>
+ Date: Thu Mar 3 11:11:47 2022 -0500
+
+ add rl_eof_found to public API; fix pointer aliasing problems \
+ with history-search-backward; fix a display problem with \
+ runs of invisible characters at the end of a physical \
+ screen line
+
+I have only pulled in the parts of this commit that relate to the new
+rl_eof_found global, and the RL_STATE_EOF state flag. These changes
+are needed in order to fix PR cli/28833, and are discussed in this
+thread to the bug-readline mailing list:
+
+ https://lists.gnu.org/archive/html/bug-readline/2022-02/msg00021.html
+
+The above commit is not yet in any official readline release, but my
+hope is that now it has been merged into the readline tree it should
+be safe enough to back port this fix to GDB's tree.
+
+At some point in the future we will inevitably want to roll forward
+the version of readline that we maintain in the binutils-gdb
+repository. When that day comes the changes in this commit can be
+replaced with the latest upstream readline code, as I have not changed
+the meaning of this code at all from what is in upstream readline.
+
+This commit alone does not fix the PR cli/28833 issue, for that see
+the next commit, which changes GDB itself.
+
+Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28833
+---
+ readline/readline/callback.c | 8 +++++++-
+ readline/readline/doc/rltech.texi | 11 +++++++++++
+ readline/readline/readline.c | 19 ++++++++++++-------
+ readline/readline/readline.h | 8 +++++++-
+ readline/readline/rlprivate.h | 1 -
+ readline/readline/rltty.c | 4 ++--
+ 6 files changed, 39 insertions(+), 12 deletions(-)
+
+diff --git a/callback.c b/callback.c
+index a466cf9b6ef..58b84d2e2ad 100644
+--- a/callback.c
++++ b/callback.c
+@@ -1,6 +1,6 @@
+ /* callback.c -- functions to use readline as an X `callback' mechanism. */
+
+-/* Copyright (C) 1987-2017 Free Software Foundation, Inc.
++/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
+
+ This file is part of the GNU Readline Library (Readline), a library
+ for reading lines of text with interactive input and history editing.
+@@ -136,6 +136,8 @@ rl_callback_read_char (void)
+ abort ();
+ }
+
++ eof = 0;
++
+ memcpy ((void *)olevel, (void *)_rl_top_level, sizeof (procenv_t));
+ #if defined (HAVE_POSIX_SIGSETJMP)
+ jcode = sigsetjmp (_rl_top_level, 0);
+@@ -268,6 +270,10 @@ rl_callback_read_char (void)
+ _rl_want_redisplay = 0;
+ }
+
++ /* Make sure application hooks can see whether we saw EOF. */
++ if (rl_eof_found = eof)
++ RL_SETSTATE(RL_STATE_EOF);
++
+ if (rl_done)
+ {
+ line = readline_internal_teardown (eof);
+diff --git a/doc/rltech.texi b/doc/rltech.texi
+index bbf57c239c9..797e34d95e0 100644
+--- a/doc/rltech.texi
++++ b/doc/rltech.texi
+@@ -323,6 +323,14 @@ and point define a @emph{region}.
+ @deftypevar int rl_done
+ Setting this to a non-zero value causes Readline to return the current
+ line immediately.
++Readline will set this variable when it has read a key sequence bound
++to @code{accept-line} and is about to return the line to the caller.
++@end deftypevar
++
++@deftypevar int rl_eof_found
++Readline will set this variable when it has read an EOF character (e.g., the
++stty @samp{EOF} character) on an empty line or encountered a read error and
++is about to return a NULL line to the caller.
+ @end deftypevar
+
+ @deftypevar int rl_num_chars_to_read
+@@ -588,6 +596,9 @@ the current call to @code{readline()}.
+ @item RL_STATE_DONE
+ Readline has read a key sequence bound to @code{accept-line}
+ and is about to return the line to the caller.
++@item RL_STATE_EOF
++Readline has read an EOF character (e.g., the stty @samp{EOF} character)
++or encountered a read error and is about to return a NULL line to the caller.
+ @end table
+
+ @end deftypevar
+diff --git a/readline.c b/readline.c
+index e61d188bbe9..0e33587f234 100644
+--- a/readline.c
++++ b/readline.c
+@@ -1,7 +1,7 @@
+ /* readline.c -- a general facility for reading lines of input
+ with emacs style editing and completion. */
+
+-/* Copyright (C) 1987-2020 Free Software Foundation, Inc.
++/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
+
+ This file is part of the GNU Readline Library (Readline), a library
+ for reading lines of text with interactive input and history editing.
+@@ -165,6 +165,9 @@ int rl_end;
+ /* Make this non-zero to return the current input_line. */
+ int rl_done;
+
++/* If non-zero when readline_internal returns, it means we found EOF */
++int rl_eof_found = 0;
++
+ /* The last function executed by readline. */
+ rl_command_func_t *rl_last_func = (rl_command_func_t *)NULL;
+
+@@ -218,9 +221,6 @@ int _rl_eof_char = CTRL ('D');
+ /* Non-zero makes this the next keystroke to read. */
+ int rl_pending_input = 0;
+
+-/* If non-zero when readline_internal returns, it means we found EOF */
+-int _rl_eof_found = 0;
+-
+ /* Pointer to a useful terminal name. */
+ const char *rl_terminal_name = (const char *)NULL;
+
+@@ -474,6 +474,9 @@ readline_internal_teardown (int eof)
+
+ RL_CHECK_SIGNALS ();
+
++ if (eof)
++ RL_SETSTATE (RL_STATE_EOF); /* XXX */
++
+ /* Restore the original of this history line, iff the line that we
+ are editing was originally in the history, AND the line has changed. */
+ entry = current_history ();
+@@ -596,6 +599,7 @@ readline_internal_charloop (void)
+ RL_SETSTATE(RL_STATE_DONE);
+ return (rl_done = 1);
+ #else
++ RL_SETSTATE(RL_STATE_EOF);
+ eof_found = 1;
+ break;
+ #endif
+@@ -636,6 +640,7 @@ readline_internal_charloop (void)
+ RL_SETSTATE(RL_STATE_DONE);
+ return (rl_done = 1);
+ #else
++ RL_SETSTATE(RL_STATE_EOF);
+ eof_found = 1;
+ break;
+ #endif
+@@ -703,8 +708,8 @@ static char *
+ readline_internal (void)
+ {
+ readline_internal_setup ();
+- _rl_eof_found = readline_internal_charloop ();
+- return (readline_internal_teardown (_rl_eof_found));
++ rl_eof_found = readline_internal_charloop ();
++ return (readline_internal_teardown (rl_eof_found));
+ }
+
+ void
+@@ -1161,7 +1166,7 @@ rl_initialize (void)
+
+ /* We aren't done yet. We haven't even gotten started yet! */
+ rl_done = 0;
+- RL_UNSETSTATE(RL_STATE_DONE);
++ RL_UNSETSTATE(RL_STATE_DONE|RL_STATE_EOF);
+
+ /* Tell the history routines what is going on. */
+ _rl_start_using_history ();
+diff --git a/readline.h b/readline.h
+index 78fa39d02a1..9f79810f290 100644
+--- a/readline.h
++++ b/readline.h
+@@ -1,6 +1,6 @@
+ /* Readline.h -- the names of functions callable from within readline. */
+
+-/* Copyright (C) 1987-2020 Free Software Foundation, Inc.
++/* Copyright (C) 1987-2022 Free Software Foundation, Inc.
+
+ This file is part of the GNU Readline Library (Readline), a library
+ for reading lines of text with interactive input and history editing.
+@@ -553,6 +553,10 @@ extern int rl_mark;
+ line and should return it. */
+ extern int rl_done;
+
++/* Flag to indicate that readline has read an EOF character or read has
++ returned 0 or error, and is returning a NULL line as a result. */
++extern int rl_eof_found;
++
+ /* If set to a character value, that will be the next keystroke read. */
+ extern int rl_pending_input;
+
+@@ -906,6 +910,8 @@ extern int rl_persistent_signal_handlers;
+ #define RL_STATE_REDISPLAYING 0x1000000 /* updating terminal display */
+
+ #define RL_STATE_DONE 0x2000000 /* done; accepted line */
++#define RL_STATE_EOF 0x8000000 /* done; got eof on read */
++
+
+ #define RL_SETSTATE(x) (rl_readline_state |= (x))
+ #define RL_UNSETSTATE(x) (rl_readline_state &= ~(x))
+diff --git a/rlprivate.h b/rlprivate.h
+index 23ab2d8cec0..02838ae21ae 100644
+--- a/rlprivate.h
++++ b/rlprivate.h
+@@ -544,7 +544,6 @@ extern FILE *_rl_in_stream;
+ extern FILE *_rl_out_stream;
+ extern int _rl_last_command_was_kill;
+ extern int _rl_eof_char;
+-extern int _rl_eof_found;
+ extern procenv_t _rl_top_level;
+ extern _rl_keyseq_cxt *_rl_kscxt;
+ extern int _rl_keyseq_timeout;
+diff --git a/rltty.c b/rltty.c
+index d0cd572713a..11997b7c9d8 100644
+--- a/rltty.c
++++ b/rltty.c
+@@ -1,7 +1,7 @@
+ /* rltty.c -- functions to prepare and restore the terminal for readline's
+ use. */
+
+-/* Copyright (C) 1992-2017 Free Software Foundation, Inc.
++/* Copyright (C) 1992-2022 Free Software Foundation, Inc.
+
+ This file is part of the GNU Readline Library (Readline), a library
+ for reading lines of text with interactive input and history editing.
+@@ -692,7 +692,7 @@ rl_deprep_terminal (void)
+ if (terminal_prepped & TPX_BRACKPASTE)
+ {
+ fprintf (rl_outstream, BRACK_PASTE_FINI);
+- if (_rl_eof_found)
++ if (rl_eof_found)
+ fprintf (rl_outstream, "\n");
+ }
+
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,81 @@
+From 8f3babfaf8ea582bed93fd6abcde7bfc96d3a8dd Mon Sep 17 00:00:00 2001
+From: Andrew Burgess <aburgess@redhat.com>
+Date: Tue, 26 Apr 2022 15:08:02 +0100
+Subject: [PATCH 4/5] gdb/readline: fix extra 'quit' message problem
+
+After these two commits:
+
+ commit 4fb7bc4b147fd30b781ea2dad533956d0362295a
+ Date: Mon Mar 7 13:49:21 2022 +0000
+
+ readline: back-port changes needed to properly detect EOF
+
+ commit 91395d97d905c31ac38513e4aaedecb3b25e818f
+ Date: Tue Feb 15 17:28:03 2022 +0000
+
+ gdb: handle bracketed-paste-mode and EOF correctly
+
+It was observed that, if a previous command is selected at the
+readline prompt using the up arrow key, then when the command is
+accepted (by pressing return) an unexpected 'quit' message will be
+printed by GDB. Here's an example session:
+
+ (gdb) p 123
+ $1 = 123
+ (gdb) p 123
+ quit
+ $2 = 123
+ (gdb)
+
+In this session the second 'p 123' was entered not by typing 'p 123',
+but by pressing the up arrow key to select the previous command. It
+is important that the up arrow key is used, typing Ctrl-p will not
+trigger the bug.
+
+The problem here appears to be readline's EOF detection when handling
+multi-character input sequences. I have raised this issue on the
+readline mailing list here:
+
+ https://lists.gnu.org/archive/html/bug-readline/2022-04/msg00012.html
+
+a solution has been proposed here:
+
+ https://lists.gnu.org/archive/html/bug-readline/2022-04/msg00016.html
+
+This patch includes a test for this issue as well as a back-port of
+(the important bits of) readline commit:
+
+ commit 2ef9cec8c48ab1ae3a16b1874a49bd1f58eaaca1
+ Date: Wed May 4 11:18:04 2022 -0400
+
+ fix for setting RL_STATE_EOF in callback mode
+
+That commit also includes some updates to the readline documentation
+and tests that I have not included in this commit.
+
+With this commit in place the unexpected 'quit' messages are resolved.
+---
+ readline/readline/callback.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/callback.c b/callback.c
+index 58b84d2e2ad..93f23d97bc2 100644
+--- a/callback.c
++++ b/callback.c
+@@ -271,8 +271,11 @@ rl_callback_read_char (void)
+ }
+
+ /* Make sure application hooks can see whether we saw EOF. */
+- if (rl_eof_found = eof)
+- RL_SETSTATE(RL_STATE_EOF);
++ if (eof > 0)
++ {
++ rl_eof_found = eof;
++ RL_SETSTATE(RL_STATE_EOF);
++ }
+
+ if (rl_done)
+ {
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,119 @@
+From 85f4cf41a852b5983ca436615a019315f6dc7301 Mon Sep 17 00:00:00 2001
+From: Tom de Vries <tdevries@suse.de>
+Date: Sun, 28 May 2023 10:17:57 +0200
+Subject: [PATCH 5/5] [readline] Fix double free in _rl_scxt_dispose
+
+Consider the following scenario. We start gdb in TUI mode:
+...
+$ gdb -q -tui
+...
+and type ^R which gives us the reverse-isearch prompt in the cmd window:
+...
+(reverse-i-search)`':
+...
+and then type "foo", right-arrow-key, and ^C.
+
+In TUI mode, gdb uses a custom rl_getc_function tui_getc.
+
+When pressing the right-arrow-key, tui_getc:
+- attempts to scroll the TUI src window, without any effect, and
+- returns 0.
+
+The intention of returning 0 is mentioned here in tui_dispatch_ctrl_char:
+...
+ /* We intercepted the control character, so return 0 (which readline
+ will interpret as a no-op). */
+ return 0;
+...
+
+However, after this 0 is returned by the rl_read_key () call in
+_rl_search_getchar, _rl_read_mbstring is called, which incorrectly interprets
+0 as the first part of an utf-8 multibyte char, and tries to read the next
+char.
+
+In this state, the ^C takes effect and we run into a double free because
+_rl_isearch_cleanup is called twice.
+
+Both these issues need fixing independently, though after fixing the first we
+no longer trigger the second.
+
+The first issue is caused by the subtle difference between:
+- a char array containing 0 chars, which is zero-terminated, and
+- a char array containing 1 char, which is zero.
+
+In mbrtowc terms, this is the difference between:
+...
+ mbrtowc (&wc, "", 0, &ps);
+...
+which returns -2, and:
+...
+ mbrtowc (&wc, "", 1, &ps);
+...
+which returns 0.
+
+Note that _rl_read_mbstring calls _rl_get_char_len without passing it an
+explicit length parameter, and consequently it cannot distinguish between the
+two, and defaults to the "0 chars" choice.
+
+Note that the same problem doesn't exist in _rl_read_mbchar.
+
+Fix this by defaulting to the "1 char" choice in _rl_get_char_len:
+...
+- if (_rl_utf8locale && l > 0 && UTF8_SINGLEBYTE(*src))
++ if (_rl_utf8locale && l >= 0 && UTF8_SINGLEBYTE(*src))
+...
+
+The second problem happens when the call to _rl_search_getchar in
+_rl_isearch_callback returns. At that point _rl_isearch_cleanup has already
+been called from the signal handler, but we proceed regardless, using a cxt
+pointer that has been freed.
+
+Fix this by checking for "RL_ISSTATE (RL_STATE_ISEARCH)" after the call to
+_rl_search_getchar:
+...
+ c = _rl_search_getchar (cxt);
++ if (!RL_ISSTATE (RL_STATE_ISEARCH))
++ return 1;
+...
+
+Tested on x86_64-linux.
+
+Approved-By: Chet Ramey <chet.ramey@case.edu>
+
+PR tui/30056
+Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30056
+---
+ readline/readline/isearch.c | 3 +++
+ readline/readline/mbutil.c | 2 +-
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/isearch.c b/isearch.c
+index 080ba3cbb9c..941078f790e 100644
+--- a/isearch.c
++++ b/isearch.c
+@@ -882,6 +882,9 @@ _rl_isearch_callback (_rl_search_cxt *cxt)
+ int c, r;
+
+ c = _rl_search_getchar (cxt);
++ if (!RL_ISSTATE (RL_STATE_ISEARCH))
++ return 1;
++
+ /* We might want to handle EOF here */
+ r = _rl_isearch_dispatch (cxt, cxt->lastc);
+
+diff --git a/mbutil.c b/mbutil.c
+index dc62b4cc24d..7da3ff17bb5 100644
+--- a/mbutil.c
++++ b/mbutil.c
+@@ -363,7 +363,7 @@ _rl_get_char_len (char *src, mbstate_t *ps)
+
+ /* Look at no more than MB_CUR_MAX characters */
+ l = (size_t)strlen (src);
+- if (_rl_utf8locale && l > 0 && UTF8_SINGLEBYTE(*src))
++ if (_rl_utf8locale && l >= 0 && UTF8_SINGLEBYTE(*src))
+ tmp = (*src != 0) ? 1 : 0;
+ else
+ {
+--
+2.45.1
+
new file mode 100644
@@ -0,0 +1,10 @@
+diff --git a/examples/rlfe/ChangeLog b/examples/rlfe/ChangeLog
+index ba41b2b7205..b752ce1a04f 100644
+--- a/examples/rlfe/ChangeLog
++++ b/examples/rlfe/ChangeLog
+@@ -1,4 +1,4 @@
+-2004-11-04 Per Bothner <per@bothner.com>
++2019-10-23 Per Bothner <per@bothner.com>
+
+ * pty.c: Import from screen-4.0.2.
+ * configure.in, Makefile.in, config.h.in: Set up autoconf handling,