[PATCH 0/1] configure: Pass CPPFLAGS_FOR_BUILD to subdirectories

Tsukasa OI research_trasio@irq.a4lg.com
Thu Sep 15 05:59:22 GMT 2022
Hello,

While investigating previous -Wstack-usage=262144 removal (on Clang) patch,
I found something intresting.
cf. <https://sourceware.org/pipermail/binutils/2022-September/122817.html>

Here's some excerpt from "$(builddir)/bfd/config.log":

    gcc: warning: @CPPFLAGS_FOR_BUILD@: linker input file unused because linking not done
    gcc: error: @CPPFLAGS_FOR_BUILD@: linker input file not found: No such file or directory
    gcc: warning: @CPPFLAGS_FOR_BUILD@: linker input file unused because linking not done
    gcc: error: @CPPFLAGS_FOR_BUILD@: linker input file not found: No such file or directory
    gcc: warning: @CPPFLAGS_FOR_BUILD@: linker input file unused because linking not done
    gcc: error: @CPPFLAGS_FOR_BUILD@: linker input file not found: No such file or directory

This is because command like this is called:

    gcc -E @CPPFLAGS_FOR_BUILD@ conftest.c

I found that this is because "$(build)/Makefile" passes CPPFLAGS_FOR_BUILD
environment variable without substituting with AC_SUBST
(should be placed in "$(srcdir)/configure.ac").

Here's excerpt from "$(builddir)/Makefile":

    CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@

THIS IS NOT "$(srcdir)/Makefile.in" (it's normal in Makefile.in but should
be substituted while generating "$(builddir)/Makefile").

I searched similar examples and found that following environment variables
are unsubstituted in "$(builddir)/Makefile" AND possibly used in subdirs:

-   CPPFLAGS_FOR_BUILD
-   DSYMUTIL
-   DSYMUTIL_FOR_BUILD
-   DSYMUTIL_FOR_TARGET
-   OTOOL
-   OTOOL_FOR_TARGET

note:
There are other unsubstituted variables but I think they are not used by
any subdirectories.

At least, CPPFLAGS_FOR_BUILD can be tested on my own.
For that, I think this simple patch would work.



Request for Feedback (not a part of this patchset):

dsymutil and otool are macOS development tools (used by libtool). Since I
don't have any modern Mac, I don't want to touch them without testing.
I have a test commit "configure: pass OTOOL and DSYMUTIL to subdirs" in
my GitHub and can someone (who has real Mac machine) test it?
<https://github.com/a4lg/binutils-gdb/tree/config-pass-vars-to-children-dev>


Thanks,
Tsukasa




Tsukasa OI (1):
  configure: Pass CPPFLAGS_FOR_BUILD to subdirs

 configure    | 3 +++
 configure.ac | 2 ++
 2 files changed, 5 insertions(+)


base-commit: fe39ffdc202f04397f31557f17170b40bc42b77a
-- 
2.34.1



More information about the Binutils mailing list