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.
* libtoolize.in: Overwrite function in bootstrap for printing version
information for libtoolize.
* build-aux/ltmain.in: Overwrite function in bootstrap for printing
version information for libtool.
* doc/libtool.texi: Fix typo and correct references for tests/demo
subdirectory to the tests/demo.at Autotest file.
* gl/top/README-release.diff: Add documentation for maintainers so
the CVS repository is properly updated following a stable release.
The variable, LT_ARGZ_H, can be empty, which causes distclean and
maintainer-clean to error as a directory is attempted to be removed
instead of a file.
When running maintainer-clean for gnulib-tests, the .version file is
missing, which is needed by config.status, so the command will error.
* configure.ac: Update CONFIG_STATUS_DEPENDENCIES to use dotversion so
that the .version file can be generated if needed. Add AC_SUBST for
LT_DOLLAR_SIGN use in libltdl/ltdl.mk.
* libltdl/ltdl.mk: Add conditional to check if LT_ARGZ_H is empty.
Five tests use aclocal, but do not have a check for whether aclocal is
available to use. This causes reported tests failures in Linux From
Scratch and Darwin builds.
* tests/standalone.at: Add AT_XFAIL_IF check for aclocal for all tests.
* tests/subproject.at: Add AT_XFAIL_IF check for aclocal for last test.
* Makefile.am: Fix typo.
* doc/libtool.texi: Add missing test case descriptions and specify
option and command where missing in test case descriptions.
The file magic test fails to determine the file type of libraries when
cross-compiling with an aarch64 compiler without additional strings to
search for in an objdump.
* build-aux/ltmain.in: Append 'pe-aarch64' to file_magic in the
lt_cv_deplibs_check_method.
* m4/libtool.m4: Append 'pe-aarch64' to file format check.
The test case for deplibs_check_method in tests/demo.at produces a
warning on multiple systems, such as Cygwin and Mingw. To avoid this
warning when using file_magic, '^x86 archive static' is appended for
lt_cv_deplibs_check_method.
* m4/libtool.m4: Append '^x86 archive static' for file_magic in the
lt_cv_deplibs_check_method.
libtoolize: Fix conflicting warnings about AC_PROG_RANLIB
The macro _LT_CMD_OLD_ARCHIVE inlines the definition of AC_PROG_RANLIB,
which seems to be outdated functionality. Running autoscan in a
directory with ltmain.sh produces conflicting warnings with libtoolize
about AC_PROG_RANLIB. Autoconf warns that AC_PROG_RANLIB is missing,
but libtoolize warns that it is obsolete. The outdated warning should
no longer appear after replacing AC_CHECK_TOOL(RANLIB, ranlib, :) with
AC_REQUIRE([AC_PROG_RANLIB]).
* m4/libtool.m4: Use AC_REQUIRE([AC_PROG_RANLIB]).
* Makefile.am: Added in tests/bug_42313.at.
* tests/bug_42313.at: Contains test cases for bug 42313.
Bruno Haible [Mon, 29 Jan 2024 15:58:48 +0000 (16:58 +0100)]
Rename option --with-aix-soname to --enable-aix-soname.
Reported at <https://savannah.gnu.org/support/index.php?110674>.
* doc/libtool.texi (LT_INIT): Talk about --enable-aix-soname instead of --with-aix-soname.
* m4/ltoptions.m4 (_LT_WITH_AIX_SONAME): Use AC_ARG_ENABLE instead of
AC_ARG_WITH. In the default case, use _AC_ENABLE_IF, in order to still
recognize the old option --with-aix-soname.
* m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER): Update comment.
* configure.ac: Update comment.
* NEWS: Mention the change.
Bruno Haible [Mon, 29 Jan 2024 15:35:17 +0000 (16:35 +0100)]
Rename option --with-pic to --enable-pic.
Reported at <https://savannah.gnu.org/support/index.php?110674>.
* doc/libtool.texi (LT_INIT): Talk about --enable-pic instead of
--with-pic, and about --disable-pic instead of --without-pic.
(Test descriptions): Likewise.
* m4/ltoptions.m4 (_LT_WITH_PIC): Use AC_ARG_ENABLE instead of
AC_ARG_WITH. In the default case, use _AC_ENABLE_IF, in order to still
recognize the old options --with-pic and --without-pic.
* tests/demo.at: Add a test for --enable-pic, keeping the test for
--with-pic. Test '--disable-pic' instead of '--with-pic=no'.
* tests/with-pic.at: Test --enable-pic instead of --with-pic.
* NEWS: Mention the change.
Bruno Haible [Mon, 2 Sep 2024 09:33:27 +0000 (11:33 +0200)]
Document situations where -export-symbols does not work.
* doc/libtool.texi (Link mode): Document that -export-symbols does not work on
static libraries. Document the most important platforms where it does not work
on shared libraries.
Removing a forward slash launches an interactive cmd prompt when run in
an MSYS shell, so the previous change has been reverted. For more
details: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=49246
Brian Inglis [Sun, 27 Jun 2021 23:09:02 +0000 (23:09 +0000)]
libtool: mingw hangs in func_convert_core_msys_to_w32
The `cmd //c ...` is is an invocation of the Windows console command
line shell `cmd`. The slashes are Windows console shell command line
option switch characters '/', with `cmd /c ...` meant to be
equivalent to `sh -c ...`.
It results in the Windows `cmd` shell being invoked as an interactive
console shell, as if invoked with the '/k' switch, but ignoring any
provided command string, hanging builds!
* build-aux/ltmain.in: Remove additional forward slash for option.
Test 170 in bug_62343.at is failing to link object files with a library
file. This is fixed by choosing the correct architecture version of a
compiler by using the 'CXX' macro.
tests/bug_62343.at: Replace 'g++' with 'CXX' macro
It has been discovered that under certain conditions libtool creates
wrappers that prefer installed versions of the shared objects over
those built in the source tree. As a result, any tests run in the
source tree produce unreliable results.
* build-aux/ltmain.in: Alter to use shared objects in source tree
instead of installed.
* Makefile.am: Added in tests/bug_71489.at.
* tests/bug_71489.at: Contains test case for bug 71489.
* m4/libtool.m4: Instead of a conditional for using -no_fixup_chains,
AC_VAR_APPEND will handle appending the option to the variable, which
allows the '+=' extension to be used by shells that provide this
capability for more efficient scaling. Also, bump minimum required
version of autoconf from 2.62 to 2.64.
* m4/libtool.m4: Replace version testing with a feature test for
the '-no_fixup_chains' flag.
* tests/no-executables.at: Set cache variable for link test.
* m4/libtool.m4: Append '-no_fixup_chains' flag to disable chained
fixups since it is not compatible with '-undefined dynamic_lookup'.
* NO-THANKS: Add thanks for Carlo Cabrera and Dave Allured.
trcrsired [Tue, 14 May 2024 19:26:40 +0000 (20:26 +0100)]
libtool: Correct DLL Installation Path for mingw
When building native GCC for the x86_64-w64-mingw32 host, the
compiler copies its library DLLs to the `bin` directory. However,
in the case of a multilib configuration, both 32-bit and 64-bit
libraries end up in the same `bin` directory, leading to conflicts
where 64-bit DLLs are overridden by their 32-bit counterparts.
This patch addresses the issue by adjusting the installation path
for the libraries. Specifically, it installs the libraries to
separate directories: `lib` for 64-bit and `lib32` for 32-bit. This
behavior aligns with how libraries are installed when creating an
x86_64-w64-mingw32 cross-compiler without copying them to the `bin`
directory if it is a multilib build.
* m4/libtool.m4: Install DLL to $(libdir), not $(libdir)/bin, if
multilib build.
Peter Kokot [Mon, 18 Mar 2024 00:28:15 +0000 (01:28 +0100)]
m4: Fix Wstrict-prototypes warnings
This changes the C function prototypes to use void where needed. When
building with CFLAGS=-Werror=strict-prototypes or similar, the libtool's
tests can cause false reports and errors in the log files:
error: function declaration isn't a prototype
* m4/libtool.m4: Specify void for main function prototypes.
* m4/ltdl.m4: Specify void for main and fnord function prototypes.
When linking on NetBSD, the test fails to locate a shared version of
gcc, so a static version of the module is generated, which does not pass
the defined checks. A FIXME note has been added for future debugging.
* tests/flags.at: Skip passing CXX flags test on NetBSD.
libtool: Check if -no-canonical-prefixes supported
The compiler fails with the -no-canonical-prefixes flag in certain
environments. Check if the flag is supported in the current environment
and skip the test if it is not supported.
* tests/bug_62343.at: Skip test if -no-canonical-prefixes is unsupported
in the current environment.
Richard Purdie [Tue, 4 Jun 2024 17:34:16 +0000 (20:34 +0300)]
m4/libtool.m4: Fixed AC_CHECK_PROG call
AC_CHECK_TOOL was changed to AC_CHECK_PROG however the arguments are
different and this result is a value of ":". Change this to match the
original intent.
The lack of FILECMD was causing failures for mips64 builds as -m elf was
being passed to LD which isn't supported on our targets.
* testsuite.at: $as_echo was deprecated in Autoconf commit 2b59b6f8a.
AS_ECHO uses printf which has been well supported for 15 to 20
years. Use of $as_echo was resulting in a warning message in the
testsuite logs, and replacing the deprecated macro removes the
warning messages.
* tests/libtoolize.at: When -program-prefix is used, stdout for the
program changes from the expected output. As a result, the test
fails. Replaced the transformed name to account for program-prefix.
When using a sysroot we should append it to libdir, which is helpful in
cross builds as the system is staged in the sysroot. For normal builds,
i.e. when lt_sysroot is not set, it will still behave the same and add
-L/usr/lib to the relink command.
Using clang with fsanitize results in an incompatible ASan runtime.
It results in the warning message "linked against incompatible ASan
runtimes". This only occurs with the mixed Fortran/C demo.
* tests/f77demo.at: Skip tests for clang compiling with fsanitize.
* tests/fcdemo.at: Skip tests for clang compiling with fsanitize.