build: Silence autogen.sh warnings
authorEric Blake <eblake@redhat.com>
Wed, 19 Oct 2016 19:37:15 +0000 (14:37 -0500)
committerWouter Verhelst <w@uter.be>
Thu, 20 Oct 2016 18:39:08 +0000 (20:39 +0200)
commitb8852465a15c928e0000c43c571a22b4a4152906
tree2f5b6f7cfed69d8fa169149b50f0d8f9d282887c
parenta441594cc330ddba9c2cb79594a2fb3c69c05abb
build: Silence autogen.sh warnings

Starting from a fresh git checkout, running ./autogen.sh gives a
couple of warnings on my Fedora 24 build tools, one from libtool:

libtoolize: Consider adding '-I support' to ACLOCAL_AMFLAGS in Makefile.am.

and one from automake:

tests/run/Makefile.am:4: warning: source file '$(top_srcdir)/cliserv.c' is in a subdirectory,
tests/run/Makefile.am:4: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding output
automake: object file(s) will be placed in the top-level directory.  However,
automake: this behaviour will change in future Automake versions: they will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.

Following the advice almost works, except that automake 1.15 still
has a nasty bug (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928)
where use of $(foo) in a _SOURCES variable coupled with subdir-objects
creates a directory with a literal name $(foo) rather than the intended
name.  And while open-coding it (using ../../ instead of $(top_srcdir)/)
works around the problem of bad naming in automake 1.15, it fails for
automake 1.11 (hello CentOS 6), due to the order in which .deps files
are erased vs. included in makefiles.  The solution that works across
all automake versions is to only stick files in _SOURCES that do not
live outside of the subtree.  Note that we only need to copy cliserv.c
into the tests/run directory; automakes handling of dependencies will
still rebuild against .h file changes even without listing the .h files
or copying them locally.

I also noticed that the build was already leaving behind an untracked
manpage.log file, in addition to the new .dirstamp witness file created
by our new use of subdir-objects.

This patch has been tested with 'make distcheck' across multiple
automake and libtool versions, ranging from CentOS 6 vintage to current
git toolchains.

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Wouter Verhelst <w@uter.be>
.gitignore
Makefile.am
configure.ac
tests/run/Makefile.am