Adding --program-prefix support to the autoconf build has been an adventure.
A patch was applied. It worked on the usual llvm bots, but failed on other bots with different configure options.
The patch was reverted as it broke on bots specifying --build, --host, and --target in configure.
An option is proposed here to change the behavior of program-prefix to it's normal behavior when AC_CANONICAL_TARGET is not specified. Meaning --program-prefix can only be set from the configure command line.
LLVM autoconf/configure.ac uses the AC_CANONICAL_TARGET.
This rule adds a test that can set program_prefix=target if --program-prefix is not specified on the configure line.
test -n "$target_alias" &&
test "$program_prefix$program_suffix$program_transform_name" = \
--- Proposed patch
The original patch has been updated to ignore the test added by AC_CANONICAL_TARGET. Program prefix can only be set from the command line of configure.
./configure --target=blah --program-prefix=blah
The attached patches reflect the code to do this change.