bug-gnulib
[Top][All Lists]
Advanced

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

Some small autoconf macro improvements


From: Bruno Haible
Subject: Some small autoconf macro improvements
Date: Sun, 26 Jul 2020 01:51:42 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-179-generic; KDE/5.18.0; x86_64; ; )

This patch makes more consistent use of AC_CACHE_CHECK.


2020-07-25  Bruno Haible  <bruno@clisp.org>

        Small autoconf macro improvements.
        * m4/mktime.m4 (gl_FUNC_MKTIME_WORKS): Make it possible for the user to
        override the value of gl_cv_func_working_mktime.
        * m4/multiarch.m4 (gl_MULTIARCH): Show a line "checking whether the
        compiler produces multi-arch binaries..." in the configure output.
        * m4/size_max.m4 (gl_SIZE_MAX): When not found, say "no".
        * m4/parse-datetime.m4 (gl_C_COMPOUND_LITERALS): Improve indentation.

(diff -w)

diff --git a/m4/mktime.m4 b/m4/mktime.m4
index c00843f..8d9b827 100644
--- a/m4/mktime.m4
+++ b/m4/mktime.m4
@@ -1,4 +1,4 @@
-# serial 31
+# serial 32
 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2020 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -33,14 +33,14 @@ AC_DEFUN([gl_FUNC_MKTIME_WORKS],
   AC_CHECK_DECLS_ONCE([alarm])
   AC_CHECK_FUNCS_ONCE([tzset])
   AC_REQUIRE([gl_MULTIARCH])
-  if test $APPLE_UNIVERSAL_BUILD = 1; then
+  AC_CACHE_CHECK([for working mktime], [gl_cv_func_working_mktime],
+    [if test $APPLE_UNIVERSAL_BUILD = 1; then
        # A universal build on Apple Mac OS X platforms.
        # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode.
        # But we need a configuration result that is valid in both modes.
-    gl_cv_func_working_mktime=no
-  fi
-  AC_CACHE_CHECK([for working mktime], [gl_cv_func_working_mktime],
-    [AC_RUN_IFELSE(
+       gl_cv_func_working_mktime="guessing no"
+     else
+       AC_RUN_IFELSE(
          [AC_LANG_SOURCE(
 [[/* Test program from Paul Eggert and Tony Leneis.  */
 #include <limits.h>
@@ -250,6 +250,7 @@ main ()
             *)      gl_cv_func_working_mktime="$gl_cross_guess_normal" ;;
           esac
          ])
+     fi
     ])
 ])
 
diff --git a/m4/multiarch.m4 b/m4/multiarch.m4
index 3c2034c..69b43df 100644
--- a/m4/multiarch.m4
+++ b/m4/multiarch.m4
@@ -1,4 +1,4 @@
-# multiarch.m4 serial 7
+# multiarch.m4 serial 8
 dnl Copyright (C) 2008-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -21,7 +21,9 @@ dnl with or without modifications, as long as this notice is 
preserved.
 AC_DEFUN_ONCE([gl_MULTIARCH],
 [
   dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN.
-  gl_cv_c_multiarch=no
+  AC_CACHE_CHECK([whether the compiler produces multi-arch binaries],
+    [gl_cv_c_multiarch],
+    [gl_cv_c_multiarch=no
      AC_COMPILE_IFELSE(
        [AC_LANG_SOURCE(
          [[#ifndef __APPLE_CC__
@@ -53,6 +55,7 @@ AC_DEFUN_ONCE([gl_MULTIARCH],
           fi
         done
        ])
+    ])
   if test $gl_cv_c_multiarch = yes; then
     APPLE_UNIVERSAL_BUILD=1
   else
diff --git a/m4/parse-datetime.m4 b/m4/parse-datetime.m4
index 3bb487f..d9fc066 100644
--- a/m4/parse-datetime.m4
+++ b/m4/parse-datetime.m4
@@ -1,4 +1,4 @@
-# parse-datetime.m4 serial 25
+# parse-datetime.m4 serial 26
 dnl Copyright (C) 2002-2006, 2008-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,11 +13,15 @@ dnl static variables (even though gcc supports this in 
pre-C99 mode).
 AC_DEFUN([gl_C_COMPOUND_LITERALS],
 [
   AC_CACHE_CHECK([for compound literals], [gl_cv_compound_literals],
-  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[struct s { int i, j; };]],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[struct s { int i, j; };]],
           [[struct s t = (struct s) { 3, 4 };
-        if (t.i != 0) return 0;]])],
-    gl_cv_compound_literals=yes,
-    gl_cv_compound_literals=no)])
+            if (t.i != 0) return 0;]])
+       ],
+       [gl_cv_compound_literals=yes],
+       [gl_cv_compound_literals=no])
+    ])
   if test $gl_cv_compound_literals = yes; then
     AC_DEFINE([HAVE_COMPOUND_LITERALS], [1],
       [Define if you have compound literals.])
diff --git a/m4/size_max.m4 b/m4/size_max.m4
index 5240d79..6ebb93f 100644
--- a/m4/size_max.m4
+++ b/m4/size_max.m4
@@ -1,4 +1,4 @@
-# size_max.m4 serial 11
+# size_max.m4 serial 12
 dnl Copyright (C) 2003, 2005-2006, 2008-2020 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -13,7 +13,7 @@ AC_DEFUN([gl_SIZE_MAX],
   AC_CHECK_HEADERS([stdint.h])
   dnl First test whether the system already has SIZE_MAX.
   AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [
-    gl_cv_size_max=
+    gl_cv_size_max=no
     AC_EGREP_CPP([Found it], [
 #include <limits.h>
 #if HAVE_STDINT_H
@@ -23,7 +23,7 @@ AC_DEFUN([gl_SIZE_MAX],
 Found it
 #endif
 ], [gl_cv_size_max=yes])
-    if test -z "$gl_cv_size_max"; then
+    if test $gl_cv_size_max != yes; then
       dnl Define it ourselves. Here we assume that the type 'size_t' is not 
wider
       dnl than the type 'unsigned long'. Try hard to find a definition that can
       dnl be used in a preprocessor #if, i.e. doesn't contain a cast.




reply via email to

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