]> Savannah Git Hosting - gnulib.git/commitdiff
Ensure consistent effects of _LINUX_SOURCE_COMPAT.
authorBruno Haible <bruno@clisp.org>
Thu, 1 Aug 2024 11:52:30 +0000 (13:52 +0200)
committerBruno Haible <bruno@clisp.org>
Thu, 1 Aug 2024 11:52:30 +0000 (13:52 +0200)
* 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.

14 files changed:
ChangeLog
m4/calloc.m4
m4/errno_h.m4
m4/extensions-aix.m4 [new file with mode: 0644]
m4/malloc.m4
m4/realloc.m4
m4/scandir.m4
modules/calloc-gnu
modules/errno
modules/extensions
modules/extensions-aix [new file with mode: 0644]
modules/malloc-gnu
modules/realloc-gnu
modules/scandir

index 9acef580e3ff400e5a5b311eb32d506c3d384b74..964e07c9edb7f011f9a7e21e540614d239023581 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        strerror_r: Fix for AIX (regression yesterday).
index 0fbd0d8090b50c0a582740cac64e4eec38945fa7..6d9a808dbf9933775cedd64cef263a27fe7f8904 100644 (file)
@@ -1,5 +1,5 @@
 # calloc.m4
-# serial 32
+# serial 33
 dnl Copyright (C) 2004-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,
@@ -60,8 +60,7 @@ AC_DEFUN([gl_FUNC_CALLOC_GNU],
   AC_REQUIRE([gl_FUNC_CALLOC_POSIX])
 
   dnl This helps if !(__VEC__ || __AIXVEC), and shouldn't hurt otherwise.
-  AC_DEFINE([_LINUX_SOURCE_COMPAT], [1],
-    [Define so that AIX headers are more compatible with GNU/Linux.])
+  AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
 
   REPLACE_CALLOC_FOR_CALLOC_GNU="$REPLACE_CALLOC_FOR_CALLOC_POSIX"
   if test $REPLACE_CALLOC_FOR_CALLOC_GNU = 0; then
index f6a2e81b5de170db7d3a79ef581c89f8ebbc193a..9738a49f19a7a2f77d3edb15cb9870a4083781f6 100644 (file)
@@ -1,5 +1,5 @@
 # errno_h.m4
-# serial 15
+# serial 16
 dnl Copyright (C) 2004, 2006, 2008-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,
@@ -12,8 +12,7 @@ AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
   AC_REQUIRE([AC_PROG_CC])
 
   dnl Persuade AIX 7.3 errno.h to make EEXIST != ENOTEMPTY.
-  AC_DEFINE([_LINUX_SOURCE_COMPAT], [1],
-    [Define so that AIX headers are more compatible with GNU/Linux.])
+  AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
 
   AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
     AC_EGREP_CPP([booboo],[
diff --git a/m4/extensions-aix.m4 b/m4/extensions-aix.m4
new file mode 100644 (file)
index 0000000..990a7ac
--- /dev/null
@@ -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.])
+])
index a410a5c24f9064d344bfe0deac01a021b68fd52b..4a71b060b9bf40b9e84da2b8d80c5e2521681ca9 100644 (file)
@@ -1,5 +1,5 @@
 # malloc.m4
-# serial 32
+# serial 33
 dnl Copyright (C) 2007, 2009-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,
@@ -47,8 +47,7 @@ AC_DEFUN([gl_FUNC_MALLOC_GNU],
   AC_REQUIRE([gl_FUNC_MALLOC_POSIX])
 
   dnl This helps if !(__VEC__ || __AIXVEC), and shouldn't hurt otherwise.
-  AC_DEFINE([_LINUX_SOURCE_COMPAT], [1],
-    [Define so that AIX headers are more compatible with GNU/Linux.])
+  AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
 
   REPLACE_MALLOC_FOR_MALLOC_GNU="$REPLACE_MALLOC_FOR_MALLOC_POSIX"
   if test $REPLACE_MALLOC_FOR_MALLOC_GNU = 0; then
index 13bb28ce9d7494d89fa5714df9f3e9ad7ccf26c7..b3ec43a8a72a6eda2d49f99c2d963abc133f696d 100644 (file)
@@ -1,5 +1,5 @@
 # realloc.m4
-# serial 30
+# serial 31
 dnl Copyright (C) 2007, 2009-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,
@@ -47,8 +47,7 @@ AC_DEFUN([gl_FUNC_REALLOC_GNU],
   AC_REQUIRE([gl_FUNC_REALLOC_POSIX])
 
   dnl This helps if !(__VEC__ || __AIXVEC), and shouldn't hurt otherwise.
-  AC_DEFINE([_LINUX_SOURCE_COMPAT], [1],
-    [Define so that AIX headers are more compatible with GNU/Linux.])
+  AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
 
   if test $REPLACE_REALLOC_FOR_REALLOC_GNU = 0; then
     _AC_FUNC_REALLOC_IF([], [REPLACE_REALLOC_FOR_REALLOC_GNU=1])
index 192ac5f1549ca47584551131b7e8e430e3f72d87..c8673fc88086dec356326407004f63fed7ac7192 100644 (file)
@@ -1,5 +1,5 @@
 # scandir.m4
-# serial 3
+# serial 4
 dnl Copyright (C) 2009-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,
@@ -12,8 +12,7 @@ AC_DEFUN([gl_FUNC_SCANDIR],
   dnl Persuade glibc and Solaris <dirent.h> to declare scandir().
   AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
-  AC_DEFINE([_LINUX_SOURCE_COMPAT], [1],
-    [Define so that AIX headers are more compatible with GNU/Linux.])
+  AC_REQUIRE([gl_USE_AIX_EXTENSIONS])
 
   AC_CHECK_FUNCS([scandir])
   if test $ac_cv_func_scandir = no; then
index 278df7325ec8d3a13c4d9453eef4e3e002a10bca..f3fb393e53c3f6758204e84a5483d1564b1d54b6 100644 (file)
@@ -7,6 +7,7 @@ m4/calloc.m4
 
 Depends-on:
 calloc-posix
+extensions-aix
 xalloc-oversized     [test $REPLACE_CALLOC_FOR_CALLOC_GNU = 1]
 
 configure.ac:
index e24549212430222c87e6d3252420b29c09c3fc48..385985feab7e4f4e0748a40b33756fa2bea26b48 100644 (file)
@@ -8,6 +8,7 @@ m4/errno_h.m4
 Depends-on:
 gen-header
 include_next
+extensions-aix
 
 configure.ac:
 gl_HEADER_ERRNO_H
index b7e37bb4f5eb32727fc7606b3dc086c1c572656b..85e7421edb605f6976f7d993a2c555187e32501d 100644 (file)
@@ -6,6 +6,10 @@ m4/extensions.m4
 
 Depends-on:
 
+configure.ac-early:
+# This is actually already done in the pre-early phase.
+# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
 configure.ac:
 
 Makefile.am:
diff --git a/modules/extensions-aix b/modules/extensions-aix
new file mode 100644 (file)
index 0000000..783dc49
--- /dev/null
@@ -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
index b0fa1739e8233b816d3ba598e8843ee5dfe12b7f..95227241d0debaf9c4682b11f79e494fa9973985 100644 (file)
@@ -6,6 +6,7 @@ lib/malloc.c
 
 Depends-on:
 malloc-posix
+extensions-aix
 xalloc-oversized     [test $REPLACE_MALLOC_FOR_MALLOC_GNU = 1]
 
 configure.ac:
index b06a237dd351945c8a5a0306a0eefe1f15ef554d..ff0f838b99eede240706f2f14a65edee9beee486 100644 (file)
@@ -6,6 +6,7 @@ lib/realloc.c
 
 Depends-on:
 realloc-posix
+extensions-aix
 free-posix           [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]
index eefdfa7cff238ae49d62a81a7cc1d2559178d3aa..fa58900904ee4f5283bf524ae95e5d06d824b73c 100644 (file)
@@ -10,6 +10,7 @@ builtin-expect
 closedir
 dirent
 extensions
+extensions-aix
 largefile
 opendir
 readdir