On Thu, Mar 26, 2026 at 10:28:28PM +0100, Manuel Jacob wrote:
> Hi,
> 
> The standard name to configure the compiler that compiles against the build
> machine (used e.g. to compile info/makedoc.c that runs during build even
> when cross-compiling) is CC_FOR_BUILD. However, texinfo’s configure.ac file
> uses BUILD_CC. The name CC_FOR_BUILD is much more common than BUILD_CC
> nowadays. E.g. there is a macro for CC_FOR_BUILD in autoconf-archive
> (https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html).
> 
> Autoconf’s config.guess script renamed BUILD_CC to CC_FOR_BUILD in 1999 [1].
> Even at the time when cross-compiling support was added to texinfo, the
> config.guess script included in the texinfo sources was already using
> CC_FOR_BUILD. In theory, things could go wrong if only one of BUILD_CC or
> CC_FOR_BUILD are set when --build is not passed to configure.
> 
> For these two reasons, I suggest that texinfo should use CC_FOR_BUILD
> instead of BUILD_CC to compile info/makedoc.c etc. I can send a patch for
> this if nobody opposes. Also, I can send an additional patch adding
> CC_FOR_BUILD to `configure --help` (CC is already documented).

As far as I know, none of this is documented anywhere and people would
only find out about BUILD_CC by looking at configure.ac in the Texinfo
sources.

I notice that the glibc manual refers to a BUILD_CC variable but whether
this is for exactly the same purpose is not a question I have investigated
in any depth:

    "It is easy to configure the GNU C Library for cross-compilation by
    setting a few variables in configparms. Set CC to the cross-compiler for
    the target you configured the library for; it is important to use this
    same CC value when running configure, like this: ‘configure target
    CC=target-gcc’. Set BUILD_CC to the compiler to use for programs run
    on the build system as part of compiling the library."

https://sourceware.org/glibc/manual/2.43/html_mono/libc.html#toc-Installing-the-GNU-C-Library

> 
> If this change is made, BUILD_CC could stay as a fallback for backwards
> compatibility. In this case, a warning could be printed.
> 
> (Texinfo also uses BUILD_AR and BUILD_RANLIB. Similar considerations apply
> to these.)

It's not worth attempting to be backwards compatible with these variables
as they are not documented anywhere and hardly anybody apart from yourself
has tried to use them.  I'm happy to go with whatever you recommend.o

So you know, Texinfo also has other variables to specify C compilers
and other build tools.  Quoting from INSTALL:

* When `configure' is running in the tta/ subdirectory and XS modules
  are used, instead of the standard CC, CFLAGS, LDFLAGS etc., it uses special
  variables with a PERL_EXT_ prefix.  These are all listed in the output of
  `configure --help'.  This is necessary because it is possible that the C
  compiler being used to compile Perl extension modules and other texi2any C
  codes is a different compiler to that used for the rest of the package.
  (However, if you need to override these variables when running `make', use
  the unprefixed variants, e.g. CFLAGS instead of PERL_EXT_CFLAGS.  Exception:
  you cannot override CPPFLAGS this way, as gnulib uses this variable.)

So I fear there is a risk of needing extra variables for all of these as
well (PERL_EXT_CC_FOR_BUILD and so on).  Any ideas if this is a problem or
not?


> 
> -Manuel
> 
> [1] 
> https://gitweb.git.savannah.gnu.org/gitweb/?p=autoconf.git;a=commit;h=9c3f31ada2c39dd867e365913fbab00fbf2aa886
> 

Reply via email to