diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-06-08 06:55:34 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-06-08 06:55:34 -0700 |
commit | 7008bf9175c57778894d72e751488968cdb3b180 (patch) | |
tree | 0a28a28b98b1daebe362bd4e0d261bafbe87b22e | |
parent | b3facf205e0276268e5e277d30d18a79ff824aee (diff) | |
download | txr-7008bf9175c57778894d72e751488968cdb3b180.tar.gz txr-7008bf9175c57778894d72e751488968cdb3b180.tar.bz2 txr-7008bf9175c57778894d72e751488968cdb3b180.zip |
sysif: work around glibc warnings about makedev macros.
The GNU C library is deprecating the practice of <sys/types.h>
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 <sys/sysmacros.h> header instead. Of course, that might
not exist.
* configure (have_makedev): New variable. Upgrade the makedev
test to try it with <sys/sysmacros.h> first, then fall back
on <sys/types.h>. 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 <sys/sysmacros.h>.
-rwxr-xr-x | configure | 28 | ||||
-rw-r--r-- | sysif.c | 3 |
2 files changed, 24 insertions, 7 deletions
@@ -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 <<! -#include <sys/types.h> +for try_header in sysmacros types ; do + cat > conftest.c <<! +#include <sys/${try_header}.h> 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 @@ -53,6 +53,9 @@ #if HAVE_SYS_TYPES_H #include <sys/types.h> #endif +#if HAVE_SYS_SYSMACROS_H +#include <sys/sysmacros.h> +#endif #if HAVE_POLL #include <poll.h> #endif |