From 2dd4b4a5f9ab6a5dd9c91489f88576d992a34918 Mon Sep 17 00:00:00 2001
From: David Seifert <soap@gentoo.org>
Date: Tue, 24 Dec 2019 00:02:51 +0100
Subject: [PATCH] sys-devel/libtool: Port to EAPI 7

* Rebase all patches

Acked-by: Lars Wendler <polynomial-c@gentoo.org>
Package-Manager: Portage-2.3.82, Repoman-2.3.20
Signed-off-by: David Seifert <soap@gentoo.org>
Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
---
 .../libtool-2.2.6a-darwin-module-bundle.patch |   8 +-
 ...tool-2.4.3-use-linux-version-in-fbsd.patch |   8 +-
 ...btool-2.4.6-darwin-use-linux-version.patch |   6 +-
 .../files/libtool-2.4.6-link-fsanitize.patch  |  16 +--
 .../files/libtool-2.4.6-link-fuse-ld.patch    |  15 +--
 .../files/libtool-2.4.6-link-specs.patch      |  16 +--
 .../libtool/files/libtool-2.4.6-mint.patch    |  21 ++--
 .../libtool-2.4.6-pthread_bootstrapped.patch  |   6 +-
 .../libtool-2.4.6-sed-quote-speedup.patch     |  41 ++-----
 sys-devel/libtool/libtool-2.4.6-r6.ebuild     | 114 ++++++++++++++++++
 10 files changed, 156 insertions(+), 95 deletions(-)
 create mode 100644 sys-devel/libtool/libtool-2.4.6-r6.ebuild

diff --git a/sys-devel/libtool/files/libtool-2.2.6a-darwin-module-bundle.patch b/sys-devel/libtool/files/libtool-2.2.6a-darwin-module-bundle.patch
index c6b63ed32766..81364d4d02af 100644
--- a/sys-devel/libtool/files/libtool-2.2.6a-darwin-module-bundle.patch
+++ b/sys-devel/libtool/files/libtool-2.2.6a-darwin-module-bundle.patch
@@ -11,10 +11,10 @@ in this context refers to the binary itself, not to a structured
 hierarchy. Bundles have the .bundle extension; for example,
 MyBundle.bundle.)
 
---- libltdl/m4/libtool.m4
-+++ libltdl/m4/libtool.m4
-@@ -2271,7 +2271,7 @@
-   soname_spec='${libname}${release}${major}$shared_ext'
+--- a/m4/libtool.m4
++++ b/m4/libtool.m4
+@@ -2645,7 +2645,7 @@
+   soname_spec='$libname$release$major$shared_ext'
    shlibpath_overrides_runpath=yes
    shlibpath_var=DYLD_LIBRARY_PATH
 -  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
diff --git a/sys-devel/libtool/files/libtool-2.4.3-use-linux-version-in-fbsd.patch b/sys-devel/libtool/files/libtool-2.4.3-use-linux-version-in-fbsd.patch
index 8244eaa7e3e7..aa1e870649b6 100644
--- a/sys-devel/libtool/files/libtool-2.4.3-use-linux-version-in-fbsd.patch
+++ b/sys-devel/libtool/files/libtool-2.4.3-use-linux-version-in-fbsd.patch
@@ -7,7 +7,7 @@ http://bugs.gentoo.org/109105
 
 --- a/m4/libtool.m4
 +++ b/m4/libtool.m4
-@@ -1375,7 +1375,14 @@
+@@ -2666,7 +2666,14 @@
      *) objformat=elf ;;
      esac
    fi
@@ -22,9 +22,9 @@ http://bugs.gentoo.org/109105
 +
    case $version_type in
      freebsd-elf*)
-       library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-@@ -1386,6 +1392,12 @@
-       library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+       library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+@@ -2678,6 +2685,12 @@
+       library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
        need_version=yes
        ;;
 +    linux)
diff --git a/sys-devel/libtool/files/libtool-2.4.6-darwin-use-linux-version.patch b/sys-devel/libtool/files/libtool-2.4.6-darwin-use-linux-version.patch
index b4409815f8b4..aded304989d2 100644
--- a/sys-devel/libtool/files/libtool-2.4.6-darwin-use-linux-version.patch
+++ b/sys-devel/libtool/files/libtool-2.4.6-darwin-use-linux-version.patch
@@ -1,8 +1,8 @@
 * revert old 1.5 behaviour
 
