patch gnulib to accomodate autoconf 2.70

Upgrading gnulib turned to be too difficult, so this only includes
updates to m4 files necessary to please Autoconf 2.70.

For issue #447.

* m4/extensions.m4, m4/malloc.m4, m4/std-gnu11.m4: Cherry-pick
from today's gnulib version.
This commit is contained in:
Alexandre Duret-Lutz 2021-01-14 15:29:48 +01:00
parent 06b5a82950
commit 094a6fa57e
3 changed files with 117 additions and 80 deletions

View file

@ -1,14 +1,19 @@
# serial 18 -*- Autoconf -*- # serial 22 -*- Autoconf -*-
# Enable extensions on systems that normally disable them. # Enable extensions on systems that normally disable them.
# Copyright (C) 2003, 2006-2020 Free Software Foundation, Inc. # Copyright (C) 2003, 2006-2021 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
dnl Define to empty for the benefit of Autoconf 2.69 and earlier, so that
dnl AC_USE_SYSTEM_EXTENSIONS (below) can be used unchanged from Autoconf 2.70+.
m4_ifndef([AC_CHECK_INCLUDES_DEFAULT],
[AC_DEFUN([AC_CHECK_INCLUDES_DEFAULT], [])])
# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git # This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git
# Autoconf. Perhaps we can remove this once we can assume Autoconf # Autoconf. Perhaps we can remove this once we can assume Autoconf
# 2.70 or later everywhere, but since Autoconf mutates rapidly # is recent-enough everywhere, but since Autoconf mutates rapidly
# enough in this area it's likely we'll need to redefine # enough in this area it's likely we'll need to redefine
# AC_USE_SYSTEM_EXTENSIONS for quite some time. # AC_USE_SYSTEM_EXTENSIONS for quite some time.
@ -26,36 +31,27 @@
# its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS # its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS
# invocation occurs in gl_EARLY, not in gl_INIT. # invocation occurs in gl_EARLY, not in gl_INIT.
m4_version_prereq([2.70.1], [], [
# AC_USE_SYSTEM_EXTENSIONS # AC_USE_SYSTEM_EXTENSIONS
# ------------------------ # ------------------------
# Enable extensions on systems that normally disable them, # Enable extensions on systems that normally disable them,
# typically due to standards-conformance issues. # typically due to standards-conformance issues.
# # We unconditionally define as many of the known feature-enabling
# Remember that #undef in AH_VERBATIM gets replaced with #define by # as possible, reserving conditional behavior for macros that are
# AC_DEFINE. The goal here is to define all known feature-enabling # known to cause problems on some platforms (such as __EXTENSIONS__).
# macros, then, if reports of conflicts are made, disable macros that
# cause problems on some platforms (such as __EXTENSIONS__).
AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS],
[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl [AC_BEFORE([$0], [AC_PREPROC_IFELSE])dnl
AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl
AC_BEFORE([$0], [AC_LINK_IFELSE])dnl
AC_BEFORE([$0], [AC_RUN_IFELSE])dnl AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
AC_BEFORE([$0], [AC_CHECK_INCLUDES_DEFAULT])dnl
AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) dnl #undef in AH_VERBATIM gets replaced with #define by AC_DEFINE.
if test "$MINIX" = yes; then
AC_DEFINE([_POSIX_SOURCE], [1],
[Define to 1 if you need to in order for 'stat' and other
things to work.])
AC_DEFINE([_POSIX_1_SOURCE], [2],
[Define to 2 if the system does not provide POSIX.1 features
except with this defined.])
AC_DEFINE([_MINIX], [1],
[Define to 1 if on MINIX.])
AC_DEFINE([_NETBSD_SOURCE], [1],
[Define to 1 to make NetBSD features available. MINIX 3 needs this.])
fi
dnl Use a different key than __EXTENSIONS__, as that name broke existing dnl Use a different key than __EXTENSIONS__, as that name broke existing
dnl configure.ac when using autoheader 2.62. dnl configure.ac when using autoheader 2.62.
AH_VERBATIM([USE_SYSTEM_EXTENSIONS], dnl The macros below are in alphabetical order ignoring leading _ or __
dnl prefixes.
AH_VERBATIM([USE_SYSTEM_EXTENSIONS],
[/* Enable extensions on AIX 3, Interix. */ [/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE #ifndef _ALL_SOURCE
# undef _ALL_SOURCE # undef _ALL_SOURCE
@ -64,19 +60,44 @@ dnl configure.ac when using autoheader 2.62.
#ifndef _DARWIN_C_SOURCE #ifndef _DARWIN_C_SOURCE
# undef _DARWIN_C_SOURCE # undef _DARWIN_C_SOURCE
#endif #endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Enable GNU extensions on systems that have them. */ /* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
# undef _GNU_SOURCE # undef _GNU_SOURCE
#endif #endif
/* Enable NetBSD extensions on NetBSD. */ /* Enable X/Open compliant socket functions that do not require linking
with -lxnet on HP-UX 11.11. */
#ifndef _HPUX_ALT_XOPEN_SOCKET_API
# undef _HPUX_ALT_XOPEN_SOCKET_API
#endif
/* Identify the host operating system as Minix.
This macro does not affect the system headers' behavior.
A future release of Autoconf may stop defining this macro. */
#ifndef _MINIX
# undef _MINIX
#endif
/* Enable general extensions on NetBSD.
Enable NetBSD compatibility extensions on Minix. */
#ifndef _NETBSD_SOURCE #ifndef _NETBSD_SOURCE
# undef _NETBSD_SOURCE # undef _NETBSD_SOURCE
#endif #endif
/* Enable OpenBSD extensions on NetBSD. */ /* Enable OpenBSD compatibility extensions on NetBSD.
Oddly enough, this does nothing on OpenBSD. */
#ifndef _OPENBSD_SOURCE #ifndef _OPENBSD_SOURCE
# undef _OPENBSD_SOURCE # undef _OPENBSD_SOURCE
#endif #endif
/* Enable threading extensions on Solaris. */ /* Define to 1 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_SOURCE
# undef _POSIX_SOURCE
#endif
/* Define to 2 if needed for POSIX-compatible behavior. */
#ifndef _POSIX_1_SOURCE
# undef _POSIX_1_SOURCE
#endif
/* Enable POSIX-compatible threading on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS #ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS
#endif #endif
@ -112,22 +133,19 @@ dnl configure.ac when using autoheader 2.62.
#ifndef _TANDEM_SOURCE #ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE # undef _TANDEM_SOURCE
#endif #endif
/* Enable X/Open extensions if necessary. HP-UX 11.11 defines /* Enable X/Open extensions. Define to 500 only if necessary
mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of to make mbstate_t available. */
whether compiling with -Ae or -D_HPUX_SOURCE=1. */
#ifndef _XOPEN_SOURCE #ifndef _XOPEN_SOURCE
# undef _XOPEN_SOURCE # undef _XOPEN_SOURCE
#endif #endif
/* Enable X/Open compliant socket functions that do not require linking ])dnl
with -lxnet on HP-UX 11.11. */
#ifndef _HPUX_ALT_XOPEN_SOCKET_API AC_REQUIRE([AC_CHECK_INCLUDES_DEFAULT])dnl
# undef _HPUX_ALT_XOPEN_SOCKET_API _AC_CHECK_HEADER_ONCE([wchar.h])
#endif _AC_CHECK_HEADER_ONCE([minix/config.h])
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__ dnl Defining __EXTENSIONS__ may break the system headers on some systems.
# undef __EXTENSIONS__ dnl (FIXME: Which ones?)
#endif
])
AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__],
[ac_cv_safe_to_define___extensions__], [ac_cv_safe_to_define___extensions__],
[AC_COMPILE_IFELSE( [AC_COMPILE_IFELSE(
@ -136,11 +154,33 @@ dnl configure.ac when using autoheader 2.62.
]AC_INCLUDES_DEFAULT])], ]AC_INCLUDES_DEFAULT])],
[ac_cv_safe_to_define___extensions__=yes], [ac_cv_safe_to_define___extensions__=yes],
[ac_cv_safe_to_define___extensions__=no])]) [ac_cv_safe_to_define___extensions__=no])])
test $ac_cv_safe_to_define___extensions__ = yes &&
AC_DEFINE([__EXTENSIONS__]) dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to
dnl 500, regardless of whether compiling with -Ae or -D_HPUX_SOURCE=1.
dnl But defining _XOPEN_SOURCE may turn *off* extensions on platforms
dnl not covered by turn-on-extensions macros (notably Dragonfly, Free,
dnl and OpenBSD, which don't have any equivalent of _NETBSD_SOURCE) so
dnl it should only be defined when necessary.
AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined],
[ac_cv_should_define__xopen_source],
[ac_cv_should_define__xopen_source=no
AS_IF([test $ac_cv_header_wchar_h = yes],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <wchar.h>
mbstate_t x;]])],
[],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#define _XOPEN_SOURCE 500
#include <wchar.h>
mbstate_t x;]])],
[ac_cv_should_define__xopen_source=yes])])])])
AC_DEFINE([_ALL_SOURCE]) AC_DEFINE([_ALL_SOURCE])
AC_DEFINE([_DARWIN_C_SOURCE]) AC_DEFINE([_DARWIN_C_SOURCE])
AC_DEFINE([_GNU_SOURCE]) AC_DEFINE([_GNU_SOURCE])
AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API])
AC_DEFINE([_NETBSD_SOURCE]) AC_DEFINE([_NETBSD_SOURCE])
AC_DEFINE([_OPENBSD_SOURCE]) AC_DEFINE([_OPENBSD_SOURCE])
AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
@ -152,24 +192,18 @@ dnl configure.ac when using autoheader 2.62.
AC_DEFINE([__STDC_WANT_LIB_EXT2__]) AC_DEFINE([__STDC_WANT_LIB_EXT2__])
AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__]) AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__])
AC_DEFINE([_TANDEM_SOURCE]) AC_DEFINE([_TANDEM_SOURCE])
AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], AS_IF([test $ac_cv_header_minix_config_h = yes],
[ac_cv_should_define__xopen_source], [MINIX=yes
[ac_cv_should_define__xopen_source=no AC_DEFINE([_MINIX])
AC_COMPILE_IFELSE( AC_DEFINE([_POSIX_SOURCE])
[AC_LANG_PROGRAM([[ AC_DEFINE([_POSIX_1_SOURCE], [2])],
#include <wchar.h> [MINIX=])
mbstate_t x;]])], AS_IF([test $ac_cv_safe_to_define___extensions__ = yes],
[], [AC_DEFINE([__EXTENSIONS__])])
[AC_COMPILE_IFELSE( AS_IF([test $ac_cv_should_define__xopen_source = yes],
[AC_LANG_PROGRAM([[ [AC_DEFINE([_XOPEN_SOURCE], [500])])
#define _XOPEN_SOURCE 500
#include <wchar.h>
mbstate_t x;]])],
[ac_cv_should_define__xopen_source=yes])])])
test $ac_cv_should_define__xopen_source = yes &&
AC_DEFINE([_XOPEN_SOURCE], [500])
AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API])
])# AC_USE_SYSTEM_EXTENSIONS ])# AC_USE_SYSTEM_EXTENSIONS
])
# gl_USE_SYSTEM_EXTENSIONS # gl_USE_SYSTEM_EXTENSIONS
# ------------------------ # ------------------------
@ -177,13 +211,17 @@ dnl configure.ac when using autoheader 2.62.
# typically due to standards-conformance issues. # typically due to standards-conformance issues.
AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS],
[ [
dnl Require this macro before AC_USE_SYSTEM_EXTENSIONS.
dnl gnulib does not need it. But if it gets required by third-party macros
dnl after AC_USE_SYSTEM_EXTENSIONS is required, autoconf 2.62..2.63 emit a
dnl warning: "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS".
dnl Note: We can do this only for one of the macros AC_AIX, AC_GNU_SOURCE,
dnl AC_MINIX. If people still use AC_AIX or AC_MINIX, they are out of luck.
AC_REQUIRE([AC_GNU_SOURCE])
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
dnl On OpenBSD 6.8 with GCC, the include files contain a couple of
dnl definitions that are only activated with an explicit -D_ISOC11_SOURCE.
dnl That's because this version of GCC (4.2.1) supports the option
dnl '-std=gnu99' but not the option '-std=gnu11'.
AC_REQUIRE([AC_CANONICAL_HOST])
case "$host_os" in
openbsd*)
AC_DEFINE([_ISOC11_SOURCE], [1],
[Define to enable the declarations of ISO C 11 types and functions.])
;;
esac
]) ])

