[Libclc-dev] [PATCH 1/2] Make C++ compiler configurable
Jeroen Ketema
j.ketema at imperial.ac.uk
Fri Sep 6 15:37:27 PDT 2013
The C++ compiler used to build prepare-builtins
may differ from the llvm/clang for which we are
building libclc.
Use 'c++' as the default compiler.
---
configure.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/configure.py b/configure.py
index 1a98647..5d06a97 100755
--- a/configure.py
+++ b/configure.py
@@ -21,6 +21,8 @@ import metabuild
p = OptionParser()
p.add_option('--with-llvm-config', metavar='PATH',
help='use given llvm-config script')
+p.add_option('--with-cxx-compiler', metavar='PATH',
+ help='use given C++ compiler')
p.add_option('--prefix', metavar='PATH',
help='install to given prefix')
p.add_option('--libexecdir', metavar='PATH',
@@ -51,6 +53,10 @@ pkgconfigdir = options.pkgconfigdir
if not pkgconfigdir:
pkgconfigdir = os.path.join(prefix, 'share/pkgconfig')
+cxx_compiler = options.with_cxx_compiler
+if not cxx_compiler:
+ cxx_compiler = 'c++'
+
def llvm_config(args):
try:
proc = Popen([llvm_config_exe] + args, stdout=PIPE)
@@ -65,7 +71,6 @@ llvm_core_libs = llvm_config(['--libs', 'core', 'bitreader', 'bitwriter']) + ' '
llvm_config(['--ldflags'])
llvm_cxxflags = llvm_config(['--cxxflags']) + ' -fno-exceptions -fno-rtti'
-llvm_clang_cxx = os.path.join(llvm_bindir, 'clang++')
llvm_clang = os.path.join(llvm_bindir, 'clang')
llvm_link = os.path.join(llvm_bindir, 'llvm-link')
llvm_opt = os.path.join(llvm_bindir, 'opt')
@@ -96,8 +101,8 @@ b.rule("LLVM_LINK", command = llvm_link + " -o $out $in",
b.rule("OPT", command = llvm_opt + " -O3 -o $out $in",
description = 'OPT $out')
-c_compiler_rule(b, "LLVM_TOOL_CXX", 'LLVM-CXX', llvm_clang_cxx, llvm_cxxflags)
-b.rule("LLVM_TOOL_LINK", llvm_clang_cxx + " -o $out $in %s" % llvm_core_libs, 'LINK $out')
+c_compiler_rule(b, "LLVM_TOOL_CXX", 'CXX', cxx_compiler, llvm_cxxflags)
+b.rule("LLVM_TOOL_LINK", cxx_compiler + " -o $out $in %s" % llvm_core_libs, 'LINK $out')
prepare_builtins = os.path.join('utils', 'prepare-builtins')
b.build(os.path.join('utils', 'prepare-builtins.o'), "LLVM_TOOL_CXX",
--
1.7.12.4 (Apple Git-37)
More information about the Libclc-dev
mailing list