---- libtool-2.4.6/m4/libtool.m4
-+++ libtool-2.4.6/m4/libtool.m4
-@@ -2272,7 +2272,7 @@
+--- a/m4/libtool.m4
++++ b/m4/libtool.m4
+@@ -2641,7 +2641,7 @@
    version_type=darwin
    need_lib_prefix=no
    need_version=no
diff --git a/sys-devel/libtool/files/libtool-2.4.6-link-fsanitize.patch b/sys-devel/libtool/files/libtool-2.4.6-link-fsanitize.patch
index c1ea8a82940f..853a22eff54f 100644
--- a/sys-devel/libtool/files/libtool-2.4.6-link-fsanitize.patch
+++ b/sys-devel/libtool/files/libtool-2.4.6-link-fsanitize.patch
@@ -13,15 +13,10 @@ linker to allow trivial use of the clang address sanitizer.
 
 Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@macports.org>
 Copyright-paperwork-exempt: Yes
----
- build-aux/ltmain.in | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
 
-diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
-index 1cbe875..2a5aaad 100644
 --- a/build-aux/ltmain.in
 +++ b/build-aux/ltmain.in
-@@ -5382,10 +5382,11 @@ func_mode_link ()
+@@ -5362,10 +5362,11 @@
        # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
        # -specs=*             GCC specs files
        # -stdlib=*            select c++ std lib with clang
@@ -34,13 +29,9 @@ index 1cbe875..2a5aaad 100644
          func_quote_for_eval "$arg"
  	arg=$func_quote_for_eval_result
          func_append compile_command " $arg"
-
-patch the generated file too to keep help2man from generating man pages
-https://bugs.gentoo.org/556512
-
 --- a/build-aux/ltmain.sh
 +++ b/build-aux/ltmain.sh
-@@ -5382,10 +5382,11 @@ func_mode_link ()
+@@ -7274,10 +7274,11 @@
        # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
        # -specs=*             GCC specs files
        # -stdlib=*            select c++ std lib with clang
@@ -53,6 +44,3 @@ https://bugs.gentoo.org/556512
          func_quote_for_eval "$arg"
  	arg=$func_quote_for_eval_result
          func_append compile_command " $arg"
--- 
-2.6.2
-
diff --git a/sys-devel/libtool/files/libtool-2.4.6-link-fuse-ld.patch b/sys-devel/libtool/files/libtool-2.4.6-link-fuse-ld.patch
index 55ec5ae9e0a6..f6c0a3dc89f1 100644
--- a/sys-devel/libtool/files/libtool-2.4.6-link-fuse-ld.patch
+++ b/sys-devel/libtool/files/libtool-2.4.6-link-fuse-ld.patch
@@ -10,15 +10,10 @@ Starting with gcc-4.8, there's a -fuse-ld flag that can be used to select
 between bfd & gold.  Make sure we pass it through to the linking stage.
 
 * build-aux/ltmain.in (func_mode_link): Pass -fuse-ld=* flags through.
----
- build-aux/ltmain.in | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
 
-diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
-index 2a5aaad..4c24d5d 100644
 --- a/build-aux/ltmain.in
 +++ b/build-aux/ltmain.in
-@@ -5383,10 +5383,11 @@ func_mode_link ()
+@@ -5363,10 +5363,11 @@
        # -specs=*             GCC specs files
        # -stdlib=*            select c++ std lib with clang
        # -fsanitize=*         Clang/GCC memory and address sanitizer
@@ -31,13 +26,9 @@ index 2a5aaad..4c24d5d 100644
          func_quote_for_eval "$arg"
  	arg=$func_quote_for_eval_result
          func_append compile_command " $arg"
-
-patch the generated file too to keep help2man from generating man pages
-https://bugs.gentoo.org/556512
-
 --- a/build-aux/ltmain.sh
 +++ b/build-aux/ltmain.sh
