[m-rev.] for review by Julien: Fix handling of newlines in configure.ac.

Paul Bone paul at bone.id.au
Wed Feb 4 23:20:28 AEDT 2015


Branches: master, version-14_01-branch

Julien, does my solution make sense to you?  You know more about platform
independance than I do.

BTW are we planning a 14.01.2 or should I only worry about the master
branch?  I beleive that we're waiting on upgradeing boehm for our next
master release.

---

Fix handling of newlines in configure.ac.

When using cl as the C compiler on cygwin I found that as cl was used to
compile the configuration test programs (for example that determine the
integer type that is at least 64 bytes wide) these programs write out CRLF
pairs to end lines.  However configure is running in cygwin which expects LF
to terminate lines and the CR is stored as part of the word.  This creates
further problems when running configure on these systems:

    checking for an integer type with the same size as a pointer... int
    checking for an integer type of at least 64 bits... __int64 configure:
    error: Cannot determine the length modifier for the MR_int_least64_t
    type.

Configure can't match __int64^M against __int64 and therefore cannot
determine the correct length modifier

This patch removes the "\n" escapes from the relevant printf calls.

configure.ac:
    As above.
---
 configure.ac | 46 +++++++++++++++++++++++-----------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0117d1b..3dc2bb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1749,17 +1749,17 @@ AC_CACHE_VAL(mercury_cv_word_type,
 
         if (sizeof(int) == sizeof(void *))
         {
-            fprintf(fp, "int\n");
+            fprintf(fp, "int");
             exit(0);
         }
 
         if (sizeof(long) == sizeof(void *))
         {
-            fprintf(fp, "long\n");
+            fprintf(fp, "long");
             exit(0);
         }
 
-        fprintf(fp, "unknown\n");
+        fprintf(fp, "unknown");
         exit(1);
     }],
     [mercury_cv_word_type=`cat conftest.tags`],
@@ -1779,11 +1779,11 @@ if test "$mercury_cv_word_type" = unknown; then
 
         if (sizeof(long long) == sizeof(void *))
         {
-            fprintf(fp, "long long\n");
+            fprintf(fp, "long long");
             exit(0);
         }
 
-        fprintf(fp, "unknown\n");
+        fprintf(fp, "unknown");
         exit(1);
     }],
     [mercury_cv_word_type=`cat conftest.tags`],
@@ -1823,13 +1823,13 @@ AC_CACHE_VAL(mercury_cv_int_least64_type,
 
         if (sizeof(int) * CHAR_BIT >= 64)
         {
-            fprintf(fp, "int\n");
+            fprintf(fp, "int");
             exit(0);
         }
 
         if (sizeof(long) * CHAR_BIT >= 64)
         {
-            fprintf(fp, "long\n");
+            fprintf(fp, "long");
             exit(0);
         }
 
@@ -1837,12 +1837,12 @@ AC_CACHE_VAL(mercury_cv_int_least64_type,
     #ifdef _MSC_VER
         if (sizeof(__int64) * CHAR_BIT >= 64)
         {
-            fprintf(fp, "__int64\n");
+            fprintf(fp, "__int64");
             exit(0);
         }
     #endif
 
-        fprintf(fp, "unknown\n");
+        fprintf(fp, "unknown");
         exit(1);
     }],
     [mercury_cv_int_least64_type=`cat conftest.tags`],
@@ -1863,11 +1863,11 @@ if test "$mercury_cv_int_least64_type" = unknown; then
 
         if (sizeof(long long) * CHAR_BIT >= 64)
         {
-            fprintf(fp, "long long\n");
+            fprintf(fp, "long long");
             exit(0);
         }
 
-        fprintf(fp, "unknown\n");
+        fprintf(fp, "unknown");
         exit(1);
     }],
     [mercury_cv_int_least64_type=`cat conftest.tags`],
@@ -1914,17 +1914,17 @@ AC_CACHE_VAL(mercury_cv_int_least32_type,
 
         if (sizeof(int) * CHAR_BIT >= 32)
         {
-            fprintf(fp, "int\n");
+            fprintf(fp, "int");
             exit(0);
         }
 
         if (sizeof(long) * CHAR_BIT >= 32)
         {
-            fprintf(fp, "long\n");
+            fprintf(fp, "long");
             exit(0);
         }
 
-        fprintf(fp, "unknown\n");
+        fprintf(fp, "unknown");
         exit(1);
     }],
     [mercury_cv_int_least32_type=`cat conftest.tags`],
@@ -1982,17 +1982,17 @@ AC_CACHE_VAL(mercury_cv_int_least16_type,
 
         if (sizeof(short) * CHAR_BIT >= 16)
         {
-            fprintf(fp, "short\n");
+            fprintf(fp, "short");
             exit(0);
         }
 
         if (sizeof(int) * CHAR_BIT >= 16)
         {
-            fprintf(fp, "int\n");
+            fprintf(fp, "int");
             exit(0);
         }
 
-        fprintf(fp, "unknown\n");
+        fprintf(fp, "unknown");
         exit(1);
     }],
     [mercury_cv_int_least16_type=`cat conftest.tags`],
@@ -2033,20 +2033,20 @@ AC_CACHE_VAL(mercury_cv_low_tag_bits,
 
         if (sizeof(void *) == 4)
         {
-            fprintf(fp, "2\n");
+            fprintf(fp, "2");
             exit(0);
         }
         if (sizeof(void *) == 8)
         {
-            fprintf(fp, "3\n");
+            fprintf(fp, "3");
             exit(0);
         }
         if (sizeof(void *) == 16)
         {
-            fprintf(fp, "4\n");
+            fprintf(fp, "4");
             exit(0);
         }
-        fprintf(fp, "0\n");
+        fprintf(fp, "0");
         exit(1);
     }],
     [mercury_cv_low_tag_bits=`cat conftest.tags`],
@@ -2078,7 +2078,7 @@ AC_CACHE_VAL(mercury_cv_bytes_per_word,
         fp = fopen("conftest.wordbytes", "w");
         if (fp == NULL)
             exit(1);
-        fprintf(fp, "%d\n", sizeof(void *));
+        fprintf(fp, "%d", sizeof(void *));
 
         exit(0);
     }],
@@ -2106,7 +2106,7 @@ AC_CACHE_VAL(mercury_cv_bits_per_word,
         fp = fopen("conftest.wordbits", "w");
         if (fp == NULL)
             exit(1);
-        fprintf(fp, "%d\n", CHAR_BIT * sizeof(void *));
+        fprintf(fp, "%d", CHAR_BIT * sizeof(void *));
 
         exit(0);
     }],
-- 
2.1.4




More information about the reviews mailing list