Translating file paths from MSYS to W32 has been causing libtool to
indefinitely hang when 'cmd.exe //c' is called. Instead, 'cygpath' is
packaged on MSYS, so it will now handle the path conversion.
* build-aux/ltmain.in: Replace 'cmd.exe //c' with 'cygpath' usage.
* m4/libtool.m4 (global_symbol_to_import, global_symbol_to_cdecl,
global_symbol_to_c_name_address,
global_symbol_to_c_name_address_lib_prefix): List valid C symbol names
only in lt_<modname>_LTX_preloaded_symbols array.
On Cygwin, gawk-4.1.4-3 and newer do not treat the input stream as text
any more, leaving us behind with carriage return in symbol names.
* m4/libtool.m4 (lt_cv_sys_global_symbol_pipe): In AWK script for MS
dumpbin drop CR first.
libtoolize.in: Create symlinks with mklink for MSVC
Symlink files are not generated properly with 'ln -s' for MSVC to
process, so mklink is used, which swaps the argument order of target
and link_name. This also requires absolute paths, generated with the
use of cygpath.
* libtoolize.in: Check if linking with mklink and update processing.
When comparing expected output in LT_AT_CHECK_EXECUTE, several tests
fail with mismatched line endings. This patch should fix Windows
environments that have CRLF text line endings disabled and only use
the LF character for line endings.
* tests/testsuite.at: Removed '\r' from awk's printf command.
libtool: Fix mishandling compiler flags with MSVC tools
With MSVC, linker flags were not properly being linked in during a
compile command. A check has been added to verify if there are linker
flags set and then use a different command when linking.
Fixes applied for bug#74175.
* build-aux/ltmain.in: Fix command parser for '-Wl' option for MSVC.
* m4/libtool.m4: Fix MSVC compile commands.
* tests/flags.at: Use '$GREP --' instead of '$FGREP' when comparing with
stdout.
Manoj Gupta [Wed, 10 Oct 2018 07:50:23 +0000 (10:50 +0300)]
Pick up clang_rt static archives compiler internal libraries
Libtool checks only for libraries linked as -l* when trying to
find internal compiler libraries. Clang, however uses the absolute
path to link its internal libraries e.g. compiler_rt. This patch
handles clang's statically linked libraries when finding internal
compiler libraries.
https://crbug.com/749263
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27866
For many GNU/Linux systems, the shared library cache is not updated
after a "make install". Some reasoning is outlined in the
documentation now for users with instruction for how to update
the shared library cache if desired.
libtool: Add configuration options for CXX linking
Add configuration options to choose whether to use '-nostdlib' when
linking C++ shared libraries and modules.
* m4/libtool.m4: Replace '-nostdlib' with variable '$stdlibflag' and
set '$output_verbose_link_cmd' to be empty when enabling standard
library linking for C++ modules.
* m4/ltoptions.m4: Add new configuration options, --enable-cxx-stdlib
and --disable-cxx-stdlib, and add LT_INIT options, cxx-stdlib and
no-cxx-stdlib.
* doc/libtool.texi: Update for new configuration options.
* NEWS: Update.
Anthony Mallet [Sun, 23 Mar 2025 12:56:14 +0000 (13:56 +0100)]
libtool.m4: Fix postdeps in NetBSD
commit:c7be1f229 addresses an issue with building C++ modules on NetBSD, by
removing -lgcc_s and -lgcc. This may sometimes not work correctly, depending
on the architecture, as libgcc_s.so and libgcc.a may contain required code to
properly link the shared object. On NetBSD, libgcc.a is compiled with -fPIC
and can be linked to a shared object without any issue.
Julien ÉLIE [Thu, 20 Mar 2025 22:15:45 +0000 (00:15 +0200)]
ltmain.in: Supporting -S and -t flags from install-sh
Libtool silently discards options for install-sh that have not been
specified. Now the install directory and a suffix for backing up
files can be specified to be passed through libtool.
The documentation follows the traditional method of inserting newlines
before the 80 character limit, with a few exceptions. Now, the
documentation will use some semantic newlines, specifically inserting
newlines for clause breaks (commas, semicolons, colons, and so on).
However, it will only break on symbols, instead of also breaking for
phrases, and it will still utilize the 80 character limit should a
symbol break not exist first.
* doc/libtool.texi: Alter line breaks to use partial semantic newlines.
Bruno Haible [Wed, 26 Feb 2025 14:07:39 +0000 (15:07 +0100)]
New program libtool-next-version.
* libtool-next-version.in: New file, based on
gnulib/build-aux/libtool-next-version.
* doc/libtool.texi (Updating version info): Add sub-nodes
'Manual version info update', 'Guided version info update',
'Invoking libtool-next-version'.
* Makefile.am (BUILT_SOURCES): Add libtool-next-version.
(libtoolnextv_in): New variable.
(EXTRA_DIST): Add it.
(bin_SCRIPTS): Add libtool-next-version.
(libtool-next-version): New target.
(libtoolnextv_1): New variable. New target.
(dist_man1_MANS): Add it.
Takashi Yano [Wed, 19 Feb 2025 23:37:27 +0000 (01:37 +0200)]
ltmain.in: Fix mistaking a directory as an executable
find_executable() can return a directory of the same name as the target
executable if the directory is found earlier in the PATH, which causes
check_executable() to fail.
libtool.m4: Update NetBSD postdeps for shared libraries
* m4/libtool.m4: Linking a shared version of 'gcc' is not possible on
NetBSD, since the shared version of the library is 'gcc_s'. postdeps
have been updated to remove 'gcc' instances with sed.
Current, age, and revision values for a library seem to have been chosen
arbitrarily, which is limiting users to a 5 digit maximum. Now, users
can set revision to at most 19 digits, which is referencing Unix epoch
time in nanoseconds.
ltoptions.m4: Make aix-soname assignment more clear
The option --with-aix-soname=svr4 does not work the same as using
LT_INIT([aix-soname=svr4]), since the configure script is reordered
depending on which is used. The reordering causes 'enable_shared'
to not be set before processing for 'aix-soname' when using LT_INIT.
For LT_INIT([aix-soname=svr4]) to be set as intended, 'shared' must
be set before 'aix-soname=svr4', like LT_INIT([shared aix-soname=svr4]).
* m4/ltoptions.m4: Warn user if 'enable_shared' has not been set when
setting 'aix-soname' and add configuration messages to show which
variant of shared library versioning has been set for 'aix-soname'.
* doc/libtool.texi: Update to specify need for 'shared' to be used
before 'aix-soname' for LT_INIT.
Removing duplicate compiler dependencies causes linking problems on
linux with GCC libraries. This deduplication optimization is no longer
used for linux hosts.
* Makefile.am: Set environment variables for tests.
* configure.ac: Add language support for Objective-C and Objective-C++.
* build-aux/ltmain.in: Update help message for tags available.
* m4/libtool.m4: Add tagging support for OBJC and OBJCXX.
* tests/flags.at: Add tests for passing OBJC and OBJCXX flags.
* tests/infer-tag.at: Add tests for inferring OBJC and OBJCXX tags.
* doc/libtool.texi: Update documentation.
* NEWS: Update.
demo.at: Skip test if deplibs_check_method is not pass_all
The test 'deplibs_check_method' was designed to verify pass_all
works as expected. Many warnings occur for systems that do not
have deplibs_check_method set to pass_all, so this test is skipped
on those.
* tests/demo.at: Add check for deplibs_check_method=pass_all.
ltmain.in: Update info supplied to user for --tag usage
* build-aux/ltmain.in: Make error message more explicit for users,
and add tag name information to help menu.
* tests/infer-tag.at: Add testcase for unsupported compiler use.
ltmain.in: Replace old warnings with documentation
Without the ability to disable these old warnings individually, they
are migrating to the relevant section of the documentation to inform
new users that may not know. These warnings have been present for
two decades, so existing users should be aware of this functionality.
* build-aux/ltmain.in: Remove old warnings.
* doc/libtool.texi: Document contents of warning messages.
mintsuki [Wed, 20 Nov 2024 17:34:58 +0000 (18:34 +0100)]
libtool: Replace support for ironclad* with *-mlibc
The main Ironclad kernel-based distribution (Gloire) uses the mlibc
C library for its userland, and that is what commit bd15931e57f5171732a1a911cbbad9b5e03d0308 was intended to support.
There is no reason this support should be Ironclad-specific, as there
are many other OSes that use mlibc, most prominently "Managarm",
which is already supported by gnu-config.
Khalid Masum [Wed, 15 May 2024 11:03:30 +0000 (17:03 +0600)]
libtool: add support for wasm32-emscripten
This patch adds support for emscripten compiler for shared compilation.
* build-aux/ltmain.in: clone link-mode handling for emscripten from
unixware7.
* m4/libtool.m4: translate emscripten specific flags for shared module
building.
Tim Schumacher [Sun, 29 May 2022 13:01:28 +0000 (15:01 +0200)]
libtool: Add support for SerenityOS
This hobbyist OS has already been added to `config.sub` (and
`config.guess` respectively) some time ago, but was still lacking
upstream support for building libraries using libtool.
Since it is a relatively up-to-date system with ports of modern
software, "adding support" mostly just means adding empty cases to avoid
falling though to the most basic behavior (that guarantees compatibility
at the expense of disabling everything that might be critical).
Passing --no-warnings to libtool would not suppress warning messages.
* build-aux/ltmain.in: Add 'opt_warning' check before printing out
warning messages.
* tests/libtool.at: Add simple test for '--no-warnings'.
* NEWS: Update.
If an invalid argument is passed to options '--mode' or '--reorder-cache'
after a valid command, error messages will print infinitely:
$ libtool --help --mode=MODE
libtool: error: invalid argument 'MODE' for --mode
libtool: error: invalid argument 'MODE' for --mode
libtool: error: invalid argument 'MODE' for --mode
...
* build-aux/ltmain.in: Remove 'break' in case statement to fix infinite
loop, and add shift for option '--reorder-cache' to allow more options
to be processed.
libtool: Add option to reorder the shared library cache
Add option to reorder the shared library cache in OpenBSD so that user
preferred directories for shared libraries can be used when linking
before directories previously listed in the shared library cache.
This allows for users in OpenBSD to easily switch between versions of
libraries with the same name during testing.
* NEWS: Update for new (OpenBSD) option.
* build-aux/ltmain.in: Add option --reorder-cache=DIRS.
* doc/libtool.texi: Update documentation for new option.
* test/bug_71489.at: Alter test for OpenBSD to utilize new option.
libtool: Fix local testing of shared libraries on OpenBSD
On OpenBSD 7.5, the shared library cache is updated with finish_cmds,
which causes the test for 'Use local version' to fail. Simply, installed
versions of shared libraries take precedence over those locally built.
To ensure local versions of shared libraries can be tested properly and
more easily, additional options have been added to libtool to skip
executing finish_cmds, like 'ldconfig -m $libdir' in OpenBSD.
* build-aux/ltmain.in: Add libtool options, '--test' and '--check'.
* doc/libtool.texi: Document new options in libtool.
* NEWS: Update for bug fix.
libtool.m4: Update hardcode_shlibpath_var for OpenBSD
When generating an executable in OpenBSD, the executable fails to
generate when shlibpath_var, LD_LIBRARY_PATH, is used solely to
locate dependent libraries.
For hardcoding library paths in OpenBSD, see documentation for
hardcode_direct and hardcode_libdir_flag_spec.
* m4/libtool.m4: Update hardcode_shlibpath_var from 'no' to 'unsupported'
by removing 'with_gnu_ld=no' for OpenBSD.
Martin Storsjö [Wed, 10 Oct 2018 07:47:21 +0000 (10:47 +0300)]
libtool: Prefer response files over linker scripts for mingw tools
The GCC/binutils tools support response files just fine, while
lld (impersonating GNU ld) only supports response files, not
linker scripts. Using a linker script as input just to pass a
list of files is overkill for cases when a response file is enough.
* build-aux/ltmain.in: Move creation of ld script.
* m4/libtool.m4: Add new variable tag for file_list_spec.
The following errors can be seen for the 'execute mode' test in OpenBSD:
build/libtool: test: <: missing second argument
build/libtool: test: >: missing second argument
The cwrapper in OpenBSD cannot parse these symbols as arguments in
execute mode if there are no other characters with them.
* tests/execute-mode.at: Escape '<' and '>' in OpenBSD.
where the path ends with a trailing slash currently fails. This occurs in
software like gnome-keyring or pulseaudio and is because the comparision
code doesn't see the paths as equal. Strip both paths to ensure this works
reliably.
* build-aux/ltmain.in: Strip trailing slashes on install commands.
Vincent Lefevre [Tue, 2 Oct 2018 17:25:29 +0000 (20:25 +0300)]
libtool.m4: Avoid a broken AC_TRY_EVAL macro
As said in the Autoconf source, the AC_TRY_EVAL macro is dangerous and
undocumented, and should not be used.
In particular, the one related to nm yields binary data in the config.log
file with dash, where "echo \\1" (echo with the argument \1) produces the
control character ^A instead of the usual \1 with most shells (POSIX says
that the result is implementation-defined). See:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=910076
This patch attempts to replace this AC_TRY_EVAL occurrence by code with
similar behavior, but using $ECHO instead of echo in order to avoid the
backslash issue.
Markus Mützel [Mon, 14 Oct 2024 15:25:07 +0000 (17:25 +0200)]
libtool: Handle unset $multilib for Windows targets.
If `multilib` is unset (which it apparently is by default), the output
from running a `configure` script contains lines like the following:
```
checking dynamic linker characteristics... ../configure: line 26791: test: yes: unary operator expected
Win32 ld.exe
```
The additional output is not a fatal error. But it could be irritating.
Avoid the unexpected output from `test` by making sure `=` is used as a
binary operator.
* m4/libtool.m4: Prepend "x" on both sides of a comparison with `test`
and the operator `=`.
See also: https://github.com/msys2/MINGW-packages/pull/21905
Replace LT_ARGZ_H_PATH usage with bool for LTARGZH_EXISTS
* m4/ltdl.mk: Add conditional with LTARGZH_EXISTS to append path for
LT_ARGZ_H file to BUILT_SOURCES.
* m4/ltargz.m4: Remove LT_ARGZ_H_PATH.
* m4/ltdl.m4: Add AM_CONDITIONAL for LTARGZH_EXISTS that is set to
true if LT_ARGZ_H is non-empty.
* libltdl/ltdl.mk: Replace conditional with LT_DOLLAR_SIGN for
LT_ARGZ_H_PATH variable.
* m4/ltargz.m4: Add AC_SUBST for LT_ARGZ_H_PATH to set source path
to LT_ARGZ_H file.
* NEWS: Remove additional spacing.