View file

@ -1,5 +1,5 @@
# malloc.m4 serial 20 # malloc.m4 serial 21
dnl Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc. dnl Copyright (C) 2007, 2009-2021 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it, dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved. dnl with or without modifications, as long as this notice is preserved.
@ -8,18 +8,12 @@ dnl with or without modifications, as long as this notice is preserved.
# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c # https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=04be2b7a29d65d9a08e64e8e56e594c91749598c
AC_DEFUN([_AC_FUNC_MALLOC_IF], AC_DEFUN([_AC_FUNC_MALLOC_IF],
[ [
AC_REQUIRE([AC_HEADER_STDC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles AC_REQUIRE([AC_CANONICAL_HOST])dnl for cross-compiles
AC_CHECK_HEADERS([stdlib.h])
AC_CACHE_CHECK([for GNU libc compatible malloc], AC_CACHE_CHECK([for GNU libc compatible malloc],
[ac_cv_func_malloc_0_nonnull], [ac_cv_func_malloc_0_nonnull],
[AC_RUN_IFELSE( [AC_RUN_IFELSE(
[AC_LANG_PROGRAM( [AC_LANG_PROGRAM(
[[#if defined STDC_HEADERS || defined HAVE_STDLIB_H [[#include <stdlib.h>
# include <stdlib.h>
#else
char *malloc ();
#endif
]], ]],
[[char *p = malloc (0); [[char *p = malloc (0);
int result = !p; int result = !p;

View file

@ -6,8 +6,10 @@
# This implementation will be obsolete once we can assume Autoconf 2.70 # This implementation will be obsolete once we can assume Autoconf 2.70
# or later is installed everywhere a Gnulib program might be developed. # or later is installed everywhere a Gnulib program might be developed.
m4_version_prereq([2.70], [], [
# Copyright (C) 2001-2020 Free Software Foundation, Inc.
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -70,7 +72,7 @@ _AS_ECHO_LOG([checking for _AC_LANG compiler version])
set X $ac_compile set X $ac_compile
ac_compiler=$[2] ac_compiler=$[2]
for ac_option in --version -v -V -qversion -version; do for ac_option in --version -v -V -qversion -version; do
m4_ifdef([_AC_DO_LIMIT],[_AC_DO_LIMIT],[_AC_DO])([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
done done
m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
@ -135,7 +137,7 @@ _AS_ECHO_LOG([checking for _AC_LANG compiler version])
set X $ac_compile set X $ac_compile
ac_compiler=$[2] ac_compiler=$[2]
for ac_option in --version -v -V -qversion; do for ac_option in --version -v -V -qversion; do
m4_ifdef([_AC_DO_LIMIT],[_AC_DO_LIMIT],[_AC_DO])([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
done done
m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
@ -822,3 +824,6 @@ dnl Tru64 N/A (no support)
dnl with extended modes being tried first. dnl with extended modes being tried first.
[[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], [$1], [$2])[]dnl [[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], [$1], [$2])[]dnl
])# _AC_PROG_CXX_CXX11 ])# _AC_PROG_CXX_CXX11
])# m4_version_prereq