5

It appears that passing the preferred compiler to configure is very different for different projects. For example, if I want to build tcc with clang I must do ./configure --cc=clang but in most other cases a project would understand the ./configure CC=clang. Is there even a de facto standard or does it not matter and I should check for each individual project which way it is done?

  $ wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/tcc/0.9.27\+git20200814.62c30a4a-1/tcc_0.9.27\+git20200814.62c30a4a.orig.tar.bz2
  $ tar -xvjf tcc_0.9.27+git20200814.62c30a4a.orig.tar.bz2
  $ ./configure --cc=clang
  $ make
  $ make install

1 Answers1

5

In most cases, configure scripts are generated by Autoconf, and the recommendation is to set variables in arguments:

./configure CC=clang

However, some projects (such as tcc) ship a hand-written configure script, and practices vary.

As a rule of thumb, if there’s a configure.ac file, you can assume the Autoconf behaviour; if there isn’t, you need to check the project’s expectations.

(Strictly speaking, Autoconf-generated scripts don’t have to support CC, and you should check for the use of AC_PROG_CC; but the vast majority of Autoconf scripts using a C compiler do.)

Stephen Kitt
  • 434,908