From ef4b4afaa5803aa04d28a96c639d2ab059f94da2 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 1 Jan 2021 22:50:58 +0100 Subject: [PATCH] aligned_alloc: Fix test failure on OpenBSD 6.8. * m4/extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): On OpenBSD, define _ISOC11_SOURCE. * m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC): Update comment. --- ChangeLog | 7 +++++++ m4/aligned_alloc.m4 | 4 ++-- m4/extensions.m4 | 14 +++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1989ffcc0d..1981befb50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2021-01-01 Bruno Haible + + aligned_alloc: Fix test failure on OpenBSD 6.8. + * m4/extensions.m4 (gl_USE_SYSTEM_EXTENSIONS): On OpenBSD, define + _ISOC11_SOURCE. + * m4/aligned_alloc.m4 (gl_FUNC_ALIGNED_ALLOC): Update comment. + 2021-01-01 Bruno Haible posixtm tests: Disable part of the test on plaforms where it fails. diff --git a/m4/aligned_alloc.m4 b/m4/aligned_alloc.m4 index f16ad159c3..54253edc47 100644 --- a/m4/aligned_alloc.m4 +++ b/m4/aligned_alloc.m4 @@ -1,4 +1,4 @@ -# aligned_alloc.m4 serial 1 +# aligned_alloc.m4 serial 2 dnl Copyright (C) 2020-2021 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -9,7 +9,7 @@ AC_DEFUN([gl_FUNC_ALIGNED_ALLOC], AC_REQUIRE([gl_STDLIB_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - dnl Persuade glibc to declare aligned_alloc(). + dnl Persuade glibc and OpenBSD to declare aligned_alloc(). AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_CHECK_FUNCS_ONCE([aligned_alloc]) diff --git a/m4/extensions.m4 b/m4/extensions.m4 index f7333acbd4..5792a9557a 100644 --- a/m4/extensions.m4 +++ b/m4/extensions.m4 @@ -1,4 +1,4 @@ -# serial 21 -*- Autoconf -*- +# serial 22 -*- Autoconf -*- # Enable extensions on systems that normally disable them. # Copyright (C) 2003, 2006-2021 Free Software Foundation, Inc. @@ -212,4 +212,16 @@ dnl it should only be defined when necessary. AC_DEFUN_ONCE([gl_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 ]) -- 2.39.5