bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] BASH_STRUCT_DIRENT*: simplify


From: Grisha Levit
Subject: [PATCH] BASH_STRUCT_DIRENT*: simplify
Date: Wed, 23 Oct 2024 13:34:54 -0400

The BASH_STRUCT_DIRENT* macros duplicate the caching, message printing,
and defining functionality already present in the AC_CHECK_MEMBERS macro
that gets called.

It's cosmetic, but causes the configure output to look like:

    checking for struct dirent.d_ino... checking for struct dirent.d_ino... yes
    yes
    checking for struct dirent.d_fileno... checking for struct 
dirent.d_fileno... yes
    yes
    checking for struct dirent.d_namlen... checking for struct 
dirent.d_namlen... no
    no

This patch makes the BASH_STRUCT_DIRENT_* macros match
AC_STRUCT_DIRENT_* ones[1].

  [1]: 
https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/types.m4#n1009
---
 aclocal.m4 | 34 ++++------------------------------
 1 file changed, 4 insertions(+), 30 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index cb2f06f6..4541eb87 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1025,7 +1025,7 @@ dnl like _AC_STRUCT_DIRENT(MEMBER) but public
 AC_DEFUN(BASH_STRUCT_DIRENT,
 [
 AC_REQUIRE([AC_HEADER_DIRENT])
-AC_CHECK_MEMBERS(struct dirent.$1, bash_cv_dirent_has_$1=yes, 
bash_cv_dirent_has_$1=no,
+AC_CHECK_MEMBERS([struct dirent.$1], [], [],
 [[
 #include <stdio.h>
 #include <sys/types.h>
@@ -1049,35 +1049,9 @@ AC_CHECK_MEMBERS(struct dirent.$1, 
bash_cv_dirent_has_$1=yes, bash_cv_dirent_has
 ]])
 ])
 
-AC_DEFUN(BASH_STRUCT_DIRENT_D_INO,
-[AC_REQUIRE([AC_HEADER_DIRENT])
-AC_MSG_CHECKING(for struct dirent.d_ino)
-AC_CACHE_VAL(bash_cv_dirent_has_d_ino, [BASH_STRUCT_DIRENT([d_ino])])
-AC_MSG_RESULT($bash_cv_dirent_has_d_ino)
-if test $bash_cv_dirent_has_d_ino = yes; then
-AC_DEFINE(HAVE_STRUCT_DIRENT_D_INO)
-fi
-])
-
-AC_DEFUN(BASH_STRUCT_DIRENT_D_FILENO,
-[AC_REQUIRE([AC_HEADER_DIRENT])
-AC_MSG_CHECKING(for struct dirent.d_fileno)
-AC_CACHE_VAL(bash_cv_dirent_has_d_fileno, [BASH_STRUCT_DIRENT([d_fileno])])
-AC_MSG_RESULT($bash_cv_dirent_has_d_fileno)
-if test $bash_cv_dirent_has_d_fileno = yes; then
-AC_DEFINE(HAVE_STRUCT_DIRENT_D_FILENO)
-fi
-])
-
-AC_DEFUN(BASH_STRUCT_DIRENT_D_NAMLEN,
-[AC_REQUIRE([AC_HEADER_DIRENT])
-AC_MSG_CHECKING(for struct dirent.d_namlen)
-AC_CACHE_VAL(bash_cv_dirent_has_d_namlen, [BASH_STRUCT_DIRENT([d_namlen])])
-AC_MSG_RESULT($bash_cv_dirent_has_d_namlen)
-if test $bash_cv_dirent_has_d_namlen = yes; then
-AC_DEFINE(HAVE_STRUCT_DIRENT_D_NAMLEN)
-fi
-])
+AC_DEFUN([BASH_STRUCT_DIRENT_D_INO], [BASH_STRUCT_DIRENT([d_ino])])
+AC_DEFUN([BASH_STRUCT_DIRENT_D_FILENO], [BASH_STRUCT_DIRENT([d_fileno])])
+AC_DEFUN([BASH_STRUCT_DIRENT_D_NAMLEN], [BASH_STRUCT_DIRENT([d_namlen])])
 
 AC_DEFUN(BASH_STRUCT_TIMEVAL,
 [AC_MSG_CHECKING(for struct timeval in sys/time.h and time.h)
-- 
2.47.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]