From: Bruno Haible Date: Sat, 25 Jul 2020 23:45:32 +0000 (+0200) Subject: Small autoconf macro improvements. X-Git-Tag: v1.0~3860 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=6f8fd6411e022200c743d8e500fcc0bae91f1d76;p=gnulib.git 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 --git a/ChangeLog b/ChangeLog index 8d8508941a..d81a1d7019 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2020-07-25 Bruno Haible + + 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. + 2020-07-25 Bruno Haible doc: Update for NetBSD 7.1, 8.0, 9.0. diff --git a/m4/mktime.m4 b/m4/mktime.m4 index c00843f0f4..8d9b827fe2 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,15 +33,15 @@ 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 - # 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( - [AC_LANG_SOURCE( + [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="guessing no" + else + AC_RUN_IFELSE( + [AC_LANG_SOURCE( [[/* Test program from Paul Eggert and Tony Leneis. */ #include #include @@ -242,14 +242,15 @@ main () result |= 64; return result; }]])], - [gl_cv_func_working_mktime=yes], - [gl_cv_func_working_mktime=no], - [case "$host_os" in - # Guess no on native Windows. - mingw*) gl_cv_func_working_mktime="guessing no" ;; - *) gl_cv_func_working_mktime="$gl_cross_guess_normal" ;; - esac - ]) + [gl_cv_func_working_mktime=yes], + [gl_cv_func_working_mktime=no], + [case "$host_os" in + # Guess no on native Windows. + mingw*) gl_cv_func_working_mktime="guessing no" ;; + *) gl_cv_func_working_mktime="$gl_cross_guess_normal" ;; + esac + ]) + fi ]) ]) diff --git a/m4/multiarch.m4 b/m4/multiarch.m4 index 3c2034c5e0..69b43df3aa 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,37 +21,40 @@ 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_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [[#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - ]])], - [ - dnl Check for potential -arch flags. It is not universal unless - dnl there are at least two -arch flags with different values. - arch= - prev= - for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do - if test -n "$prev"; then - case $word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$arch" || test "$arch" = "$word"; then - arch="$word" - else - gl_cv_c_multiarch=yes - fi - ;; - esac - prev= - else - if test "x$word" = "x-arch"; then - prev=arch - fi - fi - done + 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__ + not a universal capable compiler + #endif + typedef int dummy; + ]])], + [ + dnl Check for potential -arch flags. It is not universal unless + dnl there are at least two -arch flags with different values. + arch= + prev= + for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do + if test -n "$prev"; then + case $word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$arch" || test "$arch" = "$word"; then + arch="$word" + else + gl_cv_c_multiarch=yes + fi + ;; + esac + prev= + else + if test "x$word" = "x-arch"; then + prev=arch + fi + fi + done + ]) ]) if test $gl_cv_c_multiarch = yes; then APPLE_UNIVERSAL_BUILD=1 diff --git a/m4/parse-datetime.m4 b/m4/parse-datetime.m4 index 3bb487f9be..d9fc06684c 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; };]], - [[struct s t = (struct s) { 3, 4 }; - if (t.i != 0) return 0;]])], - gl_cv_compound_literals=yes, - gl_cv_compound_literals=no)]) + [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 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 5240d799c0..6ebb93f210 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 #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.