libtool: trust -print-search-dirs from recent GCC

Alan Modra hints in [1] that -print-search-dirs was fixed in
GCC 4.2(?), so that it nowadays automatically appends
-print-multi-os-directory for the applicable directories. I.e.
it should no longer be necessary for libtool to append a second
../lib64 when GCC has already done so. Also, the multi-os
appending loop seems to have been added specifically for early
(arguably broken) bi-arch enabled GCCs that printed -m32
directories even though -m64 was the default [2]. So, my
conclusion is that we want any libtool magic to affect
-print-search-dirs output from contemporary GCCs as little as
possible, while continuing to append the
-print-multi-os-directory for the legacy case.

Fixes bug#15321 reported by Ozkan Sezer.

[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20425
[2] http://lists.gnu.org/archive/html/bug-libtool/2006-09/msg00019.html

* m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER): If any of the
directories printed by -print-search-dirs ends with the
content of -print-multi-os-directory, then assume that
GCC adds the multi-os-directory where appropriate all by
itself and hence don't try to second guess when to add
it manually.
* THANKS: Update.
libtool: Add Android/Linux support.

This patch adds proper Android support to libtool. The main
issues are the following:

  - Versioned libraries are not supported by the platform and
    its build/packaging tools.

  - The dynamic linker is not GNU ld, there is no support for
    DT_RUNPATH.

  - Similarly, there is no ldconfig.
maint: Fix various comment and documentation typos.

Ondřej writes: "Hi, this is upstream version of patch that I
sent to gcc.  I generated this patch with tool that I am
writing: https://github.com/neleai/stylepp"

(Note: The generated patch was adjusted to retain the non-US
but correct spelling of 'rigourous' before commit.  --Brooks)
libtool: Discard "-mllvm $arg" options when linking.

Clang accepts options of the form "-mllvm $arg", and passes the
argument as an option to LLVM.  These options caused problems
for Libtool when linking; in some cases, the -mllvm option is
passed through but the corresponding argument is dropped.  (See
for example http://llvm.org/bugs/show_bug.cgi?id=14716.)

This patch resolves the issue by explicitly matching -mllvm and
taking an argument.  Since Clang never uses LLVM for linking,
the matched "-mllvm $arg" option is irrelevant for the link
step, and we can simply discard it once we've recognized it.

Co-authored-by: Johannes Obermayr <johannesobermayr@gmx.de>
Copyright-paperwork-exempt: Yes
libtool: Haiku change for shlibpath_overrides_runpath

Pretty much all changes to Haiku for Libtool have been
upstreamed, however we currently have an incorrect value for
shlibpath_overrides_runpath.  It should be "no" instead of
"yes".

Previously Scott McCreary had submitted patches for us, but I
told him I would work to get this committed, as he is quite
busy lately.

Here is a commit he made to our Haiku Ports site though, that
shows the exact change I am proposing done against Libtool
2.4.2.

http://ports.haiku-files.org/browser/haikuports/sys-devel/
libtool/patches/libtool-2.4.2.patch

Copyright-paperwork-exempt: Yes
libtool: use AS_HELP_STRING in LT_WITH_SYSROOT help message.

This patch fixes so help output is formatted similar with
other macros using AS_HELP_STRING. Also it outputs '[=DIR]'
as I suspect intended rather than '=DIR'.
libtool: Fix $wl setting for tcc on GNU systems

(This addresses http://bugs.debian.org/663945.  See there for
more-detailed discussion.)

tcc gained support for "-Wl,-rpath -Wl,<directory>" in its
commit 7fb0482a ("Support linker options passed in several -Wl
param", 2012-03-14) but libtool doesn't know to use it.  Teach
it.

Without this change, running "make check" on MPFR when it has
been built with tcc and shared libraries doesn't work because
libtool generates a -rpath option, which tcc doesn't support.

Copyright-paperwork-exempt: Yes
libtool: Add TPF settings for LT_SYS_DLOPEN_SELF

* m4/libtool.m4: Since we know that all TPF builds are cross-
builds, do not attempt to run linker tests during config. Use
known constants instead, since we know how dlopen() is
implemented.
libtool: Fix comment indentation

This trivial patch fixes indentation on a comment to match
the style used elsewhere in m4/libtool.m4.
libtool: Fix detection of ld version with parentheses.

ld from crosstool-NG reports a version string with an extra
version number in a parenthetical note:
GNU ld (crosstool-NG 1.13.0) 2.21.1

This made libtool assume that the ld version was the
crosstool-NG version (1.13.0) instead of the real ld version
(2.21.1).

To fix the ld version string, this patch filters out any string
between parentheses that is followed by a space.

Because of this bug, filtering of exported symbols was not
taking place with crosstool-NG toolchains.

This issue has bee noticed when building pango, which exported
harfbuzz symbols that should have remained hidden.

Copyright-paperwork-exempt: Yes
libtool: Fix x86_64-pc-solaris2.* GNU ld breakage

Since commit [1] libtool tries to set a 64-bits target for GNU
ld.  However, it does so wrongly for x86_64-pc-solaris2.*
targets, causing libtool to believe the linker is called
ld_sol2.  There is no such thing, and it obviously breaks
things further down.  Some people wrongly assume there is
supposed to be an ld_sol2 on their systems, e.g. [2].

I think the original change is fragile, because it assumes it
has all CHOSTs matched, then appends _sol2.  In the wild,
people have used amd64-pc-solaris2* too, so perhaps it would
be safer if the code only appended _sol2 if there is actually
an explicit target set.

Anyhow, since the 64-bits sparc target is called sparc64-* or
sparcv9-*, the sparc case is already correctly handled, so in
the attached patch, I just added an x86_64-* case, although I
could imagine relaxing the i?86 case to *86*-pc-solaris2* too.

In any case, defaulting to a linker called ld_sol2 is wrong.

[1] http://lists.gnu.org/archive/html/libtool-commit/2011-02/
msg00000.html
[2] http://osdyson.org/issues/8

Copyright-paperwork-exempt: Yes
libtool: Remove unneeded quotes in assignment.

The quotes in this assignment cause "make syntax-check" to
fail.  Thus, this patch removes them.
libtool: Don't fall back to static libraries if building them was disabled

If -no-undefined was not specified but the platform didn't
support shared libraries with undefined symbols (e.g. Cygwin/
MinGW), static libraries were built instead of shared ones,
even if building them was explicitly disabled with --disable-
static configure option.

Fix this by stopping with a fatal error if a shared library
can't be built in this case instead of unexpectedly building a
static library instead.

* libltdl/config/ltmain.m4sh (func_mode_link()): Stop with
fatal error when trying to build a shared library without -no-
undefined on a platform not supporting undefined symbols in
shared libraries.

Copyright-paperwork-exempt: Yes
maint: fix a syntax-check violation from commit 12641bd.

* build-aux/ltmain.in (func_mode_link): Reverse test operands to
forestall misinterpretation of contests of shell variable as
operand 1.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
maint: bump serials on m4 sources changed since v2.4.2.

* m4/argz.m4: Bump serial to 6.
* m4/libtool.m4: Bump serial to 58.
* m4/ltdl.m4: Bump serial to 19.
* m4/ltoptions.m4: Bump serial to 8.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
maint: Update README-release for Makefile.inc -> ltdl.mk rename.

* gl/top/README-release.diff: s/Makefile.inc/ltdl.mk/g

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
libltdl: bump -version-info revision by 1.

The only changes to libltdl sources since v2.4.2 have been
cosmetic and stylistic.
* libltdl/ltdl.mk (LTDL_VERSION_INFO): For a release with no
interface changes C:R:A becomes C:R+1:A.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
tests: use K&R main() syntax for old-ltdl-iface.at.

At least Mac OS 10.8.5 clang chokes on the previous
'const void *argv[]' parameter, but since we don't use it
anyway, keep to the theme of old api support and use K&R
syntax.
* tests/old-ltdl-iface.at (old.c): Use 'main ()' instead of
unportable 'int main (int argc, const void *argv[])'.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>