Config: allow setting path to `llvm-config` via environment
authorJan Vrany <jan.vrany@fit.cvut.cz>
Fri, 25 Sep 2015 03:55:50 +0100
changeset 45 12a2f6470ef4
parent 44 8cade0a4d22e
child 46 ed599c4d3e94
Config: allow setting path to `llvm-config` via environment ...variable LLVM_CONFIG. This can be used to point standalone tools to custom LLVM builds.
LLVMConfig.st
--- a/LLVMConfig.st	Wed Sep 23 22:20:52 2015 +0100
+++ b/LLVMConfig.st	Fri Sep 25 03:55:50 2015 +0100
@@ -45,10 +45,20 @@
 initialize
     "Invoked at system start or when the class is dynamically loaded."
 
+    | path |
+
     LLVMConfigPath := nil.
+    path := OperatingSystem getEnvironment:'LLVM_CONFIG'.
+    path notNil ifTrue:[ 
+        path asFilename isExecutable ifTrue:[
+            self llvmConfigPath: path.
+            ^ self
+        ] ifFalse:[ 
+            Logger warning:'LLVM_CONFIG environment specified but referred files is not executable. Ignoring'.
+        ].
+    ].
     OperatingSystem isUNIXlike ifTrue:[ 
         #('-3.8' '-3.7' '') do:[:ver |
-            | path |
             path := OperatingSystem pathOfCommand: 'llvm-config' , ver.
             path notNil ifTrue:[
                 self llvmConfigPath: path.
@@ -59,7 +69,7 @@
     ].
     self error: 'This operating system is not supported'.
 
-    "Modified: / 13-09-2015 / 07:03:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 25-09-2015 / 03:54:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 llvmConfigPath: aStringOrFilename