|
From: | Paul Eggert |
Subject: | Re: [PATCH] gnulib-tool: new option --gnu-make |
Date: | Tue, 14 Mar 2017 01:27:17 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
Bruno Haible wrote:
Anything that uses an Automake-specific feature other than "if FOO / else / endif" would be suspect, yes. For example, I suppose there would be trouble if a module uses the Automake syntax "if FOO / else !FOO / endif !FOO".Hmm. We use this pattern a lot. In particular, in every module that overrides an system include file: $ grep -r '^if[^;]*$' modules | grep -v ' test ' | LC_ALL=C sort modules/alloca-opt:if GL_GENERATE_ALLOCA_H ...
These should all be OK. I should have been clearer: those 'if FOO' lines should be fine, as 'gnulib-tool --gnu-make' should transform them into 'ifneq (,$(FOO))' lines and should define FOO properly. The problem is merely a syntactic one, in that gnulib-tool doesn't handle 'else !FOO' or 'endif !FOO' lines, and insists on plain 'else' and 'endif' lines. Luckly, Gnulib uses only plain 'else' and 'endif' lines so this is not a problem in practice.
I ran into another glitch when testing --gnu-make. When building GNU Emacs on Solaris 10 (which bundles GNU Make 3.82), an out-of-source build (which uses VPATH) fails to use the build-aux/snippets/*.h files correctly. For example, 'make V=1 getopt.h' executes this:
rm -f getopt.h-t getopt.h && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ -e 's|@''HAVE_GETOPT_H''@|1|g' \ -e 's|@''INCLUDE_NEXT''@|include_next|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@||g' \ -e 's|@''PRAGMA_COLUMNS''@||g' \ -e 's|@''NEXT_GETOPT_H''@|<getopt.h>|g' \ -e '/definition of _GL_ARG_NONNULL/r arg-nonnull.h' \ < ../../emacs-26.0.50/lib/getopt.in.h; \ } > getopt.h-t && \ mv -f getopt.h-t getopt.hwithout first building arg-nonnull.h, even though the makefile line says 'getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H)' so that arg-nonnull.h is a dependency. Unfortunately POSIX requires 'sed' to ignore the fact that arg-nonnull.h is missing, so the rule succeeds and creates a getopt.h file that does not work. I don't know whether this is a bug in this old version of GNU Make, but regardless of whether it is a bug it's probably better to work around the problem, which I did by applying the attached patch to Gnulib. This patch simply omits the copyright-notice-stripping nicety for all the affected modules other than link-warning. I'm not sure how to work around the problem in the link-warning module (which also does a substitution), so I merely added a FIXME for it (Emacs does not use this module).
I still don't have a GNU Make-based Gnulib working quite right on Solaris; I have another problem with the faccessat module on Solaris 10 and plan to look into that next.
0001-snippets-work-around-GNU-Make-3.82-VPATH.txt
Description: Text document
[Prev in Thread] | Current Thread | [Next in Thread] |