dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

Blame SOURCES/0297-build-Use-AC_HEADER_MAJOR-to-find-device-macros.patch

b1bcb2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
c4e390
From: Mike Gilbert <floppym@gentoo.org>
c4e390
Date: Tue, 19 Apr 2016 14:27:22 -0400
b1bcb2
Subject: [PATCH] build: Use AC_HEADER_MAJOR to find device macros
c4e390
c4e390
Depending on the OS/libc, device macros are defined in different
c4e390
headers. This change ensures we include the right one.
c4e390
c4e390
sys/types.h - BSD
c4e390
sys/mkdev.h - Sun
c4e390
sys/sysmacros.h - glibc (Linux)
c4e390
c4e390
glibc currently pulls sys/sysmacros.h into sys/types.h, but this may
c4e390
change in a future release.
c4e390
c4e390
https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html
c4e390
c4e390
Upstream-commit-id: 7a5b301e3ad
c4e390
---
c4e390
 configure.ac                         | 3 ++-
c4e390
 grub-core/osdep/devmapper/getroot.c  | 6 ++++++
c4e390
 grub-core/osdep/devmapper/hostdisk.c | 5 +++++
c4e390
 grub-core/osdep/linux/getroot.c      | 6 ++++++
c4e390
 grub-core/osdep/unix/getroot.c       | 5 +++++
c4e390
 5 files changed, 24 insertions(+), 1 deletion(-)
c4e390
c4e390
diff --git a/configure.ac b/configure.ac
c4e390
index 8b10a93cb56..936cfa0ce5a 100644
c4e390
--- a/configure.ac
c4e390
+++ b/configure.ac
c4e390
@@ -405,7 +405,8 @@ fi
c4e390
 
c4e390
 # Check for functions and headers.
c4e390
 AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
c4e390
-AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
c4e390
+AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h limits.h)
c4e390
+AC_HEADER_MAJOR
c4e390
 
c4e390
 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
c4e390
 #include <sys/param.h>
c4e390
diff --git a/grub-core/osdep/devmapper/getroot.c b/grub-core/osdep/devmapper/getroot.c
c4e390
index de32102322b..227fa5058b6 100644
c4e390
--- a/grub-core/osdep/devmapper/getroot.c
c4e390
+++ b/grub-core/osdep/devmapper/getroot.c
c4e390
@@ -40,6 +40,12 @@
c4e390
 #include <limits.h>
c4e390
 #endif
c4e390
 
c4e390
+#if defined(MAJOR_IN_MKDEV)
c4e390
+#include <sys/mkdev.h>
c4e390
+#elif defined(MAJOR_IN_SYSMACROS)
c4e390
+#include <sys/sysmacros.h>
c4e390
+#endif
c4e390
+
c4e390
 #include <libdevmapper.h>
c4e390
 
c4e390
 #include <grub/types.h>
c4e390
diff --git a/grub-core/osdep/devmapper/hostdisk.c b/grub-core/osdep/devmapper/hostdisk.c
c4e390
index 19c1101fdac..a697bcb4d8d 100644
c4e390
--- a/grub-core/osdep/devmapper/hostdisk.c
c4e390
+++ b/grub-core/osdep/devmapper/hostdisk.c
c4e390
@@ -24,6 +24,11 @@
c4e390
 #include <errno.h>
c4e390
 #include <limits.h>
c4e390
 
c4e390
+#if defined(MAJOR_IN_MKDEV)
c4e390
+#include <sys/mkdev.h>
c4e390
+#elif defined(MAJOR_IN_SYSMACROS)
c4e390
+#include <sys/sysmacros.h>
c4e390
+#endif
c4e390
 
c4e390
 #ifdef HAVE_DEVICE_MAPPER
c4e390
 # include <libdevmapper.h>
c4e390
diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
c4e390
index 5987d078a2f..6a7784a4ea2 100644
c4e390
--- a/grub-core/osdep/linux/getroot.c
c4e390
+++ b/grub-core/osdep/linux/getroot.c
c4e390
@@ -35,6 +35,12 @@
c4e390
 #include <limits.h>
c4e390
 #endif
c4e390
 
c4e390
+#if defined(MAJOR_IN_MKDEV)
c4e390
+#include <sys/mkdev.h>
c4e390
+#elif defined(MAJOR_IN_SYSMACROS)
c4e390
+#include <sys/sysmacros.h>
c4e390
+#endif
c4e390
+
c4e390
 #include <grub/types.h>
c4e390
 #include <sys/ioctl.h>         /* ioctl */
c4e390
 #include <sys/mount.h>
c4e390
diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c
c4e390
index e3887cbea68..026dd79b2d6 100644
c4e390
--- a/grub-core/osdep/unix/getroot.c
c4e390
+++ b/grub-core/osdep/unix/getroot.c
c4e390
@@ -57,6 +57,11 @@
c4e390
 #endif
c4e390
 
c4e390
 #include <sys/types.h>
c4e390
+#if defined(MAJOR_IN_MKDEV)
c4e390
+#include <sys/mkdev.h>
c4e390
+#elif defined(MAJOR_IN_SYSMACROS)
c4e390
+#include <sys/sysmacros.h>
c4e390
+#endif
c4e390
 
c4e390
 #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
c4e390
 # include <grub/util/libzfs.h>