Skip to content

Commit cea9fc9

Browse files
coretlmdavidsaver
authored andcommitted
Added compiler detection from macros rather than sysconfig CC
1 parent bd2a98d commit cea9fc9

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/python/epicscorelibs/config.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
import platform
88
import sysconfig
99

10+
from setuptools_dso.probe import ProbeToolchain
11+
12+
1013
__all__ = (
1114
'get_config_var',
1215
'get_config_vars',
@@ -25,19 +28,15 @@ def _makeconf():
2528
}[platform.system()]
2629

2730
# select epics CMPLR_CLASS
28-
CC = sysconfig.get_config_var('CC')
29-
if CC is None and osname=='WIN32':
30-
cmplrname = conf['CMPLR_CLASS'] = 'msvc'
31-
elif CC is None:
32-
raise RuntimeError("Unable to determine compiler")
33-
elif CC.find('gcc')!=-1:
34-
cmplrname = conf['CMPLR_CLASS'] = 'gcc'
35-
elif CC.find('clang')!=-1:
31+
ID = ProbeToolchain().eval_macros(('__GNUC__', '__clang__', '_MSC_VER'))
32+
if ID['__clang__']:
3633
cmplrname = conf['CMPLR_CLASS'] = 'clang'
37-
elif CC is None or CC.find('cl')!=-1:
34+
elif ID['__GNUC__']:
35+
cmplrname = conf['CMPLR_CLASS'] = 'gcc'
36+
elif ID['_MSC_VER']:
3837
cmplrname = conf['CMPLR_CLASS'] = 'msvc'
3938
else:
40-
raise RuntimeError("Unable to identify compiler %s"%CC)
39+
raise RuntimeError('Unable to identify compiler %s' % ID)
4140

4241
machine = platform.machine().lower() # host CPU, may not reflect target bit width on windows
4342
bits = {

0 commit comments

Comments
 (0)