-@@ -5383,10 +5383,11 @@ func_mode_link ()
+@@ -7275,10 +7275,11 @@
        # -specs=*             GCC specs files
        # -stdlib=*            select c++ std lib with clang
        # -fsanitize=*         Clang/GCC memory and address sanitizer
@@ -50,5 +41,3 @@ https://bugs.gentoo.org/556512
          func_quote_for_eval "$arg"
  	arg=$func_quote_for_eval_result
          func_append compile_command " $arg"
--- 
-2.3.2
diff --git a/sys-devel/libtool/files/libtool-2.4.6-link-specs.patch b/sys-devel/libtool/files/libtool-2.4.6-link-specs.patch
index a8fbf28f80c0..c7720935d8fd 100644
--- a/sys-devel/libtool/files/libtool-2.4.6-link-specs.patch
+++ b/sys-devel/libtool/files/libtool-2.4.6-link-specs.patch
@@ -10,15 +10,10 @@ https://bugzilla.redhat.com/show_bug.cgi?id=985592
 to the linker, Fedora uses this option for hardening.
 
 Signed-off-by: Pavel Raiskup <praiskup@redhat.com>
----
- build-aux/ltmain.in | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
 
-diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
-index d5cf07a..0c40da0 100644
 --- a/build-aux/ltmain.in
 +++ b/build-aux/ltmain.in
-@@ -5360,10 +5360,12 @@ func_mode_link ()
+@@ -5360,10 +5360,12 @@
        # -tp=*                Portland pgcc target processor selection
        # --sysroot=*          for sysroot support
        # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
@@ -32,13 +27,9 @@ index d5cf07a..0c40da0 100644
          func_quote_for_eval "$arg"
  	arg=$func_quote_for_eval_result
          func_append compile_command " $arg"
-
-patch the generated file too to keep help2man from generating man pages
-https://bugs.gentoo.org/556512
-
 --- a/build-aux/ltmain.sh
 +++ b/build-aux/ltmain.sh
-@@ -5360,10 +5360,12 @@ func_mode_link ()
+@@ -7272,10 +7272,12 @@
        # -tp=*                Portland pgcc target processor selection
        # --sysroot=*          for sysroot support
        # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
@@ -52,6 +43,3 @@ https://bugs.gentoo.org/556512
          func_quote_for_eval "$arg"
  	arg=$func_quote_for_eval_result
          func_append compile_command " $arg"
--- 
-2.6.2
-
diff --git a/sys-devel/libtool/files/libtool-2.4.6-mint.patch b/sys-devel/libtool/files/libtool-2.4.6-mint.patch
index 341a0f02ef1e..4fe5bcede5a3 100644
--- a/sys-devel/libtool/files/libtool-2.4.6-mint.patch
+++ b/sys-devel/libtool/files/libtool-2.4.6-mint.patch
@@ -2,10 +2,9 @@ Patch by Alan Hourihane
 
 http://bugs.gentoo.org/show_bug.cgi?id=266984
 
-diff -ur libtool-2.2.6/configure libtool-2.2.6-mint/configure
---- libtool-2.2.6/configure	2008-09-07 17:52:50.000000000 +0000
-+++ libtool-2.2.6/configure	2009-04-21 08:49:27.000000000 +0000
-@@ -4986,6 +4986,11 @@
+--- a/configure
++++ b/configure
+@@ -5897,6 +5897,11 @@
      lt_cv_sys_max_cmd_len=8192;
      ;;
  
@@ -17,10 +16,9 @@ diff -ur libtool-2.2.6/configure libtool-2.2.6-mint/configure
    amigaos*)
      # On AmigaOS with pdksh, this test takes hours, literally.
      # So we just punt and use a minimum line length of 8192.
-diff -ur libtool-2.2.6/libltdl/configure libtool-2.2.6-mint/libltdl/configure
---- libtool-2.2.6/libltdl/configure	2008-09-07 17:53:05.000000000 +0000
-+++ libtool-2.2.6/libltdl/configure	2009-04-21 08:50:08.000000000 +0000
-@@ -4422,6 +4422,11 @@
+--- a/libltdl/configure
++++ b/libltdl/configure
+@@ -4782,6 +4782,11 @@
      lt_cv_sys_max_cmd_len=8192;
      ;;
  
