libtool: Fix and remove TODO for improperly sized symbol in TOC
A comment in the libtool manual specifies a TODO for fixing the font
size of the ++ symbol in the TOC. This is fixed by wrapping the
symbol in a @code command, and this TODO can be removed.
* doc/libtool.texi: Wrap ++ in a @code command to fix font in TOC.
libtool: Fix documentation for demo compile mode commands
The demo compile mode commands in Chapter 3 fail to compile since
the source files include a header file that is not in the header search
list. The config.h file is in the local folder. Before this fix, the
compile mode commands would return errors like below:
main.c:1:10: fatal error: config.h: No such file or directory
1 | #include <config.h>
| ^~~~~~~~~~
compilation terminated.
The '-I' option has been added to the gcc commands to specify that the
local folder should be searched for header files.
* doc/libtool.texi: Add option to demo compile mode commands
notes.texi: Specify -lasan with -fsanitize=address in g++
When using the flag -fsanitize=address with g++, the user should also
specify -lasan to ensure linking occurs correctly. libtool uses
-nostdlib, and gcc implicitly includes -lasan when -fsanitize=address
is used. However, g++ does not implicitly include -lasan. The
documentation has been updated to reflect this information rather than
adding the -lasan flag to libtool.
* doc/notes.texi: Document that the user should pass -lasan.
libtool: Documentation refers to demo directory that no longer exists
The libtool documentation included mention of an old test framework.
The documentation has been reworked to indicate the current test
framework used by libtool, where the tests/*demo directories have been
replaced with tests/*demo.at Autotest files.
* doc/libtool.texi: Clarifies where the example files originate.
* TODO: Remove TODO item related to tests/*demo directories.
Multiple compilers on Windows besides the proprietary MSVC compiler
require process.h, and not unistd.h. The inclusion check is expanded
to include these alternative compilers which also require process.h.
* ltmain.in: Replace _MSV_VER with WIN32 and !__GNU_C check
Mike Frysinger [Thu, 18 Jan 2024 05:19:19 +0000 (00:19 -0500)]
libtoolize: always copy config-h.in like aclocal.m4
When running `libtoolize --ltdl`, a symlink to the source config-h.in
is used rather than a copy of the file. This causes the build system
to look at its old timestamp relative to the other generated files
that are copied in, and then try to regenerate things, and update the
config-h.in timestamp by touching the symlink (which will dereference
things). This breaks `make distcheck` because when a few tests run
that invoke `libtoolize --ltdl --install` w/out --copy, and then try
to build the project, automake's rules trigger autoheader regen, and
then update the timestamp, which updates the underlying file, and then
causes libtool's own files to get out of sync. So the next time make
is run in the tree, it tries to regenerate the source files, and fails
as the source tree is read-only.
Change libtoolize to always copying the header over during install.
It's not clear to me whether this is 100% the right answer, but it
shouldn't make things worse beyond missing a case to use a symlink.
We probably can't avoid this as long as aclocal.m4 itself is copied
in instead of symlinked. This changed between v2.4.2 and v2.4.3 in
commit 4e671d6ba69c889b1f9aee12de6c504d26dc6514 ("libtoolize:
simplify file-copying and -linking call-graph.").
Example failure log:
$ make distcheck
...
make[3]: Entering directory '.../libtool-2.4.7.62-3e11/_build/sub'
GEN ../../libltdl/Makefile.in
GEN ../../libltdl/configure
autom4te-2.72: error: cannot create autom4te.cache in .../libtool-2.4.7.62-3e11/libltdl: Permission denied
make[3]: *** [Makefile:2411: ../../libltdl/configure] Error 1
make[3]: *** Waiting for unfinished jobs....
autom4te-2.72: error: cannot create autom4te.cache in .../libtool-2.4.7.62-3e11/libltdl: Permission denied
automake-1.16: error: autoconf failed with exit status: 1
make[3]: *** [Makefile:2387: ../../libltdl/Makefile.in] Error 1
We can see this in old-m4-iface.at:AC_WITH_LTDL which doesn't use
--copy with libtoolize:
$ stat libltdl/config-h.in | grep Modify
Modify: 2024-01-18 01:18:52.998059970 -0500
$ make check-local TESTSUITEFLAGS=100
...
100: AC_WITH_LTDL ok
...
$ stat libltdl/config-h.in | grep Modify
Modify: 2024-01-18 01:19:19.254727020 -0500
Mike Frysinger [Thu, 18 Jan 2024 05:19:05 +0000 (00:19 -0500)]
bootstrap: don't reset config-h.in timestamp newer than configure
Various autotools rules will compare the timestamps of config-h.in
and configure, and if config-h.in is newer than configure, attempt
to regenerate it. This breaks `make distcheck` which we need to
produce new releases. So update config-h.in timestamp, but only
up to the configure file.
The breakage is caught because distcheck makes source dirs read-only
before running.
$ make distcheck
...
make[3]: Entering directory '.../libtool-2.4.7.62-7132f/_build/sub'
GEN ../../libltdl/configure
autom4te-2.72: error: cannot create autom4te.cache in .../libtool-2.4.7.62-7132f/libltdl: Permission denied
make[3]: *** [Makefile:2411: ../../libltdl/configure] Error 1
* bootstrap.conf (libtool_fudge_timestamps): Set config-h.in timestamp
to configure.
Richard Purdie [Wed, 17 Jan 2024 12:39:22 +0000 (12:39 +0000)]
libtool.m4: Cleanup sysroot trailing "/"
If $CC has --sysroot=/, it is a valid configuration however libtool will
then set lt_sysroot to "/".
This means references like $lt_sysroot$libdir become //usr/lib instead
of the more normally expected /usr/lib. This may or may not break something
but certainly is confusing to the user and gives confusing output. Making
"/" simply unset lt_sysroot is much cleaner.
Whilst here, trim any trailing '/' from sysroot paths to drop the duplication
and result in cleaner/consistent output.
* m4/libtool.m4: Cleanup sysroot trailing '/' handling.
Tim Rice [Mon, 19 Jun 2017 02:43:49 +0000 (19:43 -0700)]
ltmain: correct fallout from freebsd-elf changes
Here is a small patch to correct builds on svr5.
When the freebsd-elf target was changed, this got missed.
Symptoms were, building newer lib ended up with libfoo.nn a lower number
than the previous version. And building libpng-1.6.29 produced:
libtool: error: CURRENT '' must be a nonnegative integer
libtool: error: '16:29:0' is not valid version information
Oliver Kiddle [Wed, 17 Aug 2016 12:27:43 +0000 (08:27 -0400)]
libtool: fix Solaris 11 builds
Trying to build clamav on Solaris 11.3 with the Oracle C compiler,
I got the following error:
libtool: error: not configured to extract global symbols from dlpreopened files
I would have expected a build to use dlopen rather than the preopen
fallback so looked for related configure tests that were perhaps
returning the wrong answer.
The global_symbol_pipe being empty seemed a likely culprit.
the last three lines of nm -p on the conftest.o in this test are:
On Solaris 10, I'd get a D instead of a C. Adding C to the list of
characters in the symcode variable and building again resulted in a
successful build. I've attached a patch to add this C.
Richard Purdie [Tue, 16 Jan 2024 15:14:24 +0000 (15:14 +0000)]
libtool: Fix support for NIOS2 processor
When building for a nios2 system, the $host tuple starts with "nios2-"
which is caught by the some of the greedy checks for OS/2 in libtool.
In particular, the *os2* branches of switch statements that only want
to match the OS setting end up matching all nios2 targets, which
results in incorrect behavior.
Switch to use $host_os instead of $host and tweak the patterns to
match to avoid this problem for nios2.
* build-aux/ltmain.in: Switch some $host checks to $host_os.
Mike Frysinger [Tue, 16 Jan 2024 22:50:44 +0000 (17:50 -0500)]
cfg.mk: update old NEWS hash
The recent change to change http:// to https:// updated old NEWS
entries. This isn't exactly against the spirit of the "don't
change old NEWS", so update the hash to match.
Olly Betts [Wed, 24 Jan 2018 01:09:23 +0000 (14:09 +1300)]
libtool: use -Fe with MSVC to specify filename
This avoids a deprecation warning with current versions of MSVC, by
replacing the -o flag with -Fe. -Fe is documented as supported at
least as far back as Visual C 6.0 which was released in 1998.
* m4/libtool.m4: Use -Fe instead of -o to specify DLL output filename
for MSVC.
Xiang.Lin [Mon, 6 Nov 2023 07:07:56 +0000 (15:07 +0800)]
libtool: fix empty "-L" in compiler_lib_search_path
If the compiler places a space between "-L" and the path, the path will
be skipped and only an empty "-L" will appear in the final
compiler_lib_search_path. This will cause the first library in postdeps
following compiler_lib_search_path to be accidentally skipped.
* libtool.m4: Fixed string comparison by adding missing 'x's.
Bruno Haible [Mon, 18 Sep 2023 10:47:08 +0000 (12:47 +0200)]
Fix shared library support on Android.
This patch fixes two problems:
1) A libtool library created with the -release option and no -version-info
option was, when built with --enable-shared, installed without the
symlink libNAME.so -> libNAME-RELEASE.so. This led to subsequent failures
during "make install" of shared libraries that depend on it.
2) Executables were created without a RUNPATH property. These executables
then did not find their shared libraries when run.
* m4/libtool.m4: On Android, fix library_names_spec and
hardcode_libdir_flag_spec.
Mike Frysinger [Mon, 15 Jan 2024 04:02:01 +0000 (23:02 -0500)]
maint: disable syntax checks on local gnulib patches
The syntax checks might trip over problems in the gnulib code itself
when scanning the local patches. Since it's unlikely these checks
will find anything useful, just disable them for the gl/ patches.
Mike Frysinger [Mon, 15 Jan 2024 03:36:07 +0000 (22:36 -0500)]
maint: disable GNU indent checks for now
GNU indent will reformat a bunch of files in a way that's broken or
incorrect, so disable the check until we can find a way to workaround
this. Unfortunately, the indent check is enforced at `make distcheck`
time if GNU indent is installed, so it can't simply be ignored.
Richard Purdie [Mon, 25 Oct 2021 14:33:37 +0000 (15:33 +0100)]
libtool.m4: For reproducibility stop encoding hostname in libtool script
For reproducibility, stop encoding the hostname into the libtool script,
this isn't really adding much to debugging and most distros are carrying
such a patch now as reproducibility is important.
* m4/libtool.m4: Delete call to hostname & uname.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
libtool: Add support for flang (Fortran LLVM-based) compilers
This patch adds support for flang compilers. Some specific flags
are needed so these compilers must be handled in a specific way.
By default, the compiler is called 'flang', but ARM releases their
own flang-based compiler called 'armflang'.
Because of the current lack of flang support in libtool, the
generated 'libtool' must be manually modified after 'configure' is
invoked. Such a process is for example described on ARM web site
(it involves the Open MPI library).
Sam James [Sun, 14 Jan 2024 06:27:33 +0000 (06:27 +0000)]
ltmain.in: Pass through -fdiagnostics-color, -frecord-gcc-switches
* -fdiagnostics-color: who doesn't like color? No reason to strip it. This
makes the link phase stick out like a sore thumb if there's warnings emitted.
* -frecord-gcc-switches: we use it in Gentoo to check if a package respects
*FLAGS. Note that we do not need to include -grecord-gcc-switches explicitly
here as -g* is already whitelisted.
Mingli Yu [Wed, 24 Mar 2021 03:21:04 +0000 (11:21 +0800)]
build: make sure autoheader run before autoconf
autoheader will update ../libtool-2.4.6/libltdl/config-h.in which
autoconf needs, so there comes a race sometimes as below:
| configure.ac:45: error: required file 'config-h.in' not found
| touch '../libtool-2.4.6/libltdl/config-h.in'
So make sure autoheader run before autoconf to avoid this race.
* Makefile.am: Have $(lt_configure) depend on $(lt_config_h_in).
Manoj Gupta [Fri, 16 Dec 2022 18:10:58 +0000 (10:10 -0800)]
libtool: Support "-fno-sanitize*" options.
"-fno-sanitize*" options e.g. -fno-sanitize=alignment
or -fno-sanitize-recover=all are used to tune the behvior of
sanitizers in GCC/clang. Let libtool pass these options
to compiler similar to fsanitize=*.
Vadim Zeitlin [Thu, 23 Jun 2011 09:34:35 +0000 (11:34 +0200)]
libtool: Include _CRTIMP in _putenv() declaration in EXE wrapper sources.
Re-declaring _putenv() without _CRTIMP in strict ANSI mode when using
MinGW resulted in a warning because of a conflict with the previous
declaration that did use _CRTIMP.
Simply add _CRTIMP to our declaration to avoid it.
* build-aux/ltmain.in (func_emit_cwrapperexe_src): Add _CRTIMP to
_putenv() declaration.
Bruno Haible [Wed, 30 Aug 2023 12:03:24 +0000 (14:03 +0200)]
Recognize *-*-windows* config triplets
The gnuconfig project recognizes windows* as a host OS to denote native
Windows environments. The commit message makes it sound like LLVM and
Crablang communities will use the 'windows' value, whereas GNU will
continue to use 'mingw'. But I think it's only a matter of time until
people start to pass the option --host=x86_64-pc-windows to configure
scripts. We should be prepared for that.
* tests/cdemo.at (allow_undefined_flag):
Prefer } to \} in EREs, as \} is not portable.
* tests/libtool.at (quote shell meta-characters in filenames):
Prefer ] to \] in BREs, as \] is not portable.
Paul Eggert [Mon, 19 Sep 2022 20:22:53 +0000 (13:22 -0700)]
libtool: port to GNU grep 3.8
GNU grep 3.8 warns about some regular expressions that POSIX says have
undefined effect, e.g., '\-'. Unfortunately Libtool uses regular
expressions of this form. Some unittests now fail, e.g. link-order.at:
--- /dev/null
+++ .../libtool/tests/testsuite.dir/at-groups/66/stderr
@@ -0,0 +1,4 @@
+/bin/grep: warning: stray \ before /
+/bin/grep: warning: stray \ before /
+/bin/grep: warning: stray \ before /
+/bin/grep: warning: stray \ before /
* m4/libtool.m4 (_LT_LANG_CXX_CONFIG): Do not use \- in a BRE or ERE,
as this produces undefined results that GNU grep 3.8 warns about.
Use [-] instead.
* tests/link-order.at (Link order test): Similarly, do not use
\/ in an ERE; use / instead.
libtool: Use AC_CHECK_PROG instead of AC_CHECK_TOOL to find "file"
This fixes a warning when cross-building:
checking for arm-v7a-linux-gnueabihf-file... no
checking for file... file
configure: WARNING: using cross tools not prefixed with host triplet
file isn't platform specific and not usually installed with a host
triplet. So use AC_CHECK_PROG which differs from AC_CHECK_TOOL by not
expecting such a host triplet prefix.
* m4/libtool.m4 (_LT_DECL_FILECMD): Change AC_CHECK_TOOL to AC_CHECK_PROG.
Alex Ameen [Tue, 8 Feb 2022 19:32:47 +0000 (13:32 -0600)]
gnulib: update submodule to new repository.
* configure.ac: Update autoconf requirement for bootstrapping to 2.64.
* README.md: Update note concerning autoconf version requirement.
* bootstrap: Propogate change to GPL license from GPL 3 to GPL 2.
Alex Ameen [Sun, 5 Dec 2021 22:16:30 +0000 (16:16 -0600)]
tests: remove deprecated old-ltdl-iface.at test.
* tests/old-ltdl-iface.at: remove test as instructed by inline comments, which
indicate that this test should have been deleted in 2013.
This test fails because it relies on legacy usage of 'include Makefile.inc'
by libltdl which is no longer supported.
Alex Ameen [Tue, 30 Nov 2021 03:43:26 +0000 (21:43 -0600)]
* libtool: Bump M4 serial versions and add missing AC_PROG_SED to ltdl.m4
* m4/libtool.m4: bump serial version ( covers entire release ).
* m4/ltargz.m4: bump serial version ( covers entire release ).
Add AC_PROG_SED requirement to LT_FUNC_ARGZ.
* m4/ltdl.m4: bump serial version ( covers entire release ).
Václav Haisman [Tue, 30 Nov 2021 02:37:49 +0000 (20:37 -0600)]
libtool: replace raw invocations of sed with $SED
* build-aux/ltmain.in: replace raw invocations of sed with $SED
* m4/libtool.m4: replace raw invocations of sed with $SED
* m4/ltargz.m4: replace raw invocations of sed with $SED
* m4/ltdl.m4: replace raw invocations of sed with $SED
Co-authored-by: Alex Ameen <alex.ameen.tx@gmail.com>
Copyright-paperwork-exempt: Yes
Lucas Holt [Tue, 30 Nov 2021 00:54:09 +0000 (18:54 -0600)]
libtool: add support for MidnightBSD
* build-aux/ltmain.in: clone link-mode handling for MidnightBSD from FreeBSD
* m4/libtool.m4: clone various TAGVARs for MidnightBSD from FreeBSD
* m4/ltdl.m4: clone dlopen handling for MidnightBSD from FreeBSD
Alex Ameen [Sat, 20 Nov 2021 20:17:20 +0000 (14:17 -0600)]
libtool: replace some references to /usr/bin/file and /bin/sh
* build-aux/ltmain.sh: use '/usr/bin/env sh' in shebang
* libtoolize.in: use '/usr/bin/env sh' in shebang
* m4/libtool.m4: 'FILECMD' to replace use of '/usr/bin/file'
aakropotkin [Fri, 19 Nov 2021 03:24:47 +0000 (21:24 -0600)]
libtool: Add -Wa,* link-mode flag for assembler pass-thru
* build-aux/ltmain.in: add -Wa,* as link-mode flag.
Add help messages for -Wa,* and -Xassember in link mode.
Add help message for -Xcompiler in compile mode.
* doc/libtool.texi: document -Xassembler and -Wa,* for link-mode.