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

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

 



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


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf



[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux