Add --program-prefix support with AC_CANONICAL_TARGET override.

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.

--- background

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" = \
     NONENONEs,x,x, &&
   program_prefix=${target_alias}-dnl

./configure --target=blah
results in
program_prefix=blah

--- 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
results in
program_prefix=

./configure --target=blah --program-prefix=blah
results in
program_prefix=blah

The attached patches reflect the code to do this change.

-rick

0001-TEST-SUITE-Add-program-prefix-AC_CANONICAL_TARGET-override.patch (13.3 KB)

0001-LLVM-Add-program-prefix-AC_CANONICAL_TARGET-override.patch (10.1 KB)

Hi Rick and Jaroslav,

I'm looking for ways to apply prefixes to llvm binaries, similar to gcc's --program-prefix configure option.

@Rick, were you able to commit a suitable version of your patch?

@Jaroslav, you were asking the same question question last year - have you solved it yourself?

Thanks,
- Dima.