[sr #110554] AC_CONFIG_HEADERS doesn't work properly for files with Windows line-endings

David Allsopp <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
URL:
  <https://savannah.gnu.org/support/?110554>

                 Summary: AC_CONFIG_HEADERS doesn't work properly for files
with Windows line-endings
                 Project: Autoconf
            Submitted by: dra27
            Submitted on: Thu 21 Oct 2021 04:20:43 PM UTC
                Category: None
                Priority: 5 - Normal
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

For headers with standard


#undef MACRO


lines, AC_CONFIG_HEADERS doesn't perform substitutions if the there is no
whitespace following MACRO and the .in file has Windows CRLF line-endings.

This is a mild nuisance, given that the C pre-processor shouldn't mind about
line endings. The work-around is to add space (or space and a comment) after
the macro name, but the fix seems relatively straightforward (assuming the
change is portable).


diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index c2721a85..d5c222bb 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -824,9 +824,9 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   for (key in D) D_is_set[key] = 1
   FS = "^G"
 }
-/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\r?\$)/ {
   line = \$ 0
-  split(line, arg, " ")
+  split(line, arg, /[ \r\t]/)
   if (arg[1] == "#") {
     defundef = arg[2]
     mac1 = arg[3]





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/support/?110554>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.