Introduce a configure() method into client/common_lib/util.py which does some extra env var look up to honor cross compiling.
This change was tested under our build environment.
Risk: Very low and should be transparent to existing autotest users. Unless you are working on cross compiling stuff.
From: ericli@google.com
git-svn-id: http://test.kernel.org/svn/autotest/trunk@4387 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index b92af211..996a240 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -1247,3 +1247,24 @@
command = command.replace('"', r'\"')
command = command.replace('`', r'\`')
return command
+
+
+def configure(extra=None, configure='./configure'):
+ """
+ Run configure passing in the correct host, build, and target options.
+
+ @param extra: extra command line arguments to pass to configure
+ @param configure: which configure script to use
+ """
+ args = []
+ if 'CHOST' in os.environ:
+ args.append('--host=' + os.environ['CHOST'])
+ if 'CBUILD' in os.environ:
+ args.append('--build=' + os.environ['CBUILD'])
+ if 'CTARGET' in os.environ:
+ args.append('--target=' + os.environ['CTARGET'])
+ if extra:
+ args.append(extra)
+
+ system('%s %s' % (configure, ' '.join(args)))
+