[m-rev.] for review: Reformat configure.ac

Peter Wang novalazy at gmail.com
Mon Mar 5 17:12:09 AEDT 2018


diff -b

configure.ac:
    Reformat some calls to autoconf macros for readability.
---
 configure.ac | 469 +++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 292 insertions(+), 177 deletions(-)

diff --git a/configure.ac b/configure.ac
index 45cc6b334..0780a166b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,6 +2,7 @@
 # vim: ts=4 sw=4 expandtab
 #-----------------------------------------------------------------------------#
 # Copyright (C) 1995-2012 The University of Melbourne.
+# Copyright (C) 2013-2018 The Mercury team.
 # This file may only be copied under the terms of the GNU General
 # Public Licence - see the file COPYING in the Mercury distribution.
 #-----------------------------------------------------------------------------#
@@ -1067,12 +1068,14 @@ AC_PROG_CPP
 AC_PROG_EGREP
 AC_MSG_CHECKING([for use of a Microsoft C compiler])
 AC_EGREP_CPP([yes],
-[
-#ifdef _MSC_VER
+    [
+        #ifdef _MSC_VER
             yes
-#endif
-],
-[ac_microsoft=yes], [ac_microsoft=no])
+        #endif
+    ],
+    [ac_microsoft=yes],
+    [ac_microsoft=no]
+)
 
 if test "$ac_microsoft" = "yes"
 then
@@ -1337,9 +1340,10 @@ mercury_check_for_stdio_functions () {
     do
         mercury_cv_stdio_func_define="MR_HAVE_`echo $mercury_cv_stdio_func | \
             tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`"
-        AC_CHECK_DECL($mercury_cv_stdio_func, [
-            AC_DEFINE_UNQUOTED($mercury_cv_stdio_func_define)
-        ], [], [#include <stdio.h>])
+        AC_CHECK_DECL($mercury_cv_stdio_func,
+            [AC_DEFINE_UNQUOTED($mercury_cv_stdio_func_define)],
+            [],
+            [#include <stdio.h>])
     done
 }
 
@@ -1419,8 +1423,8 @@ MERCURY_CHECK_FOR_FENV_FUNC([fesetround], [$MATH_LIB])
 if test "$ac_cv_func_sigaction" = yes; then
     AC_MSG_CHECKING(for \`sigaction' field name)
     AC_CACHE_VAL(mercury_cv_sigaction_field,
-    AC_TRY_RUN([
-
+    AC_TRY_RUN(
+        [
             #include <signal.h>
             #include <stdlib.h>
 
@@ -1451,7 +1455,8 @@ if test "$ac_cv_func_sigaction" = yes; then
                 } else {
                     exit(1);
                 }
-    }],
+            }
+        ],
         [mercury_cv_sigaction_field=sa_sigaction],
         [mercury_cv_sigaction_field=sa_handler],
         [mercury_cv_sigaction_field=sa_handler]))
@@ -1469,38 +1474,40 @@ fi
 
 AC_MSG_CHECKING(for working \`sigcontext_struct' in second arg)
 AC_CACHE_VAL(mercury_cv_sigcontext_struct_2arg,
-mercury_cv_sigcontext_struct_2arg=no
-AC_TRY_RUN([
-/* see runtime/mercury_signal.h for documentation of this code */
+    mercury_cv_sigcontext_struct_2arg=no
 
-#define sigcontext_struct sigcontext
+    AC_TRY_RUN(
+        [
+            /* see runtime/mercury_signal.h for documentation of this code */
 
-#define __KERNEL__
-#include <signal.h>
-#undef __KERNEL__
+            #define sigcontext_struct sigcontext
 
-#ifdef MR_HAVE_ASM_SIGCONTEXT_H
-#include <asm/sigcontext.h>
-#endif
+            #define __KERNEL__
+            #include <signal.h>
+            #undef __KERNEL__
 
-#include "mercury_faultaddr.h"
+            #ifdef MR_HAVE_ASM_SIGCONTEXT_H
+            #include <asm/sigcontext.h>
+            #endif
+
+            #include "mercury_faultaddr.h"
 
-#include <stdio.h>
+            #include <stdio.h>
 
-extern void handler(int signum, struct sigcontext_struct info);
+            extern void handler(int signum, struct sigcontext_struct info);
 
-#define FAULT_ADDRESS ((int *)112)
+            #define FAULT_ADDRESS ((int *)112)
 
-int main() {
+            int main() {
                 signal(SIGSEGV, (void (*)(int))handler);
 
                 /* provoke a SIGSEGV */
                 (*FAULT_ADDRESS)++;
 
                 exit(1);
-}
+            }
 
-void handler(int signum, struct sigcontext_struct context) {
+            void handler(int signum, struct sigcontext_struct context) {
                 int *addr;
                 addr = (int *) MR_GET_FAULT_ADDR(context);
                 if (signum == SIGSEGV && addr == FAULT_ADDRESS) {
@@ -1508,7 +1515,11 @@ void handler(int signum, struct sigcontext_struct context) {
                 } else {
                     exit(1);
                 }
-}], [mercury_cv_sigcontext_struct_2arg=yes], [true], [true]))
+            }
+        ],
+        [mercury_cv_sigcontext_struct_2arg=yes],
+        [true],
+        [true]))
 AC_MSG_RESULT($mercury_cv_sigcontext_struct_2arg)
 
 if test "$mercury_cv_sigcontext_struct_2arg" = no; then
@@ -1518,7 +1529,8 @@ if test "$mercury_cv_sigcontext_struct_2arg" = no; then
     AC_CACHE_VAL(mercury_cv_sigcontext_struct_3arg,
     mercury_cv_sigcontext_struct_3arg=no
 
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             /* see runtime/mercury_signal.h for documentation of this code */
 
             #define sigcontext_struct sigcontext
@@ -1557,7 +1569,11 @@ if test "$mercury_cv_sigcontext_struct_2arg" = no; then
                 } else {
                     exit(1);
                 }
-    }], [mercury_cv_sigcontext_struct_3arg=yes], [true], [true]))
+            }
+        ],
+        [mercury_cv_sigcontext_struct_3arg=yes],
+        [true],
+        [true]))
     AC_MSG_RESULT($mercury_cv_sigcontext_struct_3arg)
 else
     mercury_cv_sigcontext_struct_3arg=no
@@ -1583,7 +1599,8 @@ if test "$mercury_cv_sigcontext_struct" = yes; then
     AC_MSG_CHECKING(for \`sigcontext_struct' pc access at signals)
     AC_CACHE_VAL(mercury_cv_pc_access,
     mercury_cv_pc_access=no
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             /* see runtime/mercury_signal.h for documentation of this code */
 
             #define sigcontext_struct sigcontext
@@ -1632,7 +1649,11 @@ if test "$mercury_cv_sigcontext_struct" = yes; then
                 } else {
                     exit(1);
                 }
-    }], [mercury_cv_pc_access=eip], [true], [true]))
+            }
+        ],
+        [mercury_cv_pc_access=eip],
+        [true],
+        [true]))
     AC_MSG_RESULT($mercury_cv_pc_access)
     if test "$mercury_cv_pc_access" != no; then
         AC_DEFINE_UNQUOTED(MR_PC_ACCESS,$mercury_cv_pc_access)
@@ -1641,7 +1662,8 @@ else
     AC_MSG_CHECKING(for \`siginfo_t')
     AC_CACHE_VAL(mercury_cv_siginfo_t,
     mercury_cv_siginfo_t=no
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <stdio.h>
             #include <signal.h>
             #ifdef MR_HAVE_SYS_SIGINFO_H
@@ -1677,7 +1699,11 @@ else
             void handler(int signum, siginfo_t *info, void *context) {
                 save_signum = signum;
                 save_cause = info->si_code;
-    }], [mercury_cv_siginfo_t=yes], [true], [true]))
+            }
+        ],
+        [mercury_cv_siginfo_t=yes],
+        [true],
+        [true]))
     AC_MSG_RESULT($mercury_cv_siginfo_t)
     if test "$mercury_cv_siginfo_t" = yes; then
         AC_DEFINE(MR_HAVE_SIGINFO_T)
@@ -1686,7 +1712,8 @@ else
         AC_MSG_CHECKING(for \`siginfo' pc access at signals)
         AC_CACHE_VAL(mercury_cv_pc_access,
         mercury_cv_pc_access=no
-        AC_TRY_RUN([
+        AC_TRY_RUN(
+            [
                 #include <stdio.h>
                 #include <signal.h>
                 #include <sys/siginfo.h>
@@ -1720,9 +1747,13 @@ else
                        are autoconf quote characters */
                     save_pc = *(((ucontext_t *) context)->uc_mcontext.gregs
                             + REG_PC);
-        }], [mercury_cv_pc_access=REG_PC;mercury_cv_pc_access_greg=yes],
-            [true], [true])
-        AC_TRY_RUN([
+                }
+            ],
+            [mercury_cv_pc_access=REG_PC;mercury_cv_pc_access_greg=yes],
+            [true],
+            [true])
+        AC_TRY_RUN(
+            [
                 #include <stdio.h>
                 #include <signal.h>
                 #include <sys/siginfo.h>
@@ -1754,9 +1785,13 @@ else
                     save_cause = info->si_code;
                     save_pc = *(((ucontext_t *) context)->uc_mcontext.gregs
                             + CTX_EPC);
-        }], [mercury_cv_pc_access=CTX_EPC;mercury_cv_pc_access_greg=yes],
-            [true], [true])
-        AC_TRY_RUN([
+                }
+            ],
+            [mercury_cv_pc_access=CTX_EPC;mercury_cv_pc_access_greg=yes],
+            [true],
+            [true])
+        AC_TRY_RUN(
+            [
                 #include <stdio.h>
                 #include <signal.h>
                 #include <sys/siginfo.h>
@@ -1787,8 +1822,11 @@ else
                     save_signum = signum;
                     save_cause = info->si_code;
                     save_pc = ((ucontext_t *) context)->uc_mcontext.sc_pc;
-        }], [mercury_cv_pc_access=sc_pc;mercury_cv_pc_access_greg=no],
-            [true], [true])
+                }
+            ],
+            [mercury_cv_pc_access=sc_pc;mercury_cv_pc_access_greg=no],
+            [true],
+            [true])
         )
         AC_MSG_RESULT($mercury_cv_pc_access)
         if test "$mercury_cv_pc_access" != no; then
@@ -1803,7 +1841,8 @@ fi
 
 AC_MSG_CHECKING(for an integer type with the same size as a pointer)
 AC_CACHE_VAL(mercury_cv_word_type,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <stdio.h>
             int main() {
                 FILE *fp;
@@ -1813,8 +1852,8 @@ AC_CACHE_VAL(mercury_cv_word_type,
                     exit(1);
 
                 /*
-        ** Note that we do not output newline characters as these programs
-        ** might write out a CRLF pair and a shell that does not recognize
+                ** We do not output newline characters as these programs might
+                ** write out a CRLF pair and a shell that does not recognize
                 ** this will interpret the CR as part of the type name.
                 */
                 if (sizeof(int) == sizeof(void *))
@@ -1831,13 +1870,15 @@ AC_CACHE_VAL(mercury_cv_word_type,
 
                 fprintf(fp, "unknown");
                 exit(1);
-    }],
+            }
+        ],
         [mercury_cv_word_type=`cat conftest.tags`],
         [mercury_cv_word_type=unknown],
         [mercury_cv_word_type=unknown])
 )
 if test "$mercury_cv_word_type" = unknown; then
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <stdio.h>
             #include <stdlib.h>
             int main() {
@@ -1855,7 +1896,8 @@ if test "$mercury_cv_word_type" = unknown; then
 
                 fprintf(fp, "unknown");
                 exit(1);
-    }],
+            }
+        ],
         [mercury_cv_word_type=`cat conftest.tags`],
         [mercury_cv_word_type=unknown],
         [mercury_cv_word_type=unknown])
@@ -1890,7 +1932,8 @@ AC_SUBST(MR_ROBDD_int_max)
 
 AC_MSG_CHECKING(for an integer type of at least 64 bits)
 AC_CACHE_VAL(mercury_cv_int_least64_type,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <stdio.h>
             #include <limits.h>
             int main() {
@@ -1901,8 +1944,8 @@ AC_CACHE_VAL(mercury_cv_int_least64_type,
                     exit(1);
 
                 /*
-        ** Note that we do not output newline characters as these programs
-        ** might write out a CRLF pair and a shell that does not recognize
+                ** We do not output newline characters as these programs might
+                ** write out a CRLF pair and a shell that does not recognize
                 ** this will interpret the CR as part of the type name.
                 */
                 if (sizeof(int) * CHAR_BIT >= 64)
@@ -1928,13 +1971,15 @@ AC_CACHE_VAL(mercury_cv_int_least64_type,
 
                 fprintf(fp, "unknown");
                 exit(1);
-    }],
+            }
+        ],
         [mercury_cv_int_least64_type=`cat conftest.tags`],
         [mercury_cv_int_least64_type=unknown],
         [mercury_cv_int_least64_type=unknown])
 )
 if test "$mercury_cv_int_least64_type" = unknown; then
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <stdio.h>
             #include <limits.h>
             #include <stdlib.h>
@@ -1953,7 +1998,8 @@ if test "$mercury_cv_int_least64_type" = unknown; then
 
                 fprintf(fp, "unknown");
                 exit(1);
-    }],
+            }
+        ],
         [mercury_cv_int_least64_type=`cat conftest.tags`],
         [mercury_cv_int_least64_type=unknown],
         [mercury_cv_int_least64_type=unknown])
@@ -1985,7 +2031,8 @@ fi
 
 AC_MSG_CHECKING(for an integer type of at least 32 bits)
 AC_CACHE_VAL(mercury_cv_int_least32_type,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <stdio.h>
             #include <limits.h>
             #include <stdlib.h>
@@ -1997,8 +2044,8 @@ AC_CACHE_VAL(mercury_cv_int_least32_type,
                     exit(1);
 
                 /*
-        ** Note that we do not output newline characters as these programs
-        ** might write out a CRLF pair and a shell that does not recognize
+                ** We do not output newline characters as these programs might
+                ** write out a CRLF pair and a shell that does not recognize
                 ** this will interpret the CR as part of the type name.
                 */
                 if (sizeof(int) * CHAR_BIT >= 32)
@@ -2015,7 +2062,8 @@ AC_CACHE_VAL(mercury_cv_int_least32_type,
 
                 fprintf(fp, "unknown");
                 exit(1);
-    }],
+            }
+        ],
         [mercury_cv_int_least32_type=`cat conftest.tags`],
         [mercury_cv_int_least32_type=unknown],
         [mercury_cv_int_least32_type=unknown])
@@ -2058,7 +2106,8 @@ esac
 
 AC_MSG_CHECKING(for an integer type of at least 16 bits)
 AC_CACHE_VAL(mercury_cv_int_least16_type,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <stdio.h>
             #include <limits.h>
             #include <stdlib.h>
@@ -2070,8 +2119,8 @@ AC_CACHE_VAL(mercury_cv_int_least16_type,
                     exit(1);
 
                 /*
-        ** Note that we do not output newline characters as these programs
-        ** might write out a CRLF pair and a shell that does not recognize
+                ** We do not output newline characters as these programs might
+                ** write out a CRLF pair and a shell that does not recognize
                 ** this will interpret the CR as part of the type name.
                 */
                 if (sizeof(short) * CHAR_BIT >= 16)
@@ -2088,7 +2137,8 @@ AC_CACHE_VAL(mercury_cv_int_least16_type,
 
                 fprintf(fp, "unknown");
                 exit(1);
-    }],
+            }
+        ],
         [mercury_cv_int_least16_type=`cat conftest.tags`],
         [mercury_cv_int_least16_type=unknown],
         [mercury_cv_int_least16_type=unknown])
@@ -2115,7 +2165,8 @@ AC_SUBST(MR_UINT_LEAST16_MAX)
 
 AC_MSG_CHECKING(the number of low tag bits available)
 AC_CACHE_VAL(mercury_cv_low_tag_bits,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <stdio.h>
             #include <stdlib.h>
             int main() {
@@ -2126,8 +2177,8 @@ AC_CACHE_VAL(mercury_cv_low_tag_bits,
                     exit(1);
 
                 /*
-        ** Note that we do not output newline characters as these programs
-        ** might write out a CRLF pair and a shell that does not recognize
+                ** We do not output newline characters as these programs might
+                ** write out a CRLF pair and a shell that does not recognize
                 ** this will interpret the CR as part of the type name.
                 */
                 if (sizeof(void *) == 4)
@@ -2147,7 +2198,8 @@ AC_CACHE_VAL(mercury_cv_low_tag_bits,
                 }
                 fprintf(fp, "0");
                 exit(1);
-    }],
+            }
+        ],
         [mercury_cv_low_tag_bits=`cat conftest.tags`],
         [mercury_cv_low_tag_bits=0],
         [mercury_cv_low_tag_bits=0])
@@ -2168,7 +2220,8 @@ AC_SUBST(LOW_TAG_BITS)
 
 AC_MSG_CHECKING(the number of bytes per word)
 AC_CACHE_VAL(mercury_cv_bytes_per_word,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <stdio.h>
             #include <stdlib.h>
             int main() {
@@ -2180,7 +2233,8 @@ AC_CACHE_VAL(mercury_cv_bytes_per_word,
                 fprintf(fp, "%d", sizeof(void *));
 
                 exit(0);
-    }],
+            }
+        ],
         [mercury_cv_bytes_per_word=`cat conftest.wordbytes`],
         [mercury_cv_bytes_per_word=0],
         [mercury_cv_bytes_per_word=0])
@@ -2195,7 +2249,8 @@ AC_SUBST(BYTES_PER_WORD)
 
 AC_MSG_CHECKING(the number of bits per word)
 AC_CACHE_VAL(mercury_cv_bits_per_word,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <stdio.h>
             #include <stdlib.h>
             #include <limits.h>
@@ -2208,7 +2263,8 @@ AC_CACHE_VAL(mercury_cv_bits_per_word,
                 fprintf(fp, "%d", CHAR_BIT * sizeof(void *));
 
                 exit(0);
-    }],
+            }
+        ],
         [mercury_cv_bits_per_word=`cat conftest.wordbits`],
         [mercury_cv_bits_per_word=0],
         [mercury_cv_bits_per_word=0])
@@ -2242,13 +2298,15 @@ AC_SUBST(MR_ROBDD_LOG_BITS_PER_WORD)
 
 AC_MSG_CHECKING(whether we can use unboxed floats)
 AC_CACHE_VAL(mercury_cv_unboxed_floats,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             int main() {
                 if (sizeof(double) == sizeof(void *))
                     exit(0);
                 else
                     exit(1);
-    }],
+            }
+        ],
         [mercury_cv_unboxed_floats=yes],
         [mercury_cv_unboxed_floats=no],
         [mercury_cv_unboxed_floats=no])
@@ -2266,14 +2324,16 @@ AC_SUBST(HAVE_BOXED_FLOATS)
 
 AC_MSG_CHECKING(whether float is 64-bit)
 AC_CACHE_VAL(mercury_cv_float_is_64_bit,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <limits.h>
             int main() {
                 if (sizeof(float) * CHAR_BIT == 64)
                     exit(0);
                 else
                     exit(1);
-    }],
+            }
+        ],
         [mercury_cv_float_is_64_bit=yes],
         [mercury_cv_float_is_64_bit=no],
         [mercury_cv_float_is_64_bit=no])
@@ -2288,14 +2348,16 @@ AC_SUBST(MR_FLOAT_IS_64_BIT)
 
 AC_MSG_CHECKING(whether double is 64-bit)
 AC_CACHE_VAL(mercury_cv_double_is_64_bit,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <limits.h>
             int main() {
                 if (sizeof(double) * CHAR_BIT == 64)
                     exit(0);
                 else
                     exit(1);
-    }],
+            }
+        ],
         [mercury_cv_double_is_64_bit=yes],
         [mercury_cv_double_is_64_bit=no],
         [mercury_cv_double_is_64_bit=no])
@@ -2310,14 +2372,16 @@ AC_SUBST(MR_DOUBLE_IS_64_BIT)
 
 AC_MSG_CHECKING(whether long double is 64-bit)
 AC_CACHE_VAL(mercury_cv_long_double_is_64_bit,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <limits.h>
             int main() {
                 if (sizeof(long double) * CHAR_BIT == 64)
                     exit(0);
                 else
                     exit(1);
-    }],
+            }
+        ],
         [mercury_cv_long_double_is_64_bit=yes],
         [mercury_cv_long_double_is_64_bit=no],
         [mercury_cv_long_double_is_64_bit=no])
@@ -2332,14 +2396,16 @@ AC_SUBST(MR_LONG_DOUBLE_IS_64_BIT)
 
 AC_MSG_CHECKING([whether we can use unboxed 64-bit integers])
 AC_CACHE_VAL([mercury_cv_unboxed_int64s],
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <stdint.h>
             int main() {
                 if (sizeof(uint64_t) == sizeof(void *))
                     exit(0);
                 else
                     exit(1);
-        }],
+            }
+        ],
         [mercury_cv_unboxed_int64s=yes],
         [mercury_cv_unboxed_int64s=no],
         [mercury_cv_unboxed_int64s=no])
@@ -2364,7 +2430,8 @@ AC_DEFINE_UNQUOTED(MR_SYNC_TERM_SIZE, $SYNC_TERM_SIZE)
 
 AC_MSG_CHECKING(whether architecture is big-endian)
 AC_CACHE_VAL(mercury_cv_is_bigender,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             int main() {
                 int     x = 1;
                 unsigned char   *x_p;
@@ -2375,7 +2442,8 @@ AC_CACHE_VAL(mercury_cv_is_bigender,
                     exit(0);
                 else
                     exit(1);
-    }],
+            }
+        ],
         [mercury_cv_is_bigender=yes],
         [mercury_cv_is_bigender=no],
         [mercury_cv_is_bigender=no])
@@ -2390,7 +2458,8 @@ AC_SUBST(MR_BIG_ENDIAN)
 
 AC_MSG_CHECKING(whether architecture is little-endian)
 AC_CACHE_VAL(mercury_cv_is_littleender,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             int main() {
                 int     x = 1;
                 unsigned char   *x_p;
@@ -2401,7 +2470,8 @@ AC_CACHE_VAL(mercury_cv_is_littleender,
                     exit(0);
                 else
                     exit(1);
-    }],
+            }
+        ],
         [mercury_cv_is_littleender=yes],
         [mercury_cv_is_littleender=no],
         [mercury_cv_is_littleender=no])
@@ -2416,7 +2486,8 @@ AC_SUBST(MR_LITTLE_ENDIAN)
 
 AC_MSG_CHECKING(whether we can use files as locks)
 AC_CACHE_VAL(mercury_cv_have_ocreat_oexcl,
-    AC_TRY_COMPILE([
+    AC_TRY_COMPILE(
+        [
             #ifdef MR_HAVE_SYS_TYPES_H
             #include <sys/types.h>
             #endif
@@ -2431,10 +2502,7 @@ AC_CACHE_VAL(mercury_cv_have_ocreat_oexcl,
             #if defined(O_CREAT) && defined(O_EXCL)
 
             #else
-    /*
-    ** As these macros are not defined the compilation must fail.
-    ** Unmatched brackets should do that for us.
-    */
+                /* Deliberate syntax error. */
                 }
             #endif
         ],
@@ -2450,7 +2518,8 @@ fi
 
 AC_MSG_CHECKING(return values of system)
 AC_CACHE_VAL(mercury_cv_normal_system_retval,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <stdlib.h>
             #ifdef MR_HAVE_SYS_WAIT_H
             #include <sys/wait.h>
@@ -2472,7 +2541,7 @@ AC_CACHE_VAL(mercury_cv_normal_system_retval,
                 ** status, and the low 8 bits give the signal number which
                 ** killed the process.
                 */
-            if( system("exit 0") == 0 &&
+                    if (system("exit 0") == 0 &&
                             system("exit 42") == 42 << 8 ) {
                             /* && system("kill -9 $$") == 9 */
                         exit(0);
@@ -2480,23 +2549,26 @@ AC_CACHE_VAL(mercury_cv_normal_system_retval,
                         exit(1);
                     }
                 #endif
-    }],
+            }
+        ],
         [mercury_cv_normal_system_retval=yes],
         [mercury_cv_normal_system_retval=no],
-    AC_TRY_COMPILE([#include <sys/wait.h>], [
+        AC_TRY_COMPILE(
+            [
+                #include <sys/wait.h>
+            ],
+            [
                 #if defined (WIFEXITED) && defined (WEXITSTATUS) && \
                     defined (WIFSIGNALED) && defined (WTERMSIG)
 
                 #else
-    /*
-    ** As these macros are not defined the compilation must fail.
-    ** Unmatched brackets should do that for us.
-    */
+                    /* Deliberate syntax error. */
                     }
                 #endif
             ],
             [mercury_cv_normal_system_retval=yes],
-    [mercury_cv_normal_system_retval=no]))
+            [mercury_cv_normal_system_retval=no])
+    )
 )
 AC_MSG_RESULT($mercury_cv_normal_system_retval)
 if test "$mercury_cv_normal_system_retval" = no; then
@@ -2508,7 +2580,8 @@ fi
 
 AC_MSG_CHECKING(to see if we can handle contexts blocking on IO)
 AC_CACHE_VAL(mercury_cv_can_do_pending_io,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #include <sys/types.h>
             #include <sys/time.h>
             int main() {
@@ -2521,7 +2594,8 @@ AC_CACHE_VAL(mercury_cv_can_do_pending_io,
                 zero.tv_usec = 0;
                 err = select(1, &f, &f, &f, &zero);
                 exit(err != 0);
-    }],
+            }
+        ],
         [mercury_cv_can_do_pending_io=yes],
         [mercury_cv_can_do_pending_io=no],
         [mercury_cv_can_do_pending_io=no])
@@ -2795,7 +2869,8 @@ if test "$LIBRARY_PATH_FOR_GOTOS" != ""; then
 fi
 
 AC_CACHE_VAL(mercury_cv_gcc_labels,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             extern void     exit(int);
             void            *entry_foo_1;
             void            *entry_bar_1;
@@ -2840,7 +2915,9 @@ AC_CACHE_VAL(mercury_cv_gcc_labels,
             void *dummy_identity_function(void *p) {
                 return p;
             }
-    ], [mercury_cv_gcc_labels=yes], [mercury_cv_gcc_labels=no],
+        ],
+        [mercury_cv_gcc_labels=yes],
+        [mercury_cv_gcc_labels=no],
         [mercury_cv_gcc_labels=no])
 )
 AC_MSG_RESULT($mercury_cv_gcc_labels)
@@ -2852,9 +2929,11 @@ if test "$mercury_cv_gcc_labels" = yes; then
     AC_MSG_CHECKING(whether we can use asm labels)
 
     AC_CACHE_VAL(mercury_cv_asm_labels,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             void *volatile volatile_global_pointer;
-    extern void mercury__label1 (void) __asm__("entry_" "mercury__label1" );
+            extern void mercury__label1 (void)
+                __asm__("entry_" "mercury__label1" );
             main() {
                 void *addr;
 
@@ -2868,7 +2947,10 @@ if test "$mercury_cv_gcc_labels" = yes; then
                     "mercury__label1" ":\n"
                     "/* this is a comment */");
                 exit(0);
-    }], [mercury_cv_asm_labels=yes], [mercury_cv_asm_labels=no],
+            }
+        ],
+        [mercury_cv_asm_labels=yes],
+        [mercury_cv_asm_labels=no],
         [mercury_cv_asm_labels=no])
     )
     AC_MSG_RESULT($mercury_cv_asm_labels)
@@ -2910,7 +2992,8 @@ if test $mercury_cv_gcc_labels = yes || test $mercury_cv_asm_labels = yes; then
     fi
 
     AC_CACHE_VAL(mercury_cv_gcc_model_fast,
-    AC_TRY_RUN([
+    AC_TRY_RUN(
+        [
             #define MR_USE_GCC_NONLOCAL_GOTOS
             #define MR_USE_GCC_GLOBAL_REGISTERS
             #include "mercury_engine.h"
@@ -2923,7 +3006,10 @@ if test $mercury_cv_gcc_labels = yes || test $mercury_cv_asm_labels = yes; then
                 if (MR_mr0 + MR_mr7 != 42)
                     exit(1);
                 exit(0);
-    }], [mercury_cv_gcc_model_fast=yes], [mercury_cv_gcc_model_fast=no],
+            }
+        ],
+        [mercury_cv_gcc_model_fast=yes],
+        [mercury_cv_gcc_model_fast=no],
         [mercury_cv_gcc_model_fast=no])
     )
     AC_MSG_RESULT($mercury_cv_gcc_model_fast)
@@ -2944,19 +3030,23 @@ save_CC="$CC"
 CC="$CC $CFLAGS_FOR_REGS"
 
 AC_CACHE_VAL(mercury_cv_gcc_model_reg,
-AC_TRY_RUN([
-#define MR_USE_GCC_GLOBAL_REGISTERS
-#include "mercury_engine.h"
-changequote(<<,>>)
-MercuryEngine MR_engine_base;
-changequote([,])
-main() {
+AC_TRY_RUN(
+    [
+        #define MR_USE_GCC_GLOBAL_REGISTERS
+        #include "mercury_engine.h"
+        changequote(<<,>>)
+        MercuryEngine MR_engine_base;
+        changequote([,])
+        main() {
             MR_mr0 = 20;
             MR_mr7 = 22;
             if (MR_mr0 + MR_mr7 != 42)
                 exit(1);
             exit(0);
-}], [mercury_cv_gcc_model_reg=yes], [mercury_cv_gcc_model_reg=no],
+        }
+    ],
+    [mercury_cv_gcc_model_reg=yes],
+    [mercury_cv_gcc_model_reg=no],
     [mercury_cv_gcc_model_reg=no])
 )
 AC_MSG_RESULT($mercury_cv_gcc_model_reg)
@@ -2968,41 +3058,46 @@ CC="$save_CC"
 
 AC_MSG_CHECKING(whether we can support time profiling on this system)
 AC_CACHE_VAL(mercury_cv_profiling,
-AC_TRY_CPP([
-/* The following code comes from runtime/mercury_timing.h */
-#include    <errno.h>
-#include    <limits.h>
-#include    <string.h>
-#include    <signal.h>
-
-#ifdef MR_HAVE_SYS_PARAM_H
-#include    <sys/param.h>
-#endif
-
-#ifdef MR_HAVE_UNISTD_H
+AC_TRY_CPP(
+    [
+        /* The following code comes from runtime/mercury_timing.h */
+        #include    <errno.h>
+        #include    <limits.h>
+        #include    <string.h>
+        #include    <signal.h>
+
+        #ifdef MR_HAVE_SYS_PARAM_H
+        #include    <sys/param.h>
+        #endif
+
+        #ifdef MR_HAVE_UNISTD_H
         #include    <unistd.h>
-#endif
+        #endif
 
-#ifdef MR_HAVE_SYS_TIME_H
-#include    <sys/time.h>
-#endif
+        #ifdef MR_HAVE_SYS_TIME_H
+        #include    <sys/time.h>
+        #endif
 
-#ifdef HZ
+        #ifdef HZ
           #define MR_CLOCK_TICKS_PER_SECOND     HZ
-#elif defined(MR_HAVE_SYSCONF) && defined(_SC_CLK_TCK)
+        #elif defined(MR_HAVE_SYSCONF) && defined(_SC_CLK_TCK)
           #define MR_CLOCK_TICKS_PER_SECOND     ((int) sysconf(_SC_CLK_TCK))
-#elif defined(CLOCKS_PER_SEC)
+        #elif defined(CLOCKS_PER_SEC)
           #define MR_CLOCK_TICKS_PER_SECOND     CLOCKS_PER_SEC
-#elif defined(CLK_TCK)
+        #elif defined(CLK_TCK)
           #define MR_CLOCK_TICKS_PER_SECOND     CLK_TCK
-#else
+        #else
           /* just leave it undefined */
-#endif
+        #endif
 
-#if !defined(MR_CLOCK_TICKS_PER_SECOND) || !defined(SIGPROF) || !defined(MR_HAVE_SETITIMER)
-#error "Time profiling not supported on this system"
-#endif
-], [mercury_cv_profiling=yes], [mercury_cv_profiling=no]))
+        #if !defined(MR_CLOCK_TICKS_PER_SECOND) || \
+            !defined(SIGPROF) || \
+            !defined(MR_HAVE_SETITIMER)
+        #error "Time profiling not supported on this system"
+        #endif
+    ],
+    [mercury_cv_profiling=yes],
+    [mercury_cv_profiling=no]))
 AC_MSG_RESULT($mercury_cv_profiling)
 
 #-----------------------------------------------------------------------------#
@@ -3326,9 +3421,9 @@ LIBS="$save_LIBS"
 
 AC_MSG_CHECKING(whether we can use thread-local storage class extension)
 AC_CACHE_VAL(mercury_cv_thread_local_storage,
-    AC_TRY_COMPILE([],[
-        static __thread int thread_local_variable;
-    ],
+    AC_TRY_COMPILE(
+        [],
+        [static __thread int thread_local_variable;],
         [mercury_cv_thread_local_storage=yes],
         [mercury_cv_thread_local_storage=no])
 )
@@ -4269,34 +4364,38 @@ AC_SUBST(AS)
 
 AC_MSG_CHECKING(whether structure assignment conflicts with global registers)
 AC_CACHE_VAL(mercury_cv_cannot_use_structure_assignment,
-AC_TRY_RUN([
-changequote(<<,>>)
+AC_TRY_RUN(
+    [
+        changequote(<<,>>)
 
-/* MR_USE_GCC_GLOBAL_REGISTERS are essential to the purpose of the test. */
-/* We define MR_USE_GCC_NONLOCAL_GOTOS because some platforms (e.g. SPARCs) */
-/* cannot have MR_USE_GCC_GLOBAL_REGISTERS without it. */
-#define MR_USE_GCC_GLOBAL_REGISTERS
-#define MR_USE_GCC_NONLOCAL_GOTOS
-#include "mercury_imp.h"
-#include "mercury_trace_spy.h"
+        /* MR_USE_GCC_GLOBAL_REGISTERS are essential to the purpose of the test. */
+        /* We define MR_USE_GCC_NONLOCAL_GOTOS because some platforms */
+        /* (e.g. SPARCs) cannot have MR_USE_GCC_GLOBAL_REGISTERS without it. */
+        #define MR_USE_GCC_GLOBAL_REGISTERS
+        #define MR_USE_GCC_NONLOCAL_GOTOS
+        #include "mercury_imp.h"
+        #include "mercury_trace_spy.h"
 
-MR_Spy_Point    spied_procs[2];
+        MR_Spy_Point    spied_procs[2];
 
-int main() {
+        int main() {
             spied_procs[1] = spied_procs[0];
-#if __GNUC__ >= 3
+        #if __GNUC__ >= 3
             /* gcc 3.1 seems to have problems with structure assignment
                and global registers, but which this simple test case
                does not trigger. So just force the test to fail for gcc 3.x. */
             exit(1);
-#else
+        #else
             exit(0);
-#endif
-changequote([,])
-}],
-[mercury_cv_cannot_use_structure_assignment=no],
-[mercury_cv_cannot_use_structure_assignment=yes],
-[mercury_cv_cannot_use_structure_assignment=yes]))
+        #endif
+        }
+
+        changequote([,])
+    ],
+    [mercury_cv_cannot_use_structure_assignment=no],
+    [mercury_cv_cannot_use_structure_assignment=yes],
+    [mercury_cv_cannot_use_structure_assignment=yes])
+)
 AC_MSG_RESULT($mercury_cv_cannot_use_structure_assignment)
 if test $mercury_cv_cannot_use_structure_assignment = "yes"; then
     AC_DEFINE(MR_CANNOT_USE_STRUCTURE_ASSIGNMENT)
@@ -4892,10 +4991,12 @@ AC_SUBST_FILE(CONFIGURE_HELP)
 
 AC_MSG_CHECKING(for struct tms and times function)
 AC_CACHE_VAL(mercury_cv_have_posix_times,
-AC_TRY_LINK([
+    AC_TRY_LINK(
+        [
             #include <sys/types.h>
             #include <sys/times.h>
-],[
+        ],
+        [
             struct tms t;
             long Ut, St, CUt, CSt;
             long Ret;
@@ -4906,7 +5007,9 @@ AC_TRY_LINK([
             St = (long) t.tms_stime;
             CUt = (long) t.tms_cutime;
             CSt = (long) t.tms_cstime;
-],[mercury_cv_have_posix_times=yes],[mercury_cv_have_posix_times=no]))
+        ],
+        [mercury_cv_have_posix_times=yes],
+        [mercury_cv_have_posix_times=no]))
 
 # Figure out whether the test succeeded.
 if test "$mercury_cv_have_posix_times" = yes; then
@@ -4923,13 +5026,17 @@ fi
 
 AC_MSG_CHECKING(for environ global variable)
 AC_CACHE_VAL(mercury_cv_have_environ,
-AC_TRY_LINK([
+AC_TRY_LINK(
+    [
         #include <unistd.h>
 
         extern char **environ;
-],[
+    ],
+    [
         environ
-],[mercury_cv_have_environ=yes],[mercury_cv_have_environ=no]))
+    ],
+    [mercury_cv_have_environ=yes],
+    [mercury_cv_have_environ=no]))
 
 # Figure out whether the test succeeded.
 if test "$mercury_cv_have_environ" = yes; then
@@ -4946,11 +5053,15 @@ fi
 
 AC_MSG_CHECKING(for Sleep function)
 AC_CACHE_VAL(mercury_cv_have_capital_s_sleep,
-AC_TRY_LINK([
+AC_TRY_LINK(
+    [
         #include <windows.h>
-],[
+    ],
+    [
         Sleep(1);
-],[mercury_cv_have_capital_s_sleep=yes],[mercury_cv_have_capital_s_sleep=no]))
+    ],
+    [mercury_cv_have_capital_s_sleep=yes],
+    [mercury_cv_have_capital_s_sleep=no]))
 
 if test "$mercury_cv_have_capital_s_sleep" = yes; then
     AC_MSG_RESULT(yes)
@@ -4997,7 +5108,8 @@ LIBS="$LIBS $SOCKET_LIBRARY $NSL_LIBRARY"
 #
 AC_MSG_CHECKING(whether we can use sockets (for Morphine))
 AC_CACHE_VAL(mercury_cv_sockets_work,
-AC_TRY_LINK([
+AC_TRY_LINK(
+    [
         changequote(<<,>>)
         /*
         ** The following code was copied from
@@ -5025,7 +5137,8 @@ AC_TRY_LINK([
             fprintf(stderr, "", s);
             exit(1);
         }
-],[
+    ],
+    [
         /* this is the body of the test function */
         {
             int fd;
@@ -5125,7 +5238,9 @@ AC_TRY_LINK([
             file_out = fdopen(fd, "w");
         }
         changequote([,])
-],[mercury_cv_sockets_work=yes],[mercury_cv_sockets_work=no]))
+    ],
+    [mercury_cv_sockets_work=yes],
+    [mercury_cv_sockets_work=no]))
 
 #
 # figure out whether the test succeeded
-- 
2.16.2



More information about the reviews mailing list