When building using an older compiler that doesn't support avx512,
we are adding '-mno-avx512f' into the command line, which results
with a build failure:

  gcc: error: unrecognized command line option '-mno-avx512f'

This is a case, for example, while trying to build OVS with GCC 4.8.

Fix that by avoiding binutils check when compiler doesn't understand
-mavx512f.

Later in the call chain there is also an explicit check for -mavx512f
support, but it will just use the cached result, so it's not a problem.

Fixes: 930f135f5ddc ("configure: explicitly disable avx512 if bintuils check 
fails")
Signed-off-by: Ilya Maximets <[email protected]>
---
 m4/openvswitch.m4 | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/m4/openvswitch.m4 b/m4/openvswitch.m4
index 6d41ffc44..060070475 100644
--- a/m4/openvswitch.m4
+++ b/m4/openvswitch.m4
@@ -475,7 +475,9 @@ dnl The checking of binutils funcationality instead of LD 
version is similar
 dnl to as how DPDK proposes to solve this issue:
 dnl   http://patches.dpdk.org/patch/71723/
 AC_DEFUN([OVS_CHECK_BINUTILS_AVX512],
-  [AC_CACHE_CHECK(
+  [OVS_CHECK_CC_OPTION(
+   [-mavx512f],
+   [AC_CACHE_CHECK(
     [binutils avx512 assembler checks passing],
     [ovs_cv_binutils_avx512_good],
     [dnl Assemble a short snippet to test for issue in "build-aux" dir:
@@ -496,7 +498,8 @@ AC_DEFUN([OVS_CHECK_BINUTILS_AVX512],
      else
        dnl non x86_64 architectures don't have avx512, so not affected
        ovs_cv_binutils_avx512_good=no
-     fi])
+     fi])],
+    [ovs_cv_binutils_avx512_good=no])
    if test "$ovs_cv_binutils_avx512_good" = yes; then
      AC_DEFINE([HAVE_LD_AVX512_GOOD], [1],
                [Define to 1 if binutils correctly supports AVX512.])
-- 
2.51.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to