kiss-repository

my personal repository for the KISS package manager
git clone git://git.ckyln.com/kiss-repository.git
Log | Files | Refs | README | LICENSE

fix-major-undefined.patch (2974B)


      1 From c121a8de96ce06595ab13cad386f1f01e732f590 Mon Sep 17 00:00:00 2001
      2 From: =?UTF-8?q?Kang-Che=20Sung=20=28=E5=AE=8B=E5=B2=A1=E5=93=B2=29?=
      3  <Explorer09@gmail.com>
      4 Date: Mon, 26 Feb 2018 21:15:05 +0800
      5 Subject: [PATCH] Fix build failure ('major' undefined) in glibc 2.28. (#746)
      6 
      7 glibc 2.28 no longer defines 'major' and 'minor' in <sys/types.h> and
      8 requires us to include <sys/sysmacros.h>. (glibc 2.25 starts
      9 deprecating the macros in <sys/types.h>.) Now do include the latter if
     10 found on the system.
     11 
     12 At the moment, let's also utilize AC_HEADER_MAJOR in configure script.
     13 However as Autoconf 2.69 has not yet updated the AC_HEADER_MAJOR macro
     14 to reflect the glibc change [1], so add a workaround code.
     15 
     16 Fixes #663. Supersedes pull request #729.
     17 
     18 Reference:
     19 [1] https://git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commit;h=e17a30e987d7ee695fb4294a82d987ec3dc9b974
     20 
     21 Signed-off-by: Kang-Che Sung <explorer09@gmail.com>
     22 ---
     23  Process.c                |  6 ++++++
     24  configure.ac             | 10 ++++++++++
     25  linux/LinuxProcessList.c |  6 ++++++
     26  3 files changed, 22 insertions(+)
     27 
     28 diff --git a/Process.c b/Process.c
     29 index 18360802..5ec46bc4 100644
     30 --- a/Process.c
     31 +++ b/Process.c
     32 @@ -28,6 +28,12 @@ in the source distribution for its full text.
     33  #include <time.h>
     34  #include <assert.h>
     35  #include <math.h>
     36 +#ifdef MAJOR_IN_MKDEV
     37 +#include <sys/mkdev.h>
     38 +#elif defined(MAJOR_IN_SYSMACROS) || \
     39 +   (defined(HAVE_SYS_SYSMACROS_H) && HAVE_SYS_SYSMACROS_H)
     40 +#include <sys/sysmacros.h>
     41 +#endif
     42  
     43  #ifdef __ANDROID__
     44  #define SYS_ioprio_get __NR_ioprio_get
     45 diff --git a/configure.ac b/configure.ac
     46 index df922e07..481c3f0b 100644
     47 --- a/configure.ac
     48 +++ b/configure.ac
     49 @@ -61,6 +61,16 @@ AC_CHECK_HEADERS([stdlib.h string.h strings.h sys/param.h sys/time.h unistd.h],[
     50  ])
     51  AC_CHECK_HEADERS([execinfo.h],[:],[:])
     52  
     53 +AC_HEADER_MAJOR
     54 +dnl glibc 2.25 deprecates 'major' and 'minor' in <sys/types.h> and requires to
     55 +dnl include <sys/sysmacros.h>. However the logic in AC_HEADER_MAJOR has not yet
     56 +dnl been updated in Autoconf 2.69, so use a workaround:
     57 +m4_version_prereq([2.70], [],
     58 +[if test $ac_cv_header_sys_mkdev_h = no; then
     59 +   AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS, 1,
     60 +      [Define to 1 if `major', `minor', and `makedev' are declared in <sys/sysmacros.h>.])])
     61 +fi])
     62 +
     63  # Checks for typedefs, structures, and compiler characteristics.
     64  # ----------------------------------------------------------------------
     65  AC_HEADER_STDBOOL
     66 diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
     67 index 6f2631af..77c12262 100644
     68 --- a/linux/LinuxProcessList.c
     69 +++ b/linux/LinuxProcessList.c
     70 @@ -26,6 +26,12 @@ in the source distribution for its full text.
     71  #include <assert.h>
     72  #include <sys/types.h>
     73  #include <fcntl.h>
     74 +#ifdef MAJOR_IN_MKDEV
     75 +#include <sys/mkdev.h>
     76 +#elif defined(MAJOR_IN_SYSMACROS) || \
     77 +   (defined(HAVE_SYS_SYSMACROS_H) && HAVE_SYS_SYSMACROS_H)
     78 +#include <sys/sysmacros.h>
     79 +#endif
     80  
     81  #ifdef HAVE_DELAYACCT
     82  #include <netlink/attr.h>