2.02_beta3-sysmacros.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. From 7a5b301e3adb8e054288518a325135a1883c1c6c Mon Sep 17 00:00:00 2001
  2. From: Mike Gilbert <floppym@gentoo.org>
  3. Date: Tue, 19 Apr 2016 14:27:22 -0400
  4. Subject: [PATCH] build: Use AC_HEADER_MAJOR to find device macros
  5. Depending on the OS/libc, device macros are defined in different
  6. headers. This change ensures we include the right one.
  7. sys/types.h - BSD
  8. sys/mkdev.h - Sun
  9. sys/sysmacros.h - glibc (Linux)
  10. glibc currently pulls sys/sysmacros.h into sys/types.h, but this may
  11. change in a future release.
  12. https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html
  13. ---
  14. configure.ac | 3 ++-
  15. grub-core/osdep/devmapper/getroot.c | 6 ++++++
  16. grub-core/osdep/devmapper/hostdisk.c | 5 +++++
  17. grub-core/osdep/linux/getroot.c | 6 ++++++
  18. grub-core/osdep/unix/getroot.c | 4 +++-
  19. 5 files changed, 22 insertions(+), 2 deletions(-)
  20. diff --git a/configure.ac b/configure.ac
  21. index 57e1713..9ddfc53 100644
  22. --- a/configure.ac
  23. +++ b/configure.ac
  24. @@ -388,7 +388,8 @@ fi
  25. # Check for functions and headers.
  26. AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
  27. -AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h sys/mkdev.h limits.h)
  28. +AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h limits.h)
  29. +AC_HEADER_MAJOR
  30. AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
  31. #include <sys/param.h>
  32. diff --git a/grub-core/osdep/devmapper/getroot.c b/grub-core/osdep/devmapper/getroot.c
  33. index 05eda50..72e5582 100644
  34. --- a/grub-core/osdep/devmapper/getroot.c
  35. +++ b/grub-core/osdep/devmapper/getroot.c
  36. @@ -40,6 +40,12 @@
  37. #include <limits.h>
  38. #endif
  39. +#if defined(MAJOR_IN_MKDEV)
  40. +#include <sys/mkdev.h>
  41. +#elif defined(MAJOR_IN_SYSMACROS)
  42. +#include <sys/sysmacros.h>
  43. +#endif
  44. +
  45. #include <libdevmapper.h>
  46. #include <grub/types.h>
  47. diff --git a/grub-core/osdep/devmapper/hostdisk.c b/grub-core/osdep/devmapper/hostdisk.c
  48. index 19c1101..a697bcb 100644
  49. --- a/grub-core/osdep/devmapper/hostdisk.c
  50. +++ b/grub-core/osdep/devmapper/hostdisk.c
  51. @@ -24,6 +24,11 @@
  52. #include <errno.h>
  53. #include <limits.h>
  54. +#if defined(MAJOR_IN_MKDEV)
  55. +#include <sys/mkdev.h>
  56. +#elif defined(MAJOR_IN_SYSMACROS)
  57. +#include <sys/sysmacros.h>
  58. +#endif
  59. #ifdef HAVE_DEVICE_MAPPER
  60. # include <libdevmapper.h>
  61. diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
  62. index 10480b6..09e7e6e 100644
  63. --- a/grub-core/osdep/linux/getroot.c
  64. +++ b/grub-core/osdep/linux/getroot.c
  65. @@ -35,6 +35,12 @@
  66. #include <limits.h>
  67. #endif
  68. +#if defined(MAJOR_IN_MKDEV)
  69. +#include <sys/mkdev.h>
  70. +#elif defined(MAJOR_IN_SYSMACROS)
  71. +#include <sys/sysmacros.h>
  72. +#endif
  73. +
  74. #include <grub/types.h>
  75. #include <sys/ioctl.h> /* ioctl */
  76. #include <sys/mount.h>
  77. diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c
  78. index 1079a91..4bf37b0 100644
  79. --- a/grub-core/osdep/unix/getroot.c
  80. +++ b/grub-core/osdep/unix/getroot.c
  81. @@ -51,8 +51,10 @@
  82. #endif
  83. #include <sys/types.h>
  84. -#if defined(HAVE_SYS_MKDEV_H)
  85. +#if defined(MAJOR_IN_MKDEV)
  86. #include <sys/mkdev.h>
  87. +#elif defined(MAJOR_IN_SYSMACROS)
  88. +#include <sys/sysmacros.h>
  89. #endif
  90. #if defined(HAVE_LIBZFS) && defined(HAVE_LIBNVPAIR)
  91. --
  92. 2.8.1