From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1arrQJ-0003pK-EE for mharc-grub-devel@gnu.org; Sun, 17 Apr 2016 14:27:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1arrQG-0003jY-DK for grub-devel@gnu.org; Sun, 17 Apr 2016 14:27:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1arrQB-0007DY-R9 for grub-devel@gnu.org; Sun, 17 Apr 2016 14:27:52 -0400 Received: from dev.gentoo.org ([2001:470:ea4a:1:5054:ff:fec7:86e4]:36830 helo=smtp.gentoo.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1arrQB-0007D8-JP for grub-devel@gnu.org; Sun, 17 Apr 2016 14:27:47 -0400 Received: from naomi.gilbertsystems.net (d192-24-229-26.try.wideopenwest.com [24.192.26.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: floppym) by smtp.gentoo.org (Postfix) with ESMTPSA id DA20334097F for ; Sun, 17 Apr 2016 18:27:45 +0000 (UTC) From: Mike Gilbert To: grub-devel@gnu.org Subject: [PATCH v2] build: Use AC_HEADER_MAJOR to find device macros Date: Sun, 17 Apr 2016 14:27:42 -0400 Message-Id: <1460917662-31103-1-git-send-email-floppym@gentoo.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <5713C900.8070007@gmail.com> References: <5713C900.8070007@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:470:ea4a:1:5054:ff:fec7:86e4 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Apr 2016 18:27:53 -0000 Depending on the OS/libc, device macros are defined in different headers. sys/mkdev.h - BSD, Sun sys/sysmacros.h - glibc (Linux) glibc currently pulls sys/sysmacros.h into sys/types.h, but this may change in a future release. https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html --- configure.ac | 3 ++- grub-core/osdep/devmapper/getroot.c | 6 ++++++ grub-core/osdep/devmapper/hostdisk.c | 5 +++++ grub-core/osdep/linux/getroot.c | 6 ++++++ grub-core/osdep/unix/getroot.c | 4 +++- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 57e1713..9ddfc53 100644 --- a/configure.ac +++ b/configure.ac @@ -388,7 +388,8 @@ fi # Check for functions and headers. AC_CHECK_FUNCS(posix_memalign memalign getextmntent) -AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h) +AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h limits.h) +AC_HEADER_MAJOR AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default #include diff --git a/grub-core/osdep/devmapper/getroot.c b/grub-core/osdep/devmapper/getroot.c index 05eda50..72e5582 100644 --- a/grub-core/osdep/devmapper/getroot.c +++ b/grub-core/osdep/devmapper/getroot.c @@ -40,6 +40,12 @@ #include #endif +#if defined(MAJOR_IN_MKDEV) +#include +#elif defined(MAJOR_IN_SYSMACROS) +#include +#endif + #include #include diff --git a/grub-core/osdep/devmapper/hostdisk.c b/grub-core/osdep/devmapper/hostdisk.c index 19c1101..a697bcb 100644 --- a/grub-core/osdep/devmapper/hostdisk.c +++ b/grub-core/osdep/devmapper/hostdisk.c @@ -24,6 +24,11 @@ #include #include +#if defined(MAJOR_IN_MKDEV) +#include +#elif defined(MAJOR_IN_SYSMACROS) +#include +#endif #ifdef HAVE_DEVICE_MAPPER # include diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c index 10480b6..09e7e6e 100644 --- a/grub-core/osdep/linux/getroot.c +++ b/grub-core/osdep/linux/getroot.c @@ -35,6 +35,12 @@ #include #endif +#if defined(MAJOR_IN_MKDEV) +#include +#elif defined(MAJOR_IN_SYSMACROS) +#include +#endif + #include #include /* ioctl */ #include diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c index 1079a91..4bf37b0 100644 --- a/grub-core/osdep/unix/getroot.c +++ b/grub-core/osdep/unix/getroot.c @@ -51,8 +51,10 @@ #endif #include -#if defined(HAVE_SYS_MKDEV_H) +#if defined(MAJOR_IN_MKDEV) #include +#elif defined(MAJOR_IN_SYSMACROS) +#include #endif #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR) -- 2.8.1