autoconf
[Top][All Lists]
Advanced

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

[PATCH] AC_HEADER_MAJOR: Probe <sys/sysmacros.h> first


From: Florian Weimer
Subject: [PATCH] AC_HEADER_MAJOR: Probe <sys/sysmacros.h> first
Date: Thu, 24 Nov 2022 08:16:42 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

And fix the header name in the documentation.

Probing <sys/sysmacros.h> first avoids triggering spurious undeclared
function errors.  The error is harmless, but is a distraction when
looking at build differences.

This should not impact glibc compatibility because glibc never
provided <sys/mkdev.h>.

---
 lib/autoconf/headers.m4 | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index 5fde7f5a..efab1149 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -485,11 +485,11 @@ fi
 
 # AC_HEADER_MAJOR
 # ---------------
-# Thanks to glibc 2.25 deprecating macros in sys/types.h, coupled with
+# Current glibc defines major et. all in <sys/sysmacros.h> only.
 # back-compat to autoconf 2.69, we need the following logic:
 # Check whether <sys/types.h> compiles.
-# If <sys/mkdev.h> compiles, assume it provides major/minor/makedev.
-# Otherwise, if <sys/sysmacros.h> compiles, assume it provides the macros.
+# If <sys/sysmacros.h> compiles, assume it provides major/minor/makedev.
+# Otherwise, if <sys/mkdev.h> compiles, assume it provides the macros.
 # Otherwise, either the macros were provided by <sys/types.h>, or do
 # not exist on the platform.  Code trying to use these three macros is
 # assumed to not care about platforms that lack the macros.
@@ -499,15 +499,15 @@ AN_FUNCTION([minor],     [AC_HEADER_MAJOR])
 AN_HEADER([sys/mkdev.h], [AC_HEADER_MAJOR])
 AC_DEFUN([AC_HEADER_MAJOR],
 [AC_CHECK_HEADERS_ONCE([sys/types.h])
-AC_CHECK_HEADER([sys/mkdev.h],
-               [AC_DEFINE([MAJOR_IN_MKDEV], [1],
+AC_CHECK_HEADER([sys/sysmacros.h],
+               [AC_DEFINE([MAJOR_IN_SYSMACROS], [1],
                           [Define to 1 if 'major', 'minor', and 'makedev' are
-                           declared in <mkdev.h>.])])
-if test $ac_cv_header_sys_mkdev_h = no; then
-  AC_CHECK_HEADER([sys/sysmacros.h],
-                 [AC_DEFINE([MAJOR_IN_SYSMACROS], [1],
+                           declared in <sys/sysmacros.h>.])])
+if test $ac_cv_header_sys_sysmacros_h = no; then
+  AC_CHECK_HEADER([sys/mkdev.h],
+                 [AC_DEFINE([MAJOR_IN_MKDEV], [1],
                             [Define to 1 if 'major', 'minor', and 'makedev'
-                             are declared in <sysmacros.h>.])])
+                             are declared in <sys/mkdev.h>.])])
 fi
 ])# AC_HEADER_MAJOR
 

base-commit: 078edd8c0fb36b0245df3c6ebd621225dea9b685




reply via email to

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