changeset 38212:0a8727662e3d

ptsname_r: leverage AC_HEADER_MAJOR Like the mountlist module, ptsname_r uses makedev/major/minor, so 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): Depend on AC_HEADER_MAJOR.
author Mike Frysinger <vapier@gentoo.org>
date Sat, 26 Nov 2016 22:52:00 -0500
parents ed6e125ecb76
children 61088a5dbe9a
files ChangeLog lib/ptsname_r.c m4/ptsname_r.m4
diffstat 3 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Nov 27 00:23:14 2016 +0000
+++ b/ChangeLog	Sat Nov 26 22:52:00 2016 -0500
@@ -1,3 +1,11 @@
+2016-11-27  Mike Frysinger  <vapier@gentoo.org>
+
+	ptsname_r: leverage AC_HEADER_MAJOR to provide major()
+	* lib/ptsname_r.c: Include the appropriate headers.
+	[__sun]: Delete sys/sysmacros.h include.
+	[_AIX || __osf__]: Likewise.
+	* m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): Depend on AC_HEADER_MAJOR.
+
 2016-11-27  Pádraig Brady  <P@draigBrady.com>
 
 	md4,md5,sha*: allow _STRING_INLINE_unaligned enable unaligned operation
--- a/lib/ptsname_r.c	Sun Nov 27 00:23:14 2016 +0000
+++ b/lib/ptsname_r.c	Sat Nov 26 22:52:00 2016 -0500
@@ -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
 
--- a/m4/ptsname_r.m4	Sun Nov 27 00:23:14 2016 +0000
+++ b/m4/ptsname_r.m4	Sat Nov 26 22:52:00 2016 -0500
@@ -42,6 +42,8 @@
       REPLACE_PTSNAME_R=1
     fi
   fi
+
+  AC_REQUIRE([AC_HEADER_MAJOR])
 ])
 
 # Prerequisites of lib/ptsname.c.