This reverts commit 17ac400c11.
The build failures were due to incorrectly using $(INCLUDES) when
running $(AS). Let's roll this back and drop $(INCLUDES) from the
$(AS) invocations.
The libgloss port has been reaching back into newlib internals for a
single header whose contents have been frozen for almost a decade.
To break this backwards libgloss->newlib dependency, move the acle
header to the srcroot include/ so everyone can use the same copy.
Unless make is invoked with V=1, have xmlto pass the parameter
'man.output.quietly=1' to xsltproc to suppress "Note: Writing foo.N"
output from the manpages stylesheet.
(This doesn't quite do what it says: The output is not silenced if V has
any value, including 0. You could consider that either a bug or a
feature.)
Integrate the old libm/test/ subdir into the main build. It hasn't
been used in a long time causing the code to rot a bit. I've fixed
some of those, but it still fails for many ports, so it's disabled
by default. People who want to take a closer look can run:
$ make libm/test/test
Convert all the libc/ subdir makes into the top-level Makefile. This
allows us to build all of libc from the top Makefile without using any
recursive make calls. This is faster and avoids the funky lib.a logic
where we unpack subdir archives to repack into a single libc.a. The
machine override logic is maintained though by way of Makefile include
ordering, and source file accumulation in libc_a_SOURCES.
There's a few dummy.c files that are no longer necessary since we aren't
doing the lib.a accumulating, so punt them.
The winsup code has been pulling the internal newlib ssp library out,
but that doesn't exist anymore, so change that to pull the objects.
Some awk implementations such as old versions of mawk do not support the
length() function. Use the return value of the POSIX split() function instead.
The current targ-include setup runs `cp` every header file it installs,
in serial. This can be a little noticeable on systems, so cleanup the
logic to rely on cp's ability to copy multiple files to a directory in
a single call.
We still need a check for empty directories with no headers (i.e. the
glob doesn't match anything), so add a helper variable to contain that
logic to reduce the boiler plate a little.
Since POSIX cp requires copying a file to a directory without having
to specify the name explicitly, rely on that to avoid calling basename
on every source file.
We can also drop the stub `true` call if the -f test failed. The use
of `if` already takes care of that in POSIX shell.
I split libg.a out into a sep target from libc.a for the main dir in
commit f2b053f49e ("newlib: separate out
libg from libc"), but missed the multilib dirs. That leads to an
uncommon parallel build failure:
- libc.a rule runs & finishes
- $(BUILD_MULTISUBDIR)/libc.a rule runs
-> failure due to libg.a not yet existing
- libg.a rule runs & finishes
Split the multilib libg rule out from libc too so it can depend on the
main libg directly and avoid this race.
Convert all the libm/ subdir makes into the top-level Makefile. This
allows us to build all of libm from the top Makefile without using any
recursive make calls. This is faster and avoids the funky lib.a logic
where we unpack subdir archives to repack into a single libm.a. The
machine override logic is maintained though by way of Makefile include
ordering, and source file accumulation in libm_a_SOURCES.
One thing to note is that this will require GNU Make because of:
libm_a_CFLAGS = ... $(libm_a_CFLAGS_$(subst /,_,$(@D)))
This was the only way I could find to supporting per-dir compiler
settings, and I couldn't find a POSIX compatible way of transforming
the variable content. I don't think this is a big deal as other
Makefiles in the tree are using GNU Make-specific syntax, but I call
this out as it's the only one so far in the new automake code that
I've been writing.
Automake doesn't provide precise control over the output object names
(by design). This is fine by default as we get consistent names in all
the subdirs: libm_a-<source>.o. But this relies on using the same set
of compiler flags for all objects. We currently compile libm/common/
with different optimizations than the rest.
If we want to compile objects differently, we can create an intermediate
archive with the subset of objects with unique flags, and then add those
objects to the main archive. But Automake will use a different prefix
for the objects, and thus we can't rely on ordering to override.
But if we leverage $@, we can turn Automake's CFLAGS into a multiplex
on a per-dir (and even per-file if we wanted) basis. Unfortunately,
since $@ contains /, Automake complains it's an invalid name. While
GNU Make supports this, it's a POSIX extension, so Automake flags it.
Using $(subst) avoids the Automake warning to get a POSIX compliant
name, albeit with a GNU Make extension.
Make this a separate target from libc so that we can migrate libc over
to automake more easily. Having it integrated into the libc target is
difficult to handle when using automake rules which expect a one-to-one
mapping between names & inputs.
This was only ever used for i?86-pc-linux-gnu targets, but that's been
broken for years, and has since been dropped. So clean this up too.
This also deletes the funky objectlist logic since it only existed for
the libtool libraries. Since it was the only thing left in the small
Makefile.shared file, we can punt that too.
This allows building the libc & libm pages in parallel, and drops
the duplication in the subdirs with the chew/chapter settings.
The unused rules in Makefile.shared are left in place to minimize
noise in the change.
This doesn't migrate all the docs, just the libc's manual (pdf/info).
This is to show the basic form of migrating the chew files.
For subdirs that didn't have any docs, I've stripped their settings
for clarity. If someone wanted to suddenly add docs, they can add
the corresponding Makefile.inc files easily.
We use the common config-ml.in for configure, so switch the makefile
over to the common multilib.am. It's almost exactly the same code,
but there are two differences:
* Common code hooks install-exec-local for install-multi, but newlib
doesn't currently install any executables, so that doesn't fire.
Newlib already has install-data-local that inlined install-multi,
so switch that to the common install-multi.
* Common code doesn't provide a check-multi at all. Keep ours for
now. Some day common code might get it. Or not. Who knows.
Currently this is only enabled in the top-level as that's the only
place where it seemed to be used. But the libc/sys/phoenix/ dir
also uses this functionality, but fails to explicitly enable it.
Automake workedaround it, but generated warnings. Move the option
to NEWLIB_CONFIGURE so all dirs get it automatically iff they end
up using the option. If they don't use the option, there's no
difference to the generated code.
The newlib & libgloss dirs are already generated using autoconf-2.69.
To avoid merging new code and/or accidental regeneration using diff
versions, leverage config/override.m4 to pin to 2.69 exactly. This
matches what gcc/binutils/gdb are already doing.
The README file already says to use autoconf-2.69.
To accomplish this, it's just as simple as adding -I flags to the
top-level config/ dir when running aclocal. This is because the
override.m4 file overrides AC_INIT to first require the specific
autoconf version before calling the real AC_INIT.
The 'cygnus' option was removed from automake 1.13 in 2012, so the
presence of this option prevents that or a later version of automake
being used.
A check-list of the effects of '--cygnus' from the automake 1.12
documentation, and steps taken (where possible) to preserve those
effects (See also this thread [1] for discussion on that):
[1] https://lists.gnu.org/archive/html/bug-automake/2012-03/msg00048.html
1. The foreign strictness is implied.
Already present in AM_INIT_AUTOMAKE in newlib/acinclude.m4
2. The options no-installinfo, no-dependencies and no-dist are implied.
Already present in AM_INIT_AUTOMAKE in newlib/acinclude.m4
Future work: Remove no-dependencies and any explicit header dependencies,
and use automatic dependency tracking instead. Are there explicit rules
which are now redundant to removing no-installinfo and no-dist?
3. The macro AM_MAINTAINER_MODE is required.
Already present in newlib/acinclude.m4
Note that maintainer-mode is still disabled by default.
4. Info files are always created in the build directory, and not in the
source directory.
This appears to be an error in the automake documentation describing
'--cygnus' [2]. newlib's info files are generated in the source
directory, and no special steps are needed to keep doing that.
[2] https://lists.gnu.org/archive/html/bug-automake/2012-04/msg00028.html
5. texinfo.tex is not required if a Texinfo source file is specified.
(The assumption is that the file will be supplied, but in a place that
automake cannot find.)
This effect is overriden by an explicit setting of the TEXINFO_TEX
variable (the directory part of which is fed into texi2X via the
TEXINPUTS environment variable).
6. Certain tools will be searched for in the build tree as well as in the
user's PATH. These tools are runtest, expect, makeinfo and texi2dvi.
For obscure automake reasons, this effect of '--cygnus' is not active
for makeinfo in newlib's configury.
However, there appears to be top-level configury which selects in-tree
runtest, expect and makeinfo, if present. So, if that works as it
appears, this effect is preserved. If not, this may cause problem if
anyone is building those tools in-tree.
This effect is not preserved for texi2dvi. This may cause problems if
anyone is building texinfo in-tree.
If needed, explicit checks for those tools looking in places relative to
$(top_srcdir)/../ as well as in PATH could be added.
7. The check target doesn't depend on all.
This effect is not preseved. The check target now depends on the all
target.
This concern seems somewhat academic given the current state of the
testsuite.
Also note that this doesn't touch libgloss.
- Currently, printf("%La\n", 1e1000L) crashes with segv due to lack
of frexpl() function. With this patch, frexpl() function has been
implemented in libm to solve this issue.
Addresses: https://sourceware.org/pipermail/newlib/2021/018718.html
So far the build mechanism in newlib only allowed to either define
machine-specific headers, or headers shared between all machines.
In some cases, architectures are sufficiently alike to share header
files between them, but not with other architectures. A good example
is ix86 vs. x86_64, which share certain traits with each other, but
not with other architectures.
Introduce a new configure variable called "shared_machine_dir". This
dir can then be used for headers shared between architectures.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
previous commit 4c90db7bc8 introduced
a compile time error because libm/common/s_infconst.c used the remove
__fmath, __dmath, and __ldmath union types.
Since this is very old, and unused for a very long time, just drop the
file and thus the __infinity constants entirely.
Exception: Cygwin exports __infinity from the beginning. There's a very,
VERY low probability that any existing executable or lib still uses this
constant, but we just keep it in for backward compat, nevertheless.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
https://sourceware.org/ml/newlib/2016/msg01139.htmlhttps://gcc.gnu.org/ml/gcc/2016-12/msg00010.html
There is no change if libtool is used.
Some run-time support libraries provided by GCC (e.g. libgomp) use
configure checks to detect certain features, e.g. availability of
thread-local storage. The configure script generates a test program and
tries to compile and link it. It should use target libraries and
startfiles of the build tree if available and not random ones from the
installation prefix for this procedure. The search directories
specified by -B are a bit special, see for_each_path() in gcc.c of the
GCC sources. First a search is performed on all search paths with the
multilib directory appended (if desired), then a second search is
performed on demand with the base directory only. For each multilib
there is a "newlib" subdirectory. This directory is specified by a -B
option for the support libraries. In order to find the newlib artifacts
(ctr0.o, libc.a, libg.a and libm.a) they must be located in a proper
multilib subdirectory withing the build directory.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Ensure the Python Lex/Yacc (PLY) cache used by makedocbook is initialized
before it is used by parallelizable rules to make the DocBook XML, as it
appears that these can collide in cache generation, leading to errors.
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Add makedocbook, a tool to process makedoc markup and output DocBook XML
refentries.
Process all the source files which are processed with makedoc with
makedocbook as well
Add chapter-texi2docbook, a tool to automatically generate DocBook XML
chapter files from the chapter .texi files. For generating man pages all we
care about is the content of the refentries, so all this needs to do is
convert the @include of the makedoc generated .def files to xi:include of
the makedocbook generated .xml files.
Add skeleton Docbook XML book files, lib[cm].in.xml which include these
generated chapters, which in turn include the generated files containing
refentries, which is processed with xsltproc to generate the lib[cm].xml
Add new make targets to generate and install man pages from lib[cm].xml
Add makedocbook, a tool to process makedoc markup and output DocBook XML
refentries.
Process all the source files which are processed with makedoc with
makedocbook as well
Add chapter-texi2docbook, a tool to automatically generate DocBook XML
chapter files from the chapter .texi files. For generating man pages all we
care about is the content of the refentries, so all this needs to do is
convert the @include of the makedoc generated .def files to xi:include of
the makedocbook generated .xml files.
Add skeleton Docbook XML book files, lib[cm].in.xml which include these
generated chapters, which in turn include the generated files containing
refentries, which is processed with xsltproc to generate the lib[cm].xml
Add new make targets to generate and install man pages from lib[cm].xml
Currently, the newlib version information needs to be updated in two places:
- newlib/acinclude.m4
- newlib/libc/include/sys/features.h
The goal of this patch is to:
- supply a single location for defining the newlib version
information: newlib/acinclude.m4
- define __NEWLIB__, __NEWLIB_MINOR__ and __NEWLIB_PATCHLEVEL__
This is in line with what gcc does for its version macros. See:
https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html
This patch moves the definition of the _NEWLIB_VERSION, __NEWLIB__
and __NEWLIB_MINOR__ macros from newlib/libc/include/sys/features.h,
to the newly generated newlib/_newlib_version.h file. Additionally,
the __NEWLIB_PATCHLEVEL__ macro was created, for completeness.
In order to stay backwards compatible, newlib/_newlib_version.h gets
included by newlib/newlib.h and newlib/libc/include/sys/features.h.
Note: This patch does _not_ include the modifications to the following
files, as these should all be generated any way.
*Makefile.in,
*aclocal.m4,
*configure
stamp-* files
Signed-off-by: Pieter du Preez <pdupreez@gmail.com>
* configure.in: Comment out the --enable-newlib-fp-hw option
as the mathfp library is inaccurate and should not be used.
* Makefile.am: Add comment regarding the mathfp directory.
* configure: Regenerated.
* Makefile.in: Ditto.
* libm/mathfp/README: New file that details why the mathfp
directory is not used.
* configure.host: Add noinclude variable to allow specification
of header files to remove from installation.
* acinclude.m4: Provide NO_INCLUDE_LIST variable based on
noinclude variable in configure.host.
* configure: Regenerated.
* Makefile.am: Remove all header files in NO_INCLUDE_LIST.
* Makefile.in: Regenerated.