On Thu, Sep 21, 2023 at 06:06:34PM +0200, Patrice Dumas wrote: > On Wed, Sep 20, 2023 at 08:44:34PM +0100, Gavin Smith wrote: > > One change at a time please. Any gnulib tests should be run > > with the same compiler flags as used to compile the shared library. > > On that subject, and independently of the main issue of CPPFLAGS, this > is not what is actually done. In configure.ac, we have > > LDFLAGS="$PERL_EXT_LDFLAGS $PERL_CONF_ccdlflags $PERL_CONF_cccdlflags" > > In Makefile.am, the equivalent part is (rewritten for brievity) > > AM_LDFLAGS = -avoid-version -module $(PERL_CONF_ccdlflags) > if HOST_NEEDS_NO_UNDEFINED > AM_LDFLAGS += -no-undefined -L$(PERL_INC) $(PERL_CONF_libperl) > endif > > So, there are additional flags if HOST_NEEDS_NO_UNDEFINED, but there is > no use of $PERL_CONF_cccdlflags. According to my reading of the > documentation, it is actually ok not to have $PERL_CONF_cccdlflags > in AM_LDFLAGS as it is a CFLAGS, it should be in AM_CFLAGS if it is > kept (and I think it should), and should in any case be removed from > configure.ac LDFLAGS.
I see you made some changes to this (on 2023-09-24). I've just made a further change (121d5104101) to make it clearer that the same flags are used in both configure.ac and in Makefile.am: Author: Gavin Smith <gavinsmith0...@gmail.com> Date: Mon Nov 20 20:52:51 2023 +0000 XS build flags * tp/Texinfo/XS/configure.ac (perl_conf_CFLAGS, perl_conf_LDFLAGS): Set and output with AC_SUBST. Append to CFLAGS and LDFLAGS for checks only. * tp/Texinfo/XS/Makefile.am: Reuse perl_conf_CFLAGS and perl_conf_LDFLAGS. This makes it clearer that we are adding the same flags for building as for configure checks. We could check if -avoid-version -module should be used for configure checks too (likewise -no-undefined etc.) and if so, put them in perl_conf_LDFLAGS the same way. > There is another inconsistency between Makefile.am and configure.ac, > in configure.ac CFLAGS is: > CFLAGS="$PERL_EXT_CFLAGS $PERL_CONF_ccflags" > > In Makefile.am, we have > AM_CFLAGS = $(PERL_CONF_ccflags) $(PERL_CONF_optimize) > Such that, to be consistent, in configure.ac CFLAGS should be > CFLAGS="$PERL_EXT_CFLAGS $PERL_CONF_ccflags $PERL_CONF_optimize" I think you did this. > (and also, but it does not seems to me to be important) > AM_CFLAGS += -DVERSION=\"$(VERSION)\" -DXS_VERSION=\"$(VERSION)\" > AM_CFLAGS += -I$(PERL_INC) Possibly not important for the checks, but it could potentially be added as well if needed (the -I flag may make a difference even if the -D flags don't). I see you put this in XSLIBS_CPPFLAGS. We could have a similar approach and add an extra variable to pass the extra flags from configure.ac to Makefile.am. But I would want to understand whether these flags might be important for configure checks first.