summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2016-10-20 04:44:50 +0000
committerMartin Jansa <Martin.Jansa@gmail.com>2016-11-26 01:04:53 +0100
commitc5fd46f74a5b4f1af67b18493b9de31666e13dcf (patch)
treef750ee224a72269c97f09f9b57c94a846ebdf50b /meta-oe
parentd361ef01a9a61cd8a83f7728f7d3e9f118233cb8 (diff)
downloadmeta-openembedded-c5fd46f74a5b4f1af67b18493b9de31666e13dcf.tar.gz
libqmi: Fix build with clang
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/recipes-connectivity/libqmi/libqmi/0001-Detect-clang.patch84
-rw-r--r--meta-oe/recipes-connectivity/libqmi/libqmi_1.16.0.bb4
2 files changed, 87 insertions, 1 deletions
diff --git a/meta-oe/recipes-connectivity/libqmi/libqmi/0001-Detect-clang.patch b/meta-oe/recipes-connectivity/libqmi/libqmi/0001-Detect-clang.patch
new file mode 100644
index 000000000..4047ffbf2
--- /dev/null
+++ b/meta-oe/recipes-connectivity/libqmi/libqmi/0001-Detect-clang.patch
@@ -0,0 +1,84 @@
1From 4cfb728804157e8f3c69e11ba4df449d8f76388f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 20 Oct 2016 04:42:26 +0000
4Subject: [PATCH] Detect clang
5
6Check for clang compiler since we need to disable
7unused-function warning for clang, at same time
8pass werror when checking for compiler options if
9werror is enabled so spurious options do not get
10enabled. Only the ones that are supported by given
11compiler are accepted.
12
13Signed-off-by: Khem Raj <raj.khem@gmail.com>
14Upstream-Status: Pending
15---
16 m4/compiler-warnings.m4 | 29 +++++++++++++++++++++++++----
17 1 file changed, 25 insertions(+), 4 deletions(-)
18
19diff --git a/m4/compiler-warnings.m4 b/m4/compiler-warnings.m4
20index de4a8b0..e4ba718 100644
21--- a/m4/compiler-warnings.m4
22+++ b/m4/compiler-warnings.m4
23@@ -2,10 +2,30 @@ AC_DEFUN([LIBQMI_COMPILER_WARNINGS],
24 [AC_ARG_ENABLE(more-warnings,
25 AS_HELP_STRING([--enable-more-warnings], [Possible values: no/yes/error]),
26 set_more_warnings="$enableval",set_more_warnings=error)
27+
28+# Clang throws a lot of warnings when it does not understand a flag. Disable
29+# this warning for now so other warnings are visible.
30+AC_MSG_CHECKING([if compiling with clang])
31+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
32+#ifndef __clang__
33+ not clang
34+#endif
35+ ]])],
36+ [CLANG=yes],
37+ [CLANG=no]
38+)
39+AC_MSG_RESULT([$CLANG])
40+AS_IF([test "x$CLANG" = "xyes"], [CLANG_FLAGS=-Wno-error=unused-function])
41+CFLAGS="$CFLAGS $CLANG_FLAGS"
42+LDFLAGS="$LDFLAGS $CLANG_FLAGS"
43+
44 AC_MSG_CHECKING(for more warnings)
45 if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
46 AC_MSG_RESULT(yes)
47 CFLAGS="-Wall -std=gnu89 $CFLAGS"
48+ if test "x$set_more_warnings" = xerror; then
49+ WERROR="-Werror"
50+ fi
51
52 for option in -Wmissing-declarations -Wmissing-prototypes \
53 -Wdeclaration-after-statement -Wstrict-prototypes \
54@@ -17,22 +37,23 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
55 -Wmissing-include-dirs -Waggregate-return \
56 -Wformat-security; do
57 SAVE_CFLAGS="$CFLAGS"
58- CFLAGS="$CFLAGS $option"
59+ CFLAGS="$CFLAGS $option $WERROR"
60 AC_MSG_CHECKING([whether gcc understands $option])
61 AC_TRY_COMPILE([], [],
62 has_option=yes,
63 has_option=no,)
64 if test $has_option = no; then
65 CFLAGS="$SAVE_CFLAGS"
66+ else
67+ CFLAGS="$SAVE_CFLAGS $option"
68 fi
69 AC_MSG_RESULT($has_option)
70 unset has_option
71 unset SAVE_CFLAGS
72 done
73+ CFLAGS="$CFLAGS $WERROR"
74 unset option
75- if test "x$set_more_warnings" = xerror; then
76- CFLAGS="$CFLAGS -Werror"
77- fi
78+ unset WERROR
79 else
80 AC_MSG_RESULT(no)
81 fi
82--
831.9.1
84
diff --git a/meta-oe/recipes-connectivity/libqmi/libqmi_1.16.0.bb b/meta-oe/recipes-connectivity/libqmi/libqmi_1.16.0.bb
index 5ac889f63..679b102d9 100644
--- a/meta-oe/recipes-connectivity/libqmi/libqmi_1.16.0.bb
+++ b/meta-oe/recipes-connectivity/libqmi/libqmi_1.16.0.bb
@@ -11,6 +11,8 @@ DEPENDS = "glib-2.0 libgudev libmbim"
11 11
12inherit autotools pkgconfig bash-completion 12inherit autotools pkgconfig bash-completion
13 13
14SRC_URI = "http://www.freedesktop.org/software/${BPN}/${BPN}-${PV}.tar.xz" 14SRC_URI = "http://www.freedesktop.org/software/${BPN}/${BPN}-${PV}.tar.xz \
15 file://0001-Detect-clang.patch \
16 "
15SRC_URI[md5sum] = "4970c110f160b33637a3515004c637b2" 17SRC_URI[md5sum] = "4970c110f160b33637a3515004c637b2"
16SRC_URI[sha256sum] = "7ab6bb47fd23bf4d3fa17424e40ea5552d08b19e5ee4f125f21f316c8086ba2a" 18SRC_URI[sha256sum] = "7ab6bb47fd23bf4d3fa17424e40ea5552d08b19e5ee4f125f21f316c8086ba2a"