Received: from list by lists.gnu.org with archive (Exim 4.71) id 1arXry-0004EN-TT for mharc-grub-devel@gnu.org; Sat, 16 Apr 2016 17:35:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34005) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1arXrw-00049r-9C for grub-devel@gnu.org; Sat, 16 Apr 2016 17:35:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1arXrs-0005Jz-8u for grub-devel@gnu.org; Sat, 16 Apr 2016 17:35:08 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:40116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1arXrs-0005JP-2n for grub-devel@gnu.org; Sat, 16 Apr 2016 17:35:04 -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 25E23340B9E for ; Sat, 16 Apr 2016 21:35:02 +0000 (UTC) From: Mike Gilbert To: grub-devel@gnu.org Subject: [PATCH] build: Use AC_HEADER_MAJOR to find device macros Date: Sat, 16 Apr 2016 17:34:58 -0400 Message-Id: <1460842498-23914-1-git-send-email-floppym@gentoo.org> X-Mailer: git-send-email 2.8.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 140.211.166.183 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: Sat, 16 Apr 2016 21:35:09 -0000 Depending on the OS/libc, device macros may be found in 3 places: sys/types.h sys/mkdev.h sys/sysmacros.h glibc currenctly defines the major/minor/makedev macros in sys/sysmacros.h and includes this from sys/types.h. Based on mailing list discussion, this may be removed from sys/types.h in a future glibc release. --- 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