autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] config.status: Allow dos style line endings in config.in.


From: Andrew Burgess
Subject: [PATCH] config.status: Allow dos style line endings in config.in.
Date: Fri, 7 Aug 2015 17:34:54 +0200

The patch below deals with an issue that I ran into as a result of a
miss-configured version control system "helpfully" adding dos style
line endings to some files.

Though clearly the correct solution is to fix the configuration of my
version control system, the issue was particularly irritating as it
was not clear from the errors that resulted what the cause of those
errors was.

So, even though the specification does clearly say that the template
config.h file should have unix line endings, I would like to propose
the patch below that simply removes the dos line endings.

Though this might seem like a rather random fix, removing dos line
endings from the config.h template file, it turns out that most files
are happy with dos line endings already and so don't need a similar
fix.

If the patch is approved then Embecosm has a copyright assignment on
file for autoconf, however, I don't have write access so someone else
would need to apply for me.

Thanks,
Andrew


-- 

If the template config.h file has dos style line endings (which it
shouldn't, but sometimes they get in there anyway), then ensure that we
can still correctly generate the config.h file.

When dos style line endings are present in the config.h template then
it can be non-obvious what caused the resulting error.

* lib/autoconf/status.m4 (defines.awk): Remove dos style line endings.
* tests/torture.at (DOS line endings in config.in): New test for
  template containing dos style line endings.
---
 lib/autoconf/status.m4 |  1 +
 tests/torture.at       | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/lib/autoconf/status.m4 b/lib/autoconf/status.m4
index 7bda371..c3686b1 100644
--- a/lib/autoconf/status.m4
+++ b/lib/autoconf/status.m4
@@ -825,6 +825,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
   for (key in D) D_is_set[key] = 1
   FS = ""
 }
+{ sub(/\r$/, "") }
 /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
   line = \$ 0
   split(line, arg, " ")
diff --git a/tests/torture.at b/tests/torture.at
index bc7fef3..a920ace 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -1401,6 +1401,31 @@ file2
 
 AT_CLEANUP
 
+## ------------------------------ ##
+## DOS line endings in config.in  ##
+## ------------------------------ ##
+
+AT_SETUP([DOS line endings in config.in])
+
+AT_DATA([configure.ac],
+[[AC_INIT
+AC_CONFIG_HEADERS(config.h:config.hin)
+AC_OUTPUT
+]])
+
+AT_CHECK_AUTOCONF
+AT_CHECK_AUTOHEADER
+
+AT_CHECK_CONFIGURE
+AT_CHECK([mv config.h config.h.original])
+
+# Convert line endings in config.hin from unix to dos style.
+AT_CHECK([sed -i -e 's/$/\r/' config.hin])
+AT_CHECK_CONFIGURE
+
+AT_CHECK([diff config.h config.h.original])
+
+AT_CLEANUP
 
 AT_BANNER([autoreconf.])
 
-- 
2.4.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]