summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-12-18 10:02:58 +0200
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-12-19 09:56:27 +0200
commit14a7e371f57fd8dbdddb869296cdb686f4a0e9bc (patch)
tree62ce044936d2ef3fcdad7bd0dfa9cdeb014042c7
parent8a9c8b08cf7b1bf911af181580b7045cb65af5df (diff)
configure: fix sys/sysmacros.h check
This patch is a copy of https://cgit.freedesktop.org/mesa/drm/commit/?id=7040fea0280bad527ed4b3d5eee7d7bfbf303efc 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 https://lists.gnu.org/archive/html/autoconf/2016-09/msg00013.html 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@redhat.com> Cc: Emil Velikov <emil.l.velikov@gmail.com> Cc: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
-rw-r--r--configure.ac4
1 files changed, 4 insertions, 0 deletions
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])
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
+
+save_CFLAGS="$CFLAGS"
+export CFLAGS="$CFLAGS -Werror"
AC_HEADER_MAJOR
+CFLAGS="$save_CFLAGS"
AM_INIT_AUTOMAKE([1.11 parallel-tests foreign no-dist-gzip dist-xz color-tests subdir-objects])