aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-04-25 00:56:08 +0200
committerDamjan Marion <damarion@cisco.com>2018-04-25 00:56:16 +0200
commitde02414c3d74efd71cbc1594b19e07027191a3d0 (patch)
treebdbed81ae4c57912d8fa2a9447709c1d1fb9a562 /src
parent435f50021556a6be34de972605ed62cbaf3d739e (diff)
Fix sample-plugin build with newer clang versions
Change-Id: Id90e6fb1211b7789e6e3df0b6579c4757e7fdfa6 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/examples/sample-plugin/configure.ac20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/examples/sample-plugin/configure.ac b/src/examples/sample-plugin/configure.ac
index 204da2fe1de..588e7dd16b9 100644
--- a/src/examples/sample-plugin/configure.ac
+++ b/src/examples/sample-plugin/configure.ac
@@ -6,6 +6,26 @@ AC_PREFIX_DEFAULT([/usr])
AC_PROG_CC
+# Check if compiler supports specific flag
+AC_DEFUN([CC_CHECK_FLAG],
+[
+ AC_MSG_CHECKING([if $CC supports $1])
+ AC_LANG_PUSH([C])
+ ac_saved_cflags="$CFLAGS"
+ CFLAGS="-Werror $1"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+ [cc_flag_check=yes],
+ [cc_flag_check=no]
+)
+ AC_MSG_RESULT([$cc_flag_check])
+ CFLAGS="$ac_saved_cflags"
+ AC_LANG_POP([C])
+])
+
+CC_CHECK_FLAG("-Wno-address-of-packed-member")
+AS_IF([test "$cc_flag_check" = yes],
+ [CFLAGS="${CFLAGS} -Wno-address-of-packed-member"], [])
+
AC_OUTPUT([Makefile])
AC_CONFIG_MACRO_DIR([m4])