From cf6f265069d60f2937c294035d8ab4c2b77b057a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Tue, 31 May 2016 08:33:10 +0200 Subject: [PATCH] Switch to using the standard autoconf AC_HEADER_MAJOR macro Switch to the standard autoconf AC_HEADER_MAJOR macro which takes care of the ugly details like when to use mkdev.h and when to use sysmacros.h. (requires to be included) Also include these in all files that use major/minor/makedev funcs. (Contributed by Mike Frysinger) --- configure.ac | 5 +++-- libfuse-lite/fuse_lowlevel.c | 10 +++++++--- libntfs-3g/dir.c | 10 +++++----- libntfs-3g/ioctl.c | 6 ++++++ src/lowntfs-3g.c | 5 ++++- src/ntfs-3g.c | 5 ++++- 6 files changed, 29 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 644ae00a..1f96263e 100644 --- a/configure.ac +++ b/configure.ac @@ -473,12 +473,13 @@ fi # Checks for header files. AC_HEADER_STDC +AC_HEADER_MAJOR AC_CHECK_HEADERS([ctype.h fcntl.h libgen.h libintl.h limits.h locale.h \ mntent.h stddef.h stdint.h stdlib.h stdio.h stdarg.h string.h \ strings.h errno.h time.h unistd.h utime.h wchar.h getopt.h features.h \ regex.h endian.h byteswap.h sys/byteorder.h sys/disk.h sys/endian.h \ - sys/param.h sys/ioctl.h sys/mkdev.h sys/mount.h sys/stat.h sys/types.h \ - sys/vfs.h sys/statvfs.h sys/sysmacros.h linux/major.h linux/fd.h \ + sys/param.h sys/ioctl.h sys/mount.h sys/stat.h sys/types.h \ + sys/vfs.h sys/statvfs.h linux/major.h linux/fd.h \ linux/fs.h inttypes.h linux/hdreg.h \ machine/endian.h windows.h syslog.h pwd.h malloc.h]) diff --git a/libfuse-lite/fuse_lowlevel.c b/libfuse-lite/fuse_lowlevel.c index e9d7d7ac..7dfcb646 100644 --- a/libfuse-lite/fuse_lowlevel.c +++ b/libfuse-lite/fuse_lowlevel.c @@ -22,11 +22,15 @@ #include #include -#if defined(__sun) && defined (__SVR4) -#ifdef HAVE_SYS_MKDEV_H +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef MAJOR_IN_MKDEV #include #endif -#endif /* defined(__sun) && defined (__SVR4) */ +#ifdef MAJOR_IN_SYSMACROS +#include +#endif #define PARAM(inarg) (((const char *)(inarg)) + sizeof(*(inarg))) #define OFFSET_MAX 0x7fffffffffffffffLL diff --git a/libntfs-3g/dir.c b/libntfs-3g/dir.c index b9f73aad..ce69eaf3 100644 --- a/libntfs-3g/dir.c +++ b/libntfs-3g/dir.c @@ -40,15 +40,15 @@ #include #endif -#if defined(__sun) && defined (__SVR4) -#ifdef HAVE_SYS_MKDEV_H +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef MAJOR_IN_MKDEV #include #endif -#else /* defined(__sun) && defined (__SVR4) */ -#ifdef HAVE_SYS_SYSMACROS_H +#ifdef MAJOR_IN_SYSMACROS #include #endif -#endif /* defined(__sun) && defined (__SVR4) */ #include "param.h" #include "types.h" diff --git a/libntfs-3g/ioctl.c b/libntfs-3g/ioctl.c index c350164b..28532b2d 100644 --- a/libntfs-3g/ioctl.c +++ b/libntfs-3g/ioctl.c @@ -57,6 +57,12 @@ #ifdef HAVE_SYS_TYPES_H #include #endif +#ifdef MAJOR_IN_MKDEV +#include +#endif +#ifdef MAJOR_IN_SYSMACROS +#include +#endif #ifdef HAVE_SYS_STAT_H #include diff --git a/src/lowntfs-3g.c b/src/lowntfs-3g.c index 5439b100..08529a43 100644 --- a/src/lowntfs-3g.c +++ b/src/lowntfs-3g.c @@ -73,9 +73,12 @@ #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef HAVE_SYS_MKDEV_H +#ifdef MAJOR_IN_MKDEV #include #endif +#ifdef MAJOR_IN_SYSMACROS +#include +#endif #if defined(__APPLE__) || defined(__DARWIN__) #include diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c index 6b25f036..640cfc44 100644 --- a/src/ntfs-3g.c +++ b/src/ntfs-3g.c @@ -72,9 +72,12 @@ #ifdef HAVE_SYS_TYPES_H #include #endif -#ifdef HAVE_SYS_MKDEV_H +#ifdef MAJOR_IN_MKDEV #include #endif +#ifdef MAJOR_IN_SYSMACROS +#include +#endif #if defined(__APPLE__) || defined(__DARWIN__) #include