bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2] ptsname_r: leverage AC_HEADER_MAJOR


From: Mike Frysinger
Subject: [PATCH v2] ptsname_r: leverage AC_HEADER_MAJOR
Date: Sat, 26 Nov 2016 22:52:00 -0500

The mountlist module changes were merged independently since my v1,
but the ptsname module still hasn't been updated.

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/ptsname_r.c: Likewise.
[__sun]: Delete sys/sysmacros.h include.
[_AIX || __osf__]: Likewise.
* m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): Likewise.
---
 lib/ptsname_r.c | 12 ++++++++----
 m4/ptsname_r.m4 |  2 ++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/lib/ptsname_r.c b/lib/ptsname_r.c
index f4887bc97fb9..e0c634e20f7c 100644
--- a/lib/ptsname_r.c
+++ b/lib/ptsname_r.c
@@ -47,22 +47,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/ptsname_r.m4 b/m4/ptsname_r.m4
index 4ddde81ee487..d71cac422aff 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.11.0.rc2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]