@@ -32,10 +30,9 @@ diff -ur libtool-2.2.6/libltdl/configure libtool-2.2.6-mint/libltdl/configure
    amigaos*)
      # On AmigaOS with pdksh, this test takes hours, literally.
      # So we just punt and use a minimum line length of 8192.
-diff -ur libtool-2.2.6/libltdl/m4/libtool.m4 libtool-2.2.6-mint/libltdl/m4/libtool.m4
---- libtool-2.2.6/m4/libtool.m4	2008-09-05 11:54:41.000000000 +0000
-+++ libtool-2.2.6/m4/libtool.m4	2009-04-21 08:50:26.000000000 +0000
-@@ -1527,6 +1527,11 @@
+--- a/m4/libtool.m4
++++ b/m4/libtool.m4
+@@ -1708,6 +1708,11 @@
      lt_cv_sys_max_cmd_len=8192;
      ;;
  
diff --git a/sys-devel/libtool/files/libtool-2.4.6-pthread_bootstrapped.patch b/sys-devel/libtool/files/libtool-2.4.6-pthread_bootstrapped.patch
index 54461ccc54ee..b093d74266f2 100644
--- a/sys-devel/libtool/files/libtool-2.4.6-pthread_bootstrapped.patch
+++ b/sys-devel/libtool/files/libtool-2.4.6-pthread_bootstrapped.patch
@@ -1,8 +1,8 @@
 https://bugs.gentoo.org/650876
 
---- libtool-2.4.6/build-aux/ltmain.sh
-+++ libtool-2.4.6/build-aux/ltmain.sh
-@@ -7079,6 +7079,16 @@
+--- a/build-aux/ltmain.sh
++++ b/build-aux/ltmain.sh
+@@ -7127,6 +7127,16 @@
  	    *" $arg "*) ;;
  	    * ) func_append new_inherited_linker_flags " $arg" ;;
  	esac
diff --git a/sys-devel/libtool/files/libtool-2.4.6-sed-quote-speedup.patch b/sys-devel/libtool/files/libtool-2.4.6-sed-quote-speedup.patch
index 0eeffac7a0da..580d635d04aa 100644
--- a/sys-devel/libtool/files/libtool-2.4.6-sed-quote-speedup.patch
+++ b/sys-devel/libtool/files/libtool-2.4.6-sed-quote-speedup.patch
@@ -20,18 +20,10 @@ of '$SED $sed_quote_subst'.
 (func_mode_link): Likewise.
 * NEWS: Document.
 * bootstrap: Sync with funclib.sh.
----
- NEWS                    |  3 +++
- bootstrap               | 61 +++++++++++++++++++++++++++++++++++++++++++------
- build-aux/ltmain.in     | 10 ++++----
- gl/build-aux/funclib.sh | 61 +++++++++++++++++++++++++++++++++++++++++++------
- 4 files changed, 117 insertions(+), 18 deletions(-)
 
-diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
-index 0c40da0..24acefd 100644
 --- a/build-aux/ltmain.in
 +++ b/build-aux/ltmain.in
-@@ -3346,7 +3346,8 @@ else
+@@ -3346,7 +3346,8 @@
    if test \"\$libtool_execute_magic\" != \"$magic\"; then
      file=\"\$0\""
  
@@ -41,7 +33,7 @@ index 0c40da0..24acefd 100644
      $ECHO "\
  
  # A function that is used when there is no print builtin or printf.
-@@ -8596,8 +8597,8 @@ EOF
+@@ -8598,8 +8599,8 @@
  	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  	  fi
  	done
@@ -52,7 +44,7 @@ index 0c40da0..24acefd 100644
        fi
  
        # Only actually do things if not in dry run mode.
-@@ -8843,7 +8844,8 @@ EOF
+@@ -8845,7 +8846,8 @@
        done
        # Quote the link command for shipping.
        relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
@@ -62,8 +54,6 @@ index 0c40da0..24acefd 100644
        if test yes = "$hardcode_automatic"; then
  	relink_command=
        fi
-diff --git a/gl/build-aux/funclib.sh b/gl/build-aux/funclib.sh
-index 39d972e..47d8b95 100644
 --- a/build-aux/funclib.sh
 +++ b/build-aux/funclib.sh
 @@ -1,5 +1,5 @@
