From 73049e5a9e3698cc6d51471d70ac5e06bed803cc Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 17 Dec 2022 10:24:48 -0800
Subject: [PATCH] configure: Add --with-cpu

Some cross build systems e.g. yocto may use architectures different from cross compiler target tuple
arm-yoe-gnueabi but build for armv7a, AC_CANONICAL_HOST will fail in
this case even though target will be armv7a it will detect it as arm and
disable armv7a specific optimization paths. This option provides the
needed knob so it can be set explicitly e.g. --with-cpu=armv7a etc. if needed.

Upstream-Status: Submitted [https://github.com/stressapptest/stressapptest/pull/100]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 configure.ac | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index c839c87..403728c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,7 +11,14 @@ else
   AC_MSG_NOTICE([Compiling with dynamically linked libraries.])
 fi
 
-AC_CANONICAL_HOST
+AC_ARG_WITH(cpu, [  --with-cpu            define host cpu])
+
+if test -z "$with_cpu"
+then
+  AC_CANONICAL_HOST
+else
+  host_cpu=$with_cpu
+fi
 # Checking for target cpu and setting custom configuration
 # for the different platforms
 AS_CASE(["$host_cpu"],
