[PATCH] configure.ac: use AC_HEADER_MAJOR to detect major()/minor()
Sergei Trofimovich
slyfox at gentoo.org
Mon Mar 13 10:40:05 UTC 2017
Before the change build failed on Gentoo as:
libweston/weston_launch-weston-launch.o: In function `handle_open':
weston/libweston/weston-launch.c:363: undefined reference to `major'
weston/libweston/weston-launch.c:365: undefined reference to `major'
weston/libweston/weston-launch.c:325: undefined reference to `major'
weston/libweston/weston-launch.c:326: undefined reference to `major'
libweston/weston_launch-weston-launch.o: In function `setup_tty':
weston/libweston/weston-launch.c:548: undefined reference to `major'
weston/libweston/weston-launch.c:548: undefined reference to `minor'
weston/libweston/weston-launch.c:555: undefined reference to `major'
weston/libweston/weston-launch.c:558: undefined reference to `minor'
libweston/weston_launch-weston-launch.o: In function `close_input_fds':
weston/libweston/weston-launch.c:451: undefined reference to `major'
glibc plans to remove <sys/sysmacros.h> from glibc's <sys/types.h>:
https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html
Gentoo already applied glibc patch to experimental glibc-2.24
to start preparingfor the change.
Autoconf has AC_HEADER_MAJOR to find out which header defines
reqiured macros:
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Particular-Headers.html
This change should also increase portability across other libcs.
Bug: https://bugs.gentoo.org/610652
Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
---
configure.ac | 1 +
libweston/launcher-direct.c | 8 ++++++++
libweston/launcher-logind.c | 8 ++++++++
libweston/launcher-weston-launch.c | 7 +++++++
libweston/weston-launch.c | 8 ++++++++
5 files changed, 32 insertions(+)
diff --git a/configure.ac b/configure.ac
index 9df85d20..b99e7fdd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,7 @@ AC_CONFIG_MACRO_DIR([m4])
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
+AC_HEADER_MAJOR
AM_INIT_AUTOMAKE([1.11 parallel-tests foreign no-dist-gzip dist-xz color-tests subdir-objects])
diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c
index 4195cf65..16bac5f4 100644
--- a/libweston/launcher-direct.c
+++ b/libweston/launcher-direct.c
@@ -46,6 +46,14 @@
#define KDSKBMUTE 0x4B51
#endif
+/* major()/minor() */
+#ifdef MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
+
#ifdef HAVE_LIBDRM
#include <xf86drm.h>
diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
index 8de1ed11..663cff28 100644
--- a/libweston/launcher-logind.c
+++ b/libweston/launcher-logind.c
@@ -44,6 +44,14 @@
#define DRM_MAJOR 226
+/* major()/minor() */
+#ifdef MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
+
struct launcher_logind {
struct weston_launcher base;
struct weston_compositor *compositor;
diff --git a/libweston/launcher-weston-launch.c b/libweston/launcher-weston-launch.c
index 930f4e0c..3f7dde50 100644
--- a/libweston/launcher-weston-launch.c
+++ b/libweston/launcher-weston-launch.c
@@ -74,6 +74,13 @@ drmSetMaster(int drm_fd)
#endif
+/* major()/minor() */
+#ifdef MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
union cmsg_data { unsigned char b[4]; int fd; };
diff --git a/libweston/weston-launch.c b/libweston/weston-launch.c
index 140fde1d..5fe0c4a9 100644
--- a/libweston/weston-launch.c
+++ b/libweston/weston-launch.c
@@ -92,6 +92,14 @@ drmSetMaster(int drm_fd)
#endif
+/* major()/minor() */
+#ifdef MAJOR_IN_MKDEV
+# include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+# include <sys/sysmacros.h>
+#endif
+
struct weston_launch {
struct pam_conv pc;
pam_handle_t *ph;
--
2.12.0
More information about the wayland-devel
mailing list