On NetBSD, clang (clang-3.5.0 from pkgsrc) complains
when "clang -g" is used for linking.  Specify -Qunused-arguments
to suppress the warning.

Signed-off-by: YAMAMOTO Takashi <yamam...@valinux.co.jp>
---
 acinclude.m4 | 10 +++++++++-
 configure.ac |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/acinclude.m4 b/acinclude.m4
index b09f2f2..718aa93 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -534,8 +534,16 @@ AC_DEFUN([_OVS_CHECK_CC_OPTION], [dnl
      dnl clang's GCC-compatible compiler driver does not return a failure
      dnl exit status even though it complains about options it does not
      dnl understand.
+     dnl
+     dnl Also, check stderr as gcc exits with status 0 for options
+     dnl rejected at getopt level.
+     dnl    % touch /tmp/a.c
+     dnl    % gcc -g -c -Werror -Qunused-arguments /tmp/a.c; echo $?
+     dnl    gcc: unrecognized option '-Qunused-arguments'
+     dnl    0
+     dnl    %
      CFLAGS="$CFLAGS $WERROR $1"
-     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)], [ovs_cv_name[]=yes], 
[ovs_cv_name[]=no])
+     AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,)], [if test -s conftest.err && grep 
"unrecognized option" conftest.err; then ovs_cv_name[]=no; else 
ovs_cv_name[]=yes; fi], [ovs_cv_name[]=no])
      CFLAGS="$ovs_save_CFLAGS"])
   if test $ovs_cv_name = yes; then
     m4_if([$2], [], [:], [$2])
diff --git a/configure.ac b/configure.ac
index 62d26b0..9615cb7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -155,6 +155,7 @@ OVS_ENABLE_OPTION([-Wmissing-prototypes])
 OVS_ENABLE_OPTION([-Wmissing-field-initializers])
 OVS_ENABLE_OPTION([-Wthread-safety])
 OVS_ENABLE_OPTION([-fno-strict-aliasing])
+OVS_ENABLE_OPTION([-Qunused-arguments])
 OVS_CONDITIONAL_CC_OPTION([-Wno-unused], [HAVE_WNO_UNUSED])
 OVS_CONDITIONAL_CC_OPTION([-Wno-unused-parameter], [HAVE_WNO_UNUSED_PARAMETER])
 OVS_ENABLE_WERROR
-- 
2.2.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to