Nick Bowler [Sat, 8 Feb 2020 21:36:53 +0000 (16:36 -0500)]
Try an additional workaround for GLib inline issue.
It seems there are a range of GLib versions which #define G_INLINE_FUNC
unconditionally and thus we cannot work around the headers reliance on
obsolete GNU inline semantics by predefining this macro.
On these versions, we can define G_IMPLEMENT_INLINES to disable inline
function usage altogether. This is less ideal but it will at least
allow compilation to proceed.
Nick Bowler [Sat, 8 Feb 2020 16:11:28 +0000 (11:11 -0500)]
Improve distribution of Autotest testsuite dependencies.
A fresh distribution tarball includes a generated testsuite, but
does not have the benefit of rules from automatic dependency tracking.
This means if a file included by the testsuite is modified in the
tarball, the build will not detect that testsuite is out of date
and will not try to rebuild it.
A similar scenario occurs if 'make distclean' is run after building
the test suite.
Since modern Automake uses make rules to generate the dependency stubs,
we can use the distributed testsuite dependencies record to produce
an accurate initial list of prerequisites. And by ensuring that this
file is updated whenever the testsuite is built, we can handle the
'make distclean' case too.
Nick Bowler [Fri, 7 Feb 2020 02:15:04 +0000 (21:15 -0500)]
Improve GLib probe against old GLib versions.
The glib_check_version function was not available in older versions
of glib2, so this is a bad choice for the link test. Let's use
g_get_prgname instead, which is available at least as far back
as glib 2.0.0.
More importantly, with gcc these old glib versions use 'extern inline'
in header files and expect GNU inline semantics. This generally does
not work with modern gcc, so add an additional configure test which
will detect this problem and work around it.
Nick Bowler [Mon, 27 Jan 2020 22:55:01 +0000 (17:55 -0500)]
Add configure as a prerequisite for Autotest package.m4.
The information put in package.m4, for example the package version,
comes from the configure script. When these are updated in the
source tree we want to update this too so that the testsuite gets
updated information.
Nick Bowler [Fri, 22 Feb 2019 22:48:21 +0000 (17:48 -0500)]
Normalize whitespace on detected library flags.
It seems that pkg-config sometimes spits out a bunch of trailing
whitespace. This gets into the substituted variables and makes
them a bit annoying to work with. Add a step to the library helper
which normalizes the spaces: in addition to removing leading and
trailing spaces this will also remove internal spaces, which I
think should be harmless as there does not appear to be any way
for the user to usefully get quoted spaces into these variables.
Nick Bowler [Sun, 6 Jan 2019 16:56:28 +0000 (11:56 -0500)]
Fix depfiles compatibility with modern Automake.
Automake 1.16 changes how depfiles are created. It is now necessary
to define a rule which creates the stub and additionally we must clean
them explicitly. This is a bit annoying to do but that's the price of
relying on undocumented internal behaviour, I guess.
The extra rule should be harmless when using Automake 1.15.
Nick Bowler [Thu, 25 Jan 2018 00:29:52 +0000 (19:29 -0500)]
Fix underquoting issue in DX_DO.
The m4_map macro takes a "quoted list of argument descriptions ...
[which are] in turn a quoted list of quoted elements, suitable for
m4_apply." This is not what actually is being passed in DX_DO,
which is underquoted resulting in various problems.
Add a test case to expose this issue, and switch DX_DO to use
m4_map_args which is a better fit.
Nick Bowler [Sun, 26 Apr 2015 05:49:28 +0000 (01:49 -0400)]
Ensure that all testsuite dependencies are distributed.
Failing to distribute all testsuite dependencies will cause failures
if the testsuite is modified. Unfortunately, this is not caught by
distcheck because the testsuite is not rebuilt normally. Therefore,
it is desirable for the dependencies to be picked up automatically
to reduce the possibility of omission.
We could check the M4 traces in a dist-hook, but then Autotest becomes
a dependency for "make dist", even when the testsuite is not modified.
Instead, distribute a record of all dependencies, and use that to
implement the dist-hook.
Nick Bowler [Wed, 22 Apr 2015 01:47:44 +0000 (21:47 -0400)]
Update DX_COMMAND_OUTPUT to handle newlines and backslashes.
The 'read' builtin eats backslashes from the input, so this macro fails
to properly handle output containing backslashes. Since the -r option
is not portable according to the Autoconf manual, fix up the input by
escaping all backslashes.
While we're at it, remove the "feature" which converts newlines to
spaces because it seems rather silly.
Nick Bowler [Sat, 22 Nov 2014 18:38:20 +0000 (13:38 -0500)]
Fix DX_BASEDIR hoisting problems in base.m4.
Currently, DX_INIT expands to a bunch of text, mostly whitespace.
This is not normally a serious problem, except when DX_BASEDIR
is called at the top level without previously expanding DX_INIT.
Since DX_BASEDIR is intended to be expanded during argument
collection, the result is that DX_INIT's output ends up as part
of the argument where DX_BASEDIR appears.
Fixing this turns out to be somewhat non-trivial. Both DX_INIT and
DX_BASEDIR need to be changed.
- First, avoid using AC_REQUIRE in DX_BASEDIR. This relies on
diversions which do not work correctly during argument collection.
- Rewrite DX_INIT so that it expands to no text whatsoever.
- Finally, the AC_DEFUN_ONCE mechanism appears to insert newlines
where the macros are called for the first time. Use m4_ignore
to eat that inside DX_BASEDIR.
Nick Bowler [Sat, 22 Nov 2014 17:21:10 +0000 (12:21 -0500)]
Fix distribution of dx-stamp.m4.
The automatic distribution of dx-stamp.m4 depends on m4_include
appearing in the m4 traces. Normally aclocal does that but it
seems to not be entirely reliable. The reason we do not simply
use m4_include is because this produces warnings about multiple
inclusion.
Fortunately, this is pretty easy to work around. Just use m4_pushdef
to redefine m4_include to what we need, so the traces show the file
needs to be distributed.
Nick Bowler [Sat, 22 Nov 2014 17:15:48 +0000 (12:15 -0500)]
fix-ltdl: Fix order-only hack with FreeBSD make.
FreeBSD make does not work well when undefined variables are used in
nested expansions. When such an expansion appears in the prerequisites
of a target, FreeBSD make exits with a fatal error. For example:
A = $(var$(B))
foo : $(A)
% make
Error expanding embedded variable.
This causes the order-only hack to fail because FreeBSD make does not
define .FEATURES. The workaround is simple: add another variable which
is assigned the value of .FEATURES. That variable can be used in the
nested expansion to avoid the error.
Nick Bowler [Sat, 22 Nov 2014 17:11:56 +0000 (12:11 -0500)]
fix-gnulib: Fix order-only hack with FreeBSD make.
FreeBSD make does not work well when undefined variables are used in
nested expansions. When such an expansion appears in the prerequisites
of a target, FreeBSD make exits with a fatal error. For example:
A = $(var$(B))
foo : $(A)
% make
Error expanding embedded variable.
This causes the order-only hack to fail because FreeBSD make does not
define .FEATURES. The workaround is simple: add another variable which
is assigned the value of .FEATURES. That variable can be used in the
nested expansion to avoid the error.
Nick Bowler [Mon, 9 Jun 2014 23:46:34 +0000 (19:46 -0400)]
Add libpng detection macro.
I've been carrying around library detection in individual projects for
too long. This is a from-scratch rewrite of the core probing code but
the actual libpng test is basically the same as before.
The idea is to better leverage M4 macros to reduce duplication, so it
should be easy to add more libraries in the future.
Nick Bowler [Fri, 21 Jun 2013 19:58:49 +0000 (15:58 -0400)]
fix-gnulib: Improve filename mangling.
This corrects a problem with some of the make rules in the localcharset
module. Some filenames were not being properly prefixed with lib/ while
others were, leading to some files not being built.
Nick Bowler [Wed, 13 Mar 2013 01:03:59 +0000 (21:03 -0400)]
fix-gnulib: Add a call to AC_CONFIG_LIBOBJ_DIR
For some reason, the alloca module uses Autoconf's stock LIBOBJ
machinery and things explode if AC_CONFIG_LIBOBJ_DIR is not set
correctly, because the Gnulib macros sure don't.
Add such a call to the included m4 fragment to fix things up.
The amount of magic and poor documentation around this feature is
astounding.
Nick Bowler [Tue, 8 Jan 2013 23:54:41 +0000 (18:54 -0500)]
Add some backwards-compatibility helpers for silent-rules.
The silent-rules support in Automake has changed over the ages. Most
glaringly, the output alignment changed between 1.11 and 1.12. Add a
new macro, DX_AUTOMAKE_COMPAT, which is intended to capture the
compatibility hacks needed to support multiple versions of Automake.
Currently, this means that it will define a variable to help print
silent-rule output that maintains alignment, and it will AC_SUBST
compatible versions, if necessary, of variables substituted in later
versions of Automake's silent-rule support.
Update glconfig.mk to make use of the new feature.
Nick Bowler [Wed, 5 Dec 2012 23:22:44 +0000 (18:22 -0500)]
Fix DX_EXPORTED_SH to AC_SUBST required variables.
The exported.sh support wasn't really usable as-is since it was relying
on a symbol defined by cdecl99's configure.ac. Bring that configuration
into the common macro.
Nick Bowler [Wed, 29 Aug 2012 00:38:53 +0000 (20:38 -0400)]
exported.sh: Improve error handling.
Use the eval trick to handle errors from commands in the pipeline other
than the last. In particular, we now detect if nm failed and return an
error status in this case. While we're rewriting this code, replace
sort | uniq with sort -u as the latter should be fine according to
POSIX. We can re-add the two-command version if it actually causes
problems.
Nick Bowler [Wed, 15 Aug 2012 20:46:33 +0000 (16:46 -0400)]
Import exported.sh from cdecl99.
This script is required for the glconfig.mk snippet to actually
work, but it somehow got forgotten when that snippet was imported.
Bring in the script, and add M4 plumbing to support finding auxilliary
files in the dxcommon source directory. The result should be totally
automatic, although this unfortunately means that users of fix-gnulib.pl
that don't need or want to use glconfig.mk are stuck with some extra
dependencies (including libtool) to generate the exported.sh script.
Currently, I can't think of a way to keep the automatic glconfig.mk
support (i.e., the only thing users really have to do is include the
snippet for it to work) without this spurious dependency. So things
may need to change later, but let's just get the support in for now.
Nick Bowler [Tue, 24 Jul 2012 23:59:34 +0000 (19:59 -0400)]
fix-gnulib: Handle MOSTLYCLEANDIRS.
Usage of this variable suffers from similar problems as xxxCLEANFILES,
so fix it up in the same way by moving it to the end of the makefile
fragment. The check needs to be improved a bit as the fragment contains
actual references to this variable, and only want to move the
assignments.
The variable also needs to be set before use, which strangely doesn't
actually happen in the fragment, even though this is a totally internal
thing...
Nick Bowler [Fri, 11 May 2012 02:17:51 +0000 (22:17 -0400)]
fix-ltdl: Delete libobj symlink before attempting to create it.
There seems to be a (rare) race in parallel builds where make for some
reason decides to update the libobj symlink after it already exists,
which fails. I can't reproduce the failure, but deleting the symlink
(if one exists) before creating it should avoid the issue.
Nick Bowler [Thu, 10 May 2012 00:51:24 +0000 (20:51 -0400)]
Merge branch 'fix-gnulib' of /home/nbowler/projects/cdecl99
Import the fix-gnulib history from cdecl99.
* 'fix-gnulib' of /home/nbowler/projects/cdecl99:
Better document fix-gnulib.
Make fix-gnulib only need a single output file.
Simplify glconfig include mechanism.
Mangle spliced makefile lines in Gnulib correctly.
Avoid gratuitous library dependencies linking gnulib.
Rewrite Gnulib symbols to be in libcdecl's namespace.
Split gnulib_headers into 3 variables.
Move all Gnulib CLEANFILES variables to the end of the makefile.
Handle gl_LIBOBJS/gl_LTLIBOBJS correctly.
Eliminate use of BUILT_SOURCES from Gnulib.
Integrate Gnulib non-recursively.
Nick Bowler [Thu, 10 May 2012 00:02:29 +0000 (20:02 -0400)]
Better document fix-gnulib.
Add a big blurb in the comments describing the main bits required to use
the script in a project. Also rename the header variables a bit so we
can ensure future compatibility with the documented behaviour.
Nick Bowler [Wed, 9 May 2012 23:59:32 +0000 (19:59 -0400)]
Make fix-gnulib only need a single output file.
We combine the Automake and M4 bits into a single polyglot that can be
interpreted by either, so all one needs to do is include the makefile
fragment in configure.ac. I've created a monster.
libcdecl doesn't use the readline module at all, but libtool happily
pulls it in as a dependency. Handle library dependencies manually to
avoid this problem.
Nick Bowler [Wed, 21 Sep 2011 04:51:17 +0000 (00:51 -0400)]
Rewrite Gnulib symbols to be in libcdecl's namespace.
The gnulib symbols are not properly prefixed for libcdecl internal
symbols (e.g. cdecl__blah). This *will* cause problems when statically
linking against both libcdecl and another library that uses the same
gnulib modules.
Unfortunately, there's no simple way to determine what symbols need
prefixing without compiling all the gnulib objects. The results can't
be distributed either, because they depend on the configuration. So,
limited to simple tools and portable make rules, we hack together a
"new" config.h at build time that defines object-like macros to rewrite
the symbols, carefully ensuring that header dependencies are correct.
Nick Bowler [Mon, 19 Sep 2011 03:01:18 +0000 (23:01 -0400)]
Eliminate use of BUILT_SOURCES from Gnulib.
As with recursive make, BUILT_SOURCES is harmful because of inadequate
dependency information. We can achieve a similar effect with by using
order-only dependencies: These force the headers to be up-to-date
before anything that might require them is built: but rebuilds are only
triggered based on the accurate dependency information generated by the
normal mechanisms.
Unfortunately, order-only dependencies are a GNU make feature, so we use
a hack which should fall back to ordinary dependencies on other make
implementations. The worst effect of using ordinary dependencies will
be that files might be needlessly rebuilt when a header changes.