summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-06-08 06:55:34 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-06-08 06:55:34 -0700
commit7008bf9175c57778894d72e751488968cdb3b180 (patch)
tree0a28a28b98b1daebe362bd4e0d261bafbe87b22e
parentb3facf205e0276268e5e277d30d18a79ff824aee (diff)
downloadtxr-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-xconfigure28
-rw-r--r--sysif.c3
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 <<!
-#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
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 <sys/types.h>
#endif
+#if HAVE_SYS_SYSMACROS_H
+#include <sys/sysmacros.h>
+#endif
#if HAVE_POLL
#include <poll.h>
#endif