diff --git a/setup.py b/setup.py index 18be2e17817..bf013dd4944 100644 --- a/setup.py +++ b/setup.py @@ -166,7 +166,8 @@ def check_linker_need_libatomic(): """Test if linker on system needs libatomic.""" code_test = (b'#include \n' + b'int main() { return std::atomic{}; }') - cpp_test = subprocess.Popen(['c++', '-x', 'c++', '-std=c++11', '-'], + cxx = os.environ.get('CXX', 'c++') + cpp_test = subprocess.Popen([cxx, '-x', 'c++', '-std=c++11', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE) @@ -176,7 +177,7 @@ def check_linker_need_libatomic(): # Double-check to see if -latomic actually can solve the problem. # https://github.com/grpc/grpc/issues/22491 cpp_test = subprocess.Popen( - ['c++', '-x', 'c++', '-std=c++11', '-latomic', '-'], + [cxx, '-x', 'c++', '-std=c++11', '-latomic', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE)