From 209509f6e73e53798128d57f97e7099a203cf6ad Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 8 Jun 2018 06:55:34 -0700 Subject: sysif: work around glibc warnings about makedev macros. The GNU C library is deprecating the practice of defining the makedev, major and minor macros. A loud, multi-line warning is issued for programs which include this header and then use the macros. The new way is to rely on the header instead. Of course, that might not exist. * configure (have_makedev): New variable. Upgrade the makedev test to try it with first, then fall back on . A new config macro HAVE_SYS_SYSMACROS_H is created in config.h if sysmacros exists. * sysif.c: If config.h defines HAVE_SYS_SYSMACROS_H to a nonzero value, then include . --- configure | 28 +++++++++++++++++++++------- sysif.c | 3 +++ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/configure b/configure index 1076887c..bf17637d 100755 --- a/configure +++ b/configure @@ -128,6 +128,7 @@ have_dbl_decimal_dig= have_unistd= have_sys_types= have_sys_time= +have_makedev= have_syslog= have_glob= have_ftw= @@ -2006,8 +2007,9 @@ fi printf "Checking for makedev ... " -cat > conftest.c < +for try_header in sysmacros types ; do + cat > conftest.c < int main(void) { @@ -2017,11 +2019,23 @@ int main(void) return 0; } ! -if conftest ; then - printf "yes\n" - printf "#define HAVE_MAKEDEV 1\n" >> config.h - have_sys_types=y -else + if conftest ; then + printf "yes\n" + printf "#define HAVE_MAKEDEV 1\n" >> config.h + case $try_header in + sysmacros ) + printf "#define HAVE_SYS_SYSMACROS_H 1\n" >> config.h + ;; + types ) + have_sys_types=y + ;; + esac + have_makedev=y + break + fi +done + +if [ -z "$have_makedev" ] ; then printf "no\n" fi diff --git a/sysif.c b/sysif.c index 8111d4f5..1020f075 100644 --- a/sysif.c +++ b/sysif.c @@ -53,6 +53,9 @@ #if HAVE_SYS_TYPES_H #include #endif +#if HAVE_SYS_SYSMACROS_H +#include +#endif #if HAVE_POLL #include #endif -- cgit v1.2.3