[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] mountlist/ptsname_r: leverage AC_HEADER_MAJOR
From: |
Mike Frysinger |
Subject: |
[PATCH] mountlist/ptsname_r: leverage AC_HEADER_MAJOR |
Date: |
Sat, 16 Apr 2016 02:11:37 -0400 |
These two modules use makedev/major/minor but don't have explicit
checks for the functions. Use the existing autoconf macro which
will probe some headers for use and set up some defines.
* lib/mountlist.c [MAJOR_IN_MKDEV]: Include sys/mkdev.h.
[MAJOR_IN_SYSMACROS]: Include sys/sysmacros.h.
* lib/ptsname_r.c: Likewise.
[__sun]: Delete sys/sysmacros.h include.
[_AIX || __osf__]: Likewise.
* m4/mountlist.m4 (gl_MOUNTLIST): Require AC_HEADER_MAJOR.
* m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): Likewise.
---
Note: Untested :).
lib/mountlist.c | 7 +++++++
lib/ptsname_r.c | 12 ++++++++----
m4/mountlist.m4 | 1 +
m4/ptsname_r.m4 | 2 ++
4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/lib/mountlist.c b/lib/mountlist.c
index bb4e4ee..f3e7f22 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -37,6 +37,13 @@
# include <sys/param.h>
#endif
+#if MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+#endif
+#if MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
+
#if defined MOUNTED_GETFSSTAT /* OSF_1 and Darwin1.3.x */
# if HAVE_SYS_UCRED_H
# include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,
diff --git a/lib/ptsname_r.c b/lib/ptsname_r.c
index 14c36d6..b67270d 100644
--- a/lib/ptsname_r.c
+++ b/lib/ptsname_r.c
@@ -42,22 +42,26 @@
#endif
+/* Get the major, minor macros. */
+#if MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+#endif
+#if MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
+
#ifdef __sun
/* Get ioctl() and 'struct strioctl'. */
# include <stropts.h>
/* Get ISPTM. */
# include <sys/stream.h>
# include <sys/ptms.h>
-/* Get the major, minor macros. */
-# include <sys/sysmacros.h>
# include <stdio.h>
#endif
#if defined _AIX || defined __osf__
/* Get ioctl(), ISPTM. */
# include <sys/ioctl.h>
-/* Get the major, minor macros. */
-# include <sys/sysmacros.h>
# include <stdio.h>
#endif
diff --git a/m4/mountlist.m4 b/m4/mountlist.m4
index 2e2ca37..24f49b8 100644
--- a/m4/mountlist.m4
+++ b/m4/mountlist.m4
@@ -6,6 +6,7 @@ dnl with or without modifications, as long as this notice is
preserved.
AC_DEFUN([gl_MOUNTLIST],
[
+ AC_REQUIRE([AC_HEADER_MAJOR])
gl_LIST_MOUNTED_FILE_SYSTEMS([gl_cv_list_mounted_fs=yes],
[gl_cv_list_mounted_fs=no])
])
diff --git a/m4/ptsname_r.m4 b/m4/ptsname_r.m4
index 4ddde81..d71cac4 100644
--- a/m4/ptsname_r.m4
+++ b/m4/ptsname_r.m4
@@ -42,6 +42,8 @@ AC_DEFUN([gl_FUNC_PTSNAME_R],
REPLACE_PTSNAME_R=1
fi
fi
+
+ AC_REQUIRE([AC_HEADER_MAJOR])
])
# Prerequisites of lib/ptsname.c.
--
2.7.4
- [PATCH] mountlist/ptsname_r: leverage AC_HEADER_MAJOR,
Mike Frysinger <=