@@ -73,7 +63,7 @@ index 39d972e..47d8b95 100644
  
  # General shell script boiler plate, and helper functions.
  # Written by Gary V. Vaughan, 2004
-@@ -1026,6 +1026,57 @@ func_relative_path ()
+@@ -1026,6 +1026,57 @@
  }
  
  
@@ -131,7 +121,7 @@ index 39d972e..47d8b95 100644
  # func_quote_for_eval ARG...
  # --------------------------
  # Aesthetically quote ARGs to be evaled later.
-@@ -1042,12 +1093,8 @@ func_quote_for_eval ()
+@@ -1042,12 +1093,8 @@
      func_quote_for_eval_unquoted_result=
      func_quote_for_eval_result=
      while test 0 -lt $#; do
@@ -146,20 +136,18 @@ index 39d972e..47d8b95 100644
        if test -n "$func_quote_for_eval_unquoted_result"; then
  	func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
        else
-
-patch the generated file too to keep help2man from generating man pages
-https://bugs.gentoo.org/556512
-
 --- a/build-aux/ltmain.sh
 +++ b/build-aux/ltmain.sh
-@@ -1,5 +1,5 @@
+@@ -64,7 +64,7 @@
+ # libraries, which are installed to $pkgauxdir.
+ 
  # Set a version string for this script.
 -scriptversion=2015-01-20.17; # UTC
 +scriptversion=2015-10-04.22; # UTC
  
  # General shell script boiler plate, and helper functions.
  # Written by Gary V. Vaughan, 2004
-@@ -1026,6 +1026,57 @@ func_relative_path ()
+@@ -1091,6 +1091,57 @@
  }
  
  
@@ -217,7 +205,7 @@ https://bugs.gentoo.org/556512
  # func_quote_for_eval ARG...
  # --------------------------
  # Aesthetically quote ARGs to be evaled later.
-@@ -1042,12 +1093,8 @@ func_quote_for_eval ()
+@@ -1107,12 +1158,8 @@
      func_quote_for_eval_unquoted_result=
      func_quote_for_eval_result=
      while test 0 -lt $#; do
@@ -232,7 +220,7 @@ https://bugs.gentoo.org/556512
        if test -n "$func_quote_for_eval_unquoted_result"; then
  	func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
        else
-@@ -3346,7 +3346,8 @@ else
+@@ -5258,7 +5305,8 @@
    if test \"\$libtool_execute_magic\" != \"$magic\"; then
      file=\"\$0\""
  
@@ -242,7 +230,7 @@ https://bugs.gentoo.org/556512
      $ECHO "\
  
  # A function that is used when there is no print builtin or printf.
-@@ -8596,8 +8597,8 @@ EOF
+@@ -10510,8 +10558,8 @@
  	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
  	  fi
  	done
@@ -253,7 +241,7 @@ https://bugs.gentoo.org/556512
        fi
  
        # Only actually do things if not in dry run mode.
-@@ -8843,7 +8844,8 @@ EOF
+@@ -10757,7 +10805,8 @@
        done
        # Quote the link command for shipping.
        relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
@@ -263,6 +251,3 @@ https://bugs.gentoo.org/556512
        if test yes = "$hardcode_automatic"; then
  	relink_command=
        fi
--- 
-2.6.2
-
diff --git a/sys-devel/libtool/libtool-2.4.6-r6.ebuild b/sys-devel/libtool/libtool-2.4.6-r6.ebuild
new file mode 100644
index 000000000000..c699abbc5493
--- /dev/null
+++ b/sys-devel/libtool/libtool-2.4.6-r6.ebuild
@@ -0,0 +1,114 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+LIBTOOLIZE="true" #225559
+WANT_LIBTOOL="none"
+inherit autotools prefix
+
+if [[ ${PV} == *9999 ]] ; then
+	EGIT_REPO_URI="https://git.savannah.gnu.org/git/libtool.git"
+	inherit git-r3
+else
+	SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt"
+fi
+
+DESCRIPTION="A shared library tool for developers"
+HOMEPAGE="https://www.gnu.org/software/libtool/"
+
+LICENSE="GPL-2"
+SLOT="2"
+IUSE="vanilla"
+
+# Pull in libltdl directly until we convert packages to the new dep.
+RDEPEND="
+	sys-devel/gnuconfig
+	>=sys-devel/autoconf-2.69:*
+	>=sys-devel/automake-1.13:*
+	dev-libs/libltdl:0"
+DEPEND="${RDEPEND}"
+[[ ${PV} == *9999 ]] && BDEPEND="sys-apps/help2man"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-2.4.3-use-linux-version-in-fbsd.patch #109105
+	"${FILESDIR}"/${PN}-2.4.6-link-specs.patch
+	"${FILESDIR}"/${PN}-2.4.6-link-fsanitize.patch #573744
+	"${FILESDIR}"/${PN}-2.4.6-link-fuse-ld.patch
+	"${FILESDIR}"/${PN}-2.4.6-libtoolize-slow.patch
+	"${FILESDIR}"/${PN}-2.4.6-libtoolize-delay-help.patch
+	"${FILESDIR}"/${PN}-2.4.6-sed-quote-speedup.patch #542252
+	"${FILESDIR}"/${PN}-2.4.6-ppc64le.patch #581314
+
+	"${FILESDIR}"/${PN}-2.4.6-mint.patch
+	"${FILESDIR}"/${PN}-2.2.6a-darwin-module-bundle.patch
+	"${FILESDIR}"/${PN}-2.4.6-darwin-use-linux-version.patch
+)
+
+src_prepare() {
+	if [[ ${PV} == *9999 ]] ; then
+		eapply "${FILESDIR}"/${PN}-2.4.6-pthread.patch #650876
+		./bootstrap || die
+	else
+		PATCHES+=(
+			"${FILESDIR}"/${PN}-2.4.6-pthread_bootstrapped.patch #650876
+		)
+	fi
+
+	# WARNING: File build-aux/ltmain.sh is read-only; trying to patch anyway
+	chmod +w build-aux/ltmain.sh || die
+
+	if use vanilla ; then
+		eapply_user
+		return 0
+	else
+		default
+	fi
+
+	if use prefix ; then
+		# seems that libtool has to know about EPREFIX a little bit
+		# better, since it fails to find prefix paths to search libs
+		# from, resulting in some packages building static only, since
+		# libtool is fooled into thinking that libraries are unavailable
+		# (argh...). This could also be fixed by making the gcc wrapper
+		# return the correct result for -print-search-dirs (doesn't
+		# include prefix dirs ...).
+		eapply "${FILESDIR}"/${PN}-2.2.10-eprefix.patch
+		eprefixify m4/libtool.m4
+	fi
+
+	pushd libltdl >/dev/null || die
+	AT_NOELIBTOOLIZE=yes eautoreconf
+	popd >/dev/null || die
+	AT_NOELIBTOOLIZE=yes eautoreconf
+
+	# Make sure timestamps don't trigger a rebuild of man pages. #556512
+	if [[ ${PV} != *9999 ]] ; then
+		touch doc/*.1 || die
+		export HELP2MAN=false
+	fi
+}
+
+src_configure() {
+	# the libtool script uses bash code in it and at configure time, tries
+	# to find a bash shell.  if /bin/sh is bash, it uses that.  this can
+	# cause problems for people who switch /bin/sh on the fly to other
+	# shells, so just force libtool to use /bin/bash all the time.
+	export CONFIG_SHELL="$(type -P bash)"
+
+	# Do not bother hardcoding the full path to sed.  Just rely on $PATH. #574550
+	export ac_cv_path_SED="$(basename "$(type -P sed)")"
+
+	[[ ${CHOST} == *-darwin* ]] && local myconf="--program-prefix=g"
+	ECONF_SOURCE=${S} econf ${myconf} --disable-ltdl-install
+}
+
+src_install() {
+	default
+
+	local x
+	while read -d $'\0' -r x ; do
+		ln -sf "${EPREFIX}"/usr/share/gnuconfig/${x##*/} "${x}" || die
+	done < <(find "${ED}" '(' -name config.guess -o -name config.sub ')' -print0)
+}
-- 
2.26.2