[PATCH weston] configure: fix sys/sysmacros.h check

Pekka Paalanen ppaalanen at gmail.com
Mon Dec 18 08:24:20 UTC 2017

From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

This patch is a copy of
by Adam Jackson.

Commit 43c5a65b034a243700cf9c5bfbe6bcefb15f1161 "configure.ac: use
AC_HEADER_MAJOR to detect major()/minor()" started using AC_HEADER_MAJOR
to detect the header where major() is defined. This caused a regression
on systems where glibc is still providing a deprecated definition of
major() through sys/types.h, leading to a bunch of compiler warnings:

/home/pq/git/weston/libweston/launcher-logind.c: In function ‘launcher_logind_open’:
/home/pq/git/weston/libweston/launcher-logind.c:182:13: warning: In the GNU C Library, "major" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "major", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "major", you should undefine it after including <sys/types.h>.
  fd = launcher_logind_take_device(wl, major(st.st_rdev),

The issue has been discussed earlier on

Work around the issue by causing the warning to trigger a build failure
inside AC_HEADER_MAJOR test, so that we get MAJOR_IN_SYSMACROS defined.

Cc: Adam Jackson <ajax at redhat.com>
Cc: Emil Velikov <emil.l.velikov at gmail.com>
Cc: Sergei Trofimovich <slyfox at gentoo.org>
Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
 configure.ac | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/configure.ac b/configure.ac
index d1b5f471..285c2efd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,7 +34,11 @@ AC_CONFIG_MACRO_DIR([m4])
+export CFLAGS="$CFLAGS -Werror"
 AM_INIT_AUTOMAKE([1.11 parallel-tests foreign no-dist-gzip dist-xz color-tests subdir-objects])

More information about the wayland-devel mailing list