On Tue, Sep 19, 2023 at 04:22:42PM +0200, Bruno Haible wrote:
> The origin of the bug is here:
> $ grep -n CPPFLAGS= tp/Texinfo/XS/configure.ac /dev/null 
> tp/Texinfo/XS/configure.ac:100:  CPPFLAGS=$PERL_EXT_CPPFLAGS
> tp/Texinfo/XS/configure.ac:152:CPPFLAGS=$PERL_EXT_CPPFLAGS

Here is a proposal for a patch.  It still sets

  CFLAGS=$PERL_EXT_CFLAGS
  CPPFLAGS=$PERL_EXT_CPPFLAGS
  LDFLAGS=$PERL_EXT_LDFLAGS

early on, such that CPPFLAGS and other flags are added to that.
I removed the other perl flags because that were previously set
at the point in the configure.ac file because I did not understand why
they would be relevant here for the gnulib macros invokations, but I may
have missed something.

I removed the setting of CFLAGS, CPPFLAGS and LDFLAGS late in
configure.ac.

I made another unrelated change, I added $(PERL_CONF_cccdlflags) to
AM_CFLAGS in Makefile.am, as it seems to me that it would be missing
there, if I understood the documentation correctly.  My feeling is that
it worked previously without that kind of flags because it is also added
by libtool, but it seems to me to be cleaner to have it there.

I can make it a proper commit with Changelog if the approach seems ok.

-- 
Pat
diff --git a/tp/Texinfo/XS/Makefile.am b/tp/Texinfo/XS/Makefile.am
index fadc42d816..9c54beee0a 100644
--- a/tp/Texinfo/XS/Makefile.am
+++ b/tp/Texinfo/XS/Makefile.am
@@ -65,7 +65,7 @@ install-data-hook:
 EXTRA_DIST += TestXS.xs XSParagraph.xs MiscXS.xs
 
 
-AM_CFLAGS = $(PERL_CONF_ccflags) $(PERL_CONF_optimize)
+AM_CFLAGS = $(PERL_CONF_ccflags) $(PERL_CONF_optimize) $(PERL_CONF_cccdlflags)
 AM_CFLAGS += -DVERSION=\"$(VERSION)\" -DXS_VERSION=\"$(VERSION)\"
 AM_CFLAGS += -I$(PERL_INC)
 
diff --git a/tp/Texinfo/XS/configure.ac b/tp/Texinfo/XS/configure.ac
index b9f9fcf658..ccecd43fcc 100644
--- a/tp/Texinfo/XS/configure.ac
+++ b/tp/Texinfo/XS/configure.ac
@@ -96,9 +96,9 @@ if test x$disable_xs != xyes; then
   # Override these variables set by configure at the top level, because 
   # the compiler used in this subdirectory might be different.
   # Change these now so they are used in the checks that follow.
-  CFLAGS="$PERL_EXT_CFLAGS $PERL_CONF_ccflags"
+  CFLAGS=$PERL_EXT_CFLAGS
   CPPFLAGS=$PERL_EXT_CPPFLAGS
-  LDFLAGS="$PERL_EXT_LDFLAGS $PERL_CONF_ccdlflags $PERL_CONF_cccdlflags"
+  LDFLAGS=$PERL_EXT_LDFLAGS
   
   lookup_perl_conf([libperl])
   # Change libperl.so into -lperl to indicate a library dependency to 
@@ -147,10 +147,9 @@ AM_CONDITIONAL([HAVE_ICONV],
                [test "x$am_func_iconv" = "xyes"])
 
 
-# Do not include Perl configuration values when outputting these variables
-CFLAGS=$PERL_EXT_CFLAGS
-CPPFLAGS=$PERL_EXT_CPPFLAGS
-LDFLAGS=$PERL_EXT_LDFLAGS
+# for per code, should use something along
+#CFLAGS="$CFLAGS $PERL_CONF_ccflags $PERL_CONF_cccdlflags"
+#LDFLAGS="$LDFLAGS $PERL_CONF_ccdlflags"
 
 AC_CONFIG_FILES([Makefile gnulib/lib/Makefile])
 AC_OUTPUT

Reply via email to