Enable -static-openmp for newer NDK support

Android NDKs >= r21 need the '-static-openmp' flag enabled when using openmp.
The check on the NDK version is performed by querying the compiler binary's clang version.
NDK versions <= r20 use clang 8 and below. Versions >= r21 use clang 9 and above

Resolves: COMPMID-5052

Signed-off-by: Giorgio Arena <giorgio.arena@arm.com>
Change-Id: I910f8d7a0a59866c06b16c1a856ea877bcbd7ad6
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/7344
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Gunes Bayir <gunes.bayir@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
(cherry picked from commit 444b43a55bab37fa6dc8628c6283e54e422db3ad)
diff --git a/tests/SConscript b/tests/SConscript
index 005699e..cfe3bc5 100644
--- a/tests/SConscript
+++ b/tests/SConscript
@@ -21,7 +21,6 @@
 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
-import SCons
 import os.path
 
 Import('env')
@@ -174,8 +173,11 @@
     bm_link_flags += ['-Wl,--build-id=none', '-T', env['linker_script']]
 
 if test_env['reference_openmp'] and env['os'] not in ['bare_metal', 'macos']:
-   test_env['CXXFLAGS'].append('-fopenmp')
-   test_env['LINKFLAGS'].append('-fopenmp')
+    test_env['CXXFLAGS'].append('-fopenmp')
+    test_env['LINKFLAGS'].append('-fopenmp')
+
+    if 'ndk_above_r21' in env:
+        test_env['LINKFLAGS'].append('-static-openmp')
 
 if test_env['validation_tests']:
     arm_compute_validation_framework = env.StaticLibrary('arm_compute_validation_framework', Glob('validation/reference/*.cpp') + Glob('validation/*.cpp'), LINKFLAGS=test_env['LINKFLAGS'], CXXFLAGS=test_env['CXXFLAGS'], LIBS= [ arm_compute_test_framework, arm_compute_core_a])