Skip to content

Commit 90806da

Browse files
committed
link and ar get their own env variables too.
1 parent 0beaf27 commit 90806da

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ In addition to the above environment variables the following can be optionally u
5656
something like `clang-3.7`. Similarly `LLVM_CXX_NAME` can be used to describe
5757
what the C++ compiler is called. Note that in these sorts of cases, the environment
5858
variable `LLVM_COMPILER` should still be set to `clang` not `clang-3.7` etc.
59+
We also pay attention to `LLVM_LINK_NAME` and `LLVM_AR_NAME` since they too
60+
get adorned with suffixes in various Linux distributions.
5961

6062
* `LLVM_COMPILER_PATH` can be set to the absolute path to the folder that
6163
contains the compiler and other LLVM tools such as `llvm-link` to be used.

sanity/checker.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,24 @@
4444
4545
"""
4646

47+
explain_LLVM_LINK_NAME = """
48+
49+
If your llvm linker is not called llvm-link, but something else, then
50+
you will need to set the environment variable LLVM_LINK_NAME to the
51+
appropriate string. For example if your llvm-link is called llvm-link-3.5 then
52+
LLVM_LINK_NAME should be set to llvm-link-3.5.
53+
54+
"""
55+
56+
explain_LLVM_AR_NAME = """
57+
58+
If your llvm archiver is not called llvm-ar, but something else,
59+
then you will need to set the environment variable LLVM_AR_NAME to
60+
the appropriate string. For example if your llvm-ar is called llvm-ar-3.5
61+
then LLVM_AR_NAME should be set to llvm-ar-3.5.
62+
63+
"""
64+
4765
class Checker(object):
4866
def __init__(self):
4967
path = os.getenv('LLVM_COMPILER_PATH')
@@ -192,20 +210,31 @@ def checkExecutable(self, exe, version_switch='-v'):
192210

193211

194212
def checkAuxiliaries(self):
195-
link = '{0}llvm-link'.format(self.path) if self.path else 'llvm-link' #LLVM_LINKER_NAME
196-
ar = '{0}llvm-ar'.format(self.path) if self.path else 'llvm-ar' #LLVM_ARCHIVER_NAME
213+
link_name = os.getenv('LLVM_LINK_NAME')
214+
ar_name = os.getenv('LLVM_AR_NAME')
215+
216+
if not link_name:
217+
link_name = 'llvm-link'
218+
219+
if not ar_name:
220+
ar_name = 'llvm-ar'
221+
222+
link = '{0}{1}'.format(self.path,link_name) if self.path else link_name
223+
ar = '{0}{1}'.format(self.path,ar_name) if self.path else ar_name
197224

198225
(linkOk, linkVersion) = self.checkExecutable(link, '-version')
199226

200227
(arOk, arVersion) = self.checkExecutable(ar, '-version')
201228

202229
if not linkOk:
203230
print 'The bitcode linker {0} was not found or not executable.\nBetter not try using extract-bc!\n'.format(link)
231+
print explain_LLVM_LINK_NAME
204232
else:
205233
print 'The bitcode linker {0} is:\n\n{1}\n'.format(link, linkVersion)
206234

207235
if not arOk:
208236
print 'The bitcode archiver {0} was not found or not executable.\nBetter not try using extract-bc!\n'.format(ar)
237+
print explain_LLVM_AR_NAME
209238
else:
210239
print 'The bitcode archiver {0} is:\n\n{1}\n'.format(ar, arVersion)
211240

0 commit comments

Comments
 (0)