NetworkManager/0001-build-fix-configure-check-for-CC-support-of-_Generic.patch
Lubomir Rintel 8b792ad0ef Fix build
2018-02-06 17:30:36 +01:00

49 lines
2.0 KiB
Diff

From 640673f75ba4bcc40989b3bf1c03738b562ea2fc Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Sun, 28 Jan 2018 08:51:25 +0100
Subject: [PATCH 1/2] build: fix configure check for CC support of _Generic()
and __auto_type
autotools' AC_LANG_PROGRAM() generates a main() function which triggers
a compiler warning (for which we fail with -WError).
conftest.c:92:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
main ()
^~~~
cc1: all warnings being treated as errors
Fixes: 557d83bf2ddf832828a9b85ffffcad0b7d88272a
(cherry picked from commit a43bf33888a639671bb7b7c7d37f416f1ef8dd79)
---
configure.ac | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index e263738f5..ab2ded77b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1224,16 +1224,16 @@ fi
AC_SUBST(SANITIZERS, [$sanitizers])
AC_MSG_CHECKING([CC support C11 _Generic()])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(void); int foo() { int a = 0; int b = _Generic (a, int: 4); return b + a; }]],
- [[foo();]])],
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int foo(void); int foo() { int a = 0; int b = _Generic (a, int: 4); return b + a; }]],
+ [[foo();]])],
[cc_support_generic=1],
[cc_support_generic=0])
AC_MSG_RESULT($cc_support_generic)
AC_DEFINE_UNQUOTED(_NM_CC_SUPPORT_GENERIC, $cc_support_generic, [Define whether the compiler supports C11 _Generic()])
AC_MSG_CHECKING([CC support gcc __auto_type])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[int foo(void); int foo() { int a = 0; __auto_type b = a; return b + a; }]],
- [[foo();]])],
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int foo(void); int foo() { int a = 0; __auto_type b = a; return b + a; }]],
+ [[foo();]])],
[cc_support_auto_type=1],
[cc_support_auto_type=0])
AC_MSG_RESULT($cc_support_auto_type)
--
2.14.3