1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-08 17:22:05 +03:00

Ensure consistent effects of _LINUX_SOURCE_COMPAT.

* modules/extensions (configure.ac-early): New section.
* m4/extensions-aix.m4: New file.
* modules/extensions-aix: New file.
* m4/errno_h.m4 (gl_HEADER_ERRNO_H): Require gl_USE_AIX_EXTENSIONS,
instead of defining _LINUX_SOURCE_COMPAT at this stage.
* m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Likewise.
* m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Likewise.
* m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Likewise.
* m4/scandir.m4 (gl_FUNC_SCANDIR): Likewise.
* modules/errno (Depends-on): Add extensions-aix.
* modules/malloc-gnu (Depends-on): Likewise.
* modules/calloc-gnu (Depends-on): Likewise.
* modules/realloc-gnu (Depends-on): Likewise.
* modules/scandir (Depends-on): Likewise.
This commit is contained in:
Bruno Haible
2024-08-01 13:52:30 +02:00
parent cee2cccd02
commit 34bd9be12b
14 changed files with 84 additions and 15 deletions

View File

@@ -1,3 +1,21 @@
2024-08-01 Bruno Haible <bruno@clisp.org>
Ensure consistent effects of _LINUX_SOURCE_COMPAT.
* modules/extensions (configure.ac-early): New section.
* m4/extensions-aix.m4: New file.
* modules/extensions-aix: New file.
* m4/errno_h.m4 (gl_HEADER_ERRNO_H): Require gl_USE_AIX_EXTENSIONS,
instead of defining _LINUX_SOURCE_COMPAT at this stage.
* m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Likewise.
* m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Likewise.
* m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Likewise.
* m4/scandir.m4 (gl_FUNC_SCANDIR): Likewise.
* modules/errno (Depends-on): Add extensions-aix.
* modules/malloc-gnu (Depends-on): Likewise.
* modules/calloc-gnu (Depends-on): Likewise.
* modules/realloc-gnu (Depends-on): Likewise.
* modules/scandir (Depends-on): Likewise.
2024-08-01 Bruno Haible <bruno@clisp.org> 2024-08-01 Bruno Haible <bruno@clisp.org>
strerror_r: Fix for AIX (regression yesterday). strerror_r: Fix for AIX (regression yesterday).

View File

@@ -1,5 +1,5 @@
# calloc.m4 # calloc.m4
# serial 32 # serial 33
dnl Copyright (C) 2004-2024 Free Software Foundation, Inc. dnl Copyright (C) 2004-2024 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,
@@ -60,8 +60,7 @@ AC_DEFUN([gl_FUNC_CALLOC_GNU],
AC_REQUIRE([gl_FUNC_CALLOC_POSIX]) AC_REQUIRE([gl_FUNC_CALLOC_POSIX])
dnl This helps if !(__VEC__ || __AIXVEC), and shouldn't hurt otherwise. dnl This helps if !(__VEC__ || __AIXVEC), and shouldn't hurt otherwise.
AC_DEFINE([_LINUX_SOURCE_COMPAT], [1], AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
[Define so that AIX headers are more compatible with GNU/Linux.])
REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX" REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX"
if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then

View File

@@ -1,5 +1,5 @@
# errno_h.m4 # errno_h.m4
# serial 15 # serial 16
dnl Copyright (C) 2004, 2006, 2008-2024 Free Software Foundation, Inc. dnl Copyright (C) 2004, 2006, 2008-2024 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,
@@ -12,8 +12,7 @@ AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CC])
dnl Persuade AIX 7.3 errno.h to make EEXIST != ENOTEMPTY. dnl Persuade AIX 7.3 errno.h to make EEXIST != ENOTEMPTY.
AC_DEFINE([_LINUX_SOURCE_COMPAT], [1], AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
[Define so that AIX headers are more compatible with GNU/Linux.])
AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
AC_EGREP_CPP([booboo],[ AC_EGREP_CPP([booboo],[

25
m4/extensions-aix.m4 Normal file
View File

@@ -0,0 +1,25 @@
# extensions-aix.m4
# serial 1
dnl Copyright (C) 2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
# On AIX, most extensions are already enabled through the _ALL_SOURCE macro,
# defined by gl_USE_SYSTEM_EXTENSIONS. gl_USE_AIX_EXTENSIONS additionally
# activates more GNU and Linux-like behaviours, affecting
# - the time_t type,
# - errno values in <errno.h>: ENOTEMPTY
# - functions in <stdlib.h>: malloc calloc realloc valloc
# <https://www.ibm.com/docs/en/aix/7.3?topic=m-malloc-free-realloc-calloc-mallopt-mallinfo-mallinfo-heap-alloca-valloc-posix-memalign-subroutine>
# - functions in <string.h>: strerror_r (returns 'char *', like glibc)
# - functions in <dirent.h>: scandir, alphasort, readdir_r
# - functions in <netdb.h>: gethostbyname_r gethostbyaddr_r
# - declarations in <unistd.h>: sbrk
# and a couple of secondary <sys/*> header files.
AC_DEFUN_ONCE([gl_USE_AIX_EXTENSIONS],
[
AC_DEFINE([_LINUX_SOURCE_COMPAT], [1],
[Define so that AIX headers are more compatible with GNU/Linux.])
])

View File

@@ -1,5 +1,5 @@
# malloc.m4 # malloc.m4
# serial 32 # serial 33
dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. dnl Copyright (C) 2007, 2009-2024 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,
@@ -47,8 +47,7 @@ AC_DEFUN([gl_FUNC_MALLOC_GNU],
AC_REQUIRE([gl_FUNC_MALLOC_POSIX]) AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
dnl This helps if !(__VEC__ || __AIXVEC), and shouldn't hurt otherwise. dnl This helps if !(__VEC__ || __AIXVEC), and shouldn't hurt otherwise.
AC_DEFINE([_LINUX_SOURCE_COMPAT], [1], AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
[Define so that AIX headers are more compatible with GNU/Linux.])
REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX" REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX"
if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then

View File

@@ -1,5 +1,5 @@
# realloc.m4 # realloc.m4
# serial 30 # serial 31
dnl Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc. dnl Copyright (C) 2007, 2009-2024 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,
@@ -47,8 +47,7 @@ AC_DEFUN([gl_FUNC_REALLOC_GNU],
AC_REQUIRE([gl_FUNC_REALLOC_POSIX]) AC_REQUIRE([gl_FUNC_REALLOC_POSIX])
dnl This helps if !(__VEC__ || __AIXVEC), and shouldn't hurt otherwise. dnl This helps if !(__VEC__ || __AIXVEC), and shouldn't hurt otherwise.
AC_DEFINE([_LINUX_SOURCE_COMPAT], [1], AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
[Define so that AIX headers are more compatible with GNU/Linux.])
if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then
_AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1]) _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1])

View File

@@ -1,5 +1,5 @@
# scandir.m4 # scandir.m4
# serial 3 # serial 4
dnl Copyright (C) 2009-2024 Free Software Foundation, Inc. dnl Copyright (C) 2009-2024 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,
@@ -12,8 +12,7 @@ AC_DEFUN([gl_FUNC_SCANDIR],
dnl Persuade glibc and Solaris <dirent.h> to declare scandir(). dnl Persuade glibc and Solaris <dirent.h> to declare scandir().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
AC_DEFINE([_LINUX_SOURCE_COMPAT], [1], AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
[Define so that AIX headers are more compatible with GNU/Linux.])
AC_CHECK_FUNCS([scandir]) AC_CHECK_FUNCS([scandir])
if test $ac_cv_func_scandir = no; then if test $ac_cv_func_scandir = no; then

View File

@@ -7,6 +7,7 @@ m4/calloc.m4
Depends-on: Depends-on:
calloc-posix calloc-posix
extensions-aix
xalloc-oversized [test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1] xalloc-oversized [test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1]
configure.ac: configure.ac:

View File

@@ -8,6 +8,7 @@ m4/errno_h.m4
Depends-on: Depends-on:
gen-header gen-header
include_next include_next
extensions-aix
configure.ac: configure.ac:
gl_HEADER_ERRNO_H gl_HEADER_ERRNO_H

View File

@@ -6,6 +6,10 @@ m4/extensions.m4
Depends-on: Depends-on:
configure.ac-early:
# This is actually already done in the pre-early phase.
# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
configure.ac: configure.ac:
Makefile.am: Makefile.am:

22
modules/extensions-aix Normal file
View File

@@ -0,0 +1,22 @@
Description:
Enable extensions in AIX standard headers
Files:
m4/extensions-aix.m4
Depends-on:
configure.ac-early:
AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
configure.ac:
Makefile.am:
Include:
License:
LGPLv2+
Maintainer:
all

View File

@@ -6,6 +6,7 @@ lib/malloc.c
Depends-on: Depends-on:
malloc-posix malloc-posix
extensions-aix
xalloc-oversized [test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1] xalloc-oversized [test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1]
configure.ac: configure.ac:

View File

@@ -6,6 +6,7 @@ lib/realloc.c
Depends-on: Depends-on:
realloc-posix realloc-posix
extensions-aix
free-posix [test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1] free-posix [test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1]
malloc-gnu [test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1] malloc-gnu [test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1]
xalloc-oversized [test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1] xalloc-oversized [test $REPLACE_REALLOC_FOR_REALLOC_GNU = 1]

View File

@@ -10,6 +10,7 @@ builtin-expect
closedir closedir
dirent dirent
extensions extensions
extensions-aix
largefile largefile
opendir opendir
readdir readdir