aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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])