New Issue: Should setting CC / CXX request the C backend?

18450, "mppf", "Should setting CC / CXX request the C backend?", "2021-09-23T20:21:56Z"

Today, setting CC in the environment causes chpl to use the C backend.

For example:

CC=clang CXX=clang++ ./util/printchplenv --all
CHPL_HOST_PLATFORM: darwin
CHPL_HOST_COMPILER: clang
  CHPL_HOST_CC: clang
  CHPL_HOST_CXX: clang++
CHPL_HOST_ARCH: x86_64
CHPL_TARGET_PLATFORM: darwin
CHPL_TARGET_COMPILER: clang
  CHPL_TARGET_CC: clang
  CHPL_TARGET_CXX: clang++
CHPL_TARGET_ARCH: x86_64
CHPL_TARGET_CPU: native
CHPL_LOCALE_MODEL: flat
CHPL_COMM: none
CHPL_TASKS: qthreads
CHPL_LAUNCHER: none
CHPL_TIMERS: generic
CHPL_UNWIND: none
CHPL_MEM: jemalloc
CHPL_ATOMICS: cstdlib
CHPL_GMP: none
CHPL_HWLOC: bundled
CHPL_RE2: none
CHPL_LLVM: system
  CHPL_LLVM_CONFIG: /usr/local/opt/llvm@11/bin/llvm-config
CHPL_AUX_FILESYS: none
CHPL_LIB_PIC: none
CHPL_SANITIZE: none
CHPL_SANITIZE_EXE: none

Note that CHPL_TARGET_COMPILER=clang (where the default is CHPL_TARGET_COMPILER=llvm because CHPL_LLVM=system).

I think this is happening because we use CC to infer CHPL_TARGET_COMPILER. That's reasonable on the face of it, but might not make sense with the LLVM backend. Perhaps the user just wants to control the host compiler.

This behavior caused some problem with the Homebrew package for 1.25 since Homebrew sets CC and CXX.