[Chapel Merge] Improve behavior when a CHPL_LLVM=none build is us

Branch: refs/heads/main
Revision: 46527cf
Author: bradcray
Log Message:

Merge pull request #18194 from bradcray/improve-no-llvm-error-message

Improve behavior when a CHPL_LLVM=none build is used when CHPL_LLVM!=none

[reviewed by @mppf and @ronawho]

When using a compiler built with CHPL_LLVM=none in an environment
that has CHPL_LLVM set or inferred to system or bundled, the
traditional error message has been short, but not particularly clear.
I keep hitting this error and find the current message difficult
to understand, particularly putting myself in the shoes of someone
who, say, built Chapel with the quickstart build and then is trying to
use it from a new shell that may not set CHPL_LLVM=none. Or
someone piggy-backing off of someone else's installation that was
built without LLVM.

This PR improves things by:

  • setting CHPL_LLVM=none in the compiler's environment in the event
    that it is unset and the compiler was built without LLVM support; this
    happens early in compilation so that when printchplenv is invoked, an
    appropriate back-end compiler will be selected. I also added a note
    to --print-chpl-settings to indicate that this setting had been made
    by the compiler (and why).
  • improving the existing error message so that if someone has explicitly
    requested the llvm back-end through --target-compiler, CHPL_TARGET_COMPILER,
    or CHPL_LLVM with a compiler that was built without LLVM, they get
    a better message than they used to.
  • reordering how we do things early in the compiler so that things like --help
    are handled before we print errors like this one. That way, someone running
    chpl --help won't immediately get an error about how they can't compile
    when they weren't actually trying to.

Resolves #18073.
Resolves #18197.

Modified Files:
M compiler/main/driver.cpp

Compare: https://github.com/chapel-lang/chapel/compare/c0e3512485d4...46527cf0c710