[PATCH] Fix for llvm-config's new --system-libs

Hi

I’m not sure if I need to check for version 3.5 first but this makes libclc compile for me

— a/configure.py 2013-12-23 20:54:47.072228588 +0000
+++ b/configure.py 2013-12-23 20:55:32.040228747 +0000
@@ -64,7 +64,8 @@

llvm_bindir = llvm_config([’–bindir’])
llvm_core_libs = llvm_config([’–libs’, ‘core’, ‘bitreader’, ‘bitwriter’]) + ’ ’ + \

  • llvm_config([’–ldflags’])
  • llvm_config([’–ldflags’]) + ’ ’ + \
  • llvm_config([’–system-libs’])
    llvm_cxxflags = llvm_config([’–cxxflags’]) + ’ -fno-exceptions -fno-rtti’

llvm_clang = os.path.join(llvm_bindir, ‘clang’)

Hi Mike,

Unfortunately this doesn't work with the current released version 3.3 and the soon to be released 3.4; the llvm-config of those versions doesn't support system-libs flag. Hence, the need for a check.

Regards,

Jeroen

Here’s an added check - I’m not sure if this is the way you’d prefer to do this or if there’s an easier way but it works for me

— a/configure.py 2013-12-23 21:41:35.585238480 +0000
+++ b/configure.py 2013-12-23 21:42:25.579238656 +0000
@@ -62,9 +62,12 @@
print “Please ensure that llvm-config is in your $PATH, or use --with-llvm-config.”
sys.exit(1)

+llvm_version = llvm_config([’–version’]).replace(“svn”,"")
llvm_bindir = llvm_config([’–bindir’])
llvm_core_libs = llvm_config([’–libs’, ‘core’, ‘bitreader’, ‘bitwriter’]) + ’ ’ +
llvm_config([’–ldflags’])
+if llvm_version >= ‘3.5’:

  • llvm_core_libs = llvm_core_libs + ’ ’ + llvm_config([’–system-libs’])
    llvm_cxxflags = llvm_config([’–cxxflags’]) + ’ -fno-exceptions -fno-rtti’

llvm_clang = os.path.join(llvm_bindir, ‘clang’)

Ah right,

I mis-read your original post, I thought you were trying to simplify the patch Tom posted yesterday. So, see that patch for a slightly nicer way of doing this.

Regards,

Jeroen

Ah sorry - I’ve just joined the mailing list after tripping over this today