0

I wonder how one could force, for some real example:

  • CFLAGS='-O2 -march=native'
  • CXXFLAGS='-O2 -march=native'
  • CC='gcc-10'
  • CPP='gcc-10 -E'
  • CXX='g++-10'

when running the configure script in my case for Transmission 3.00 BitTorrent client?

Editing the configure file does seem a bit tricky and more importantly not universally usable.

2 Answers2

3

The documented way to override variables when running configure is to specify their values as arguments to configure, as explained by ./configure --help:

`configure' configures transmission 3.00 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables.

In your case,

./configure --disable-cli --disable-mac --disable-daemon --enable-utp --with-gtk --with-crypto=openssl CFLAGS='-O2 -march=native' CXXFLAGS='-O2 -march=native' CC=gcc-10 CPP='gcc-10 -E' CXX=g++-10

configure takes environment variables into account by default, which is why setting them also works. In both cases, the values set are preserved in config.status (if the variables are marked as “precious”) and taken into account with config.status --recheck. The Autoconf documentation recommends specifying variables as arguments rather than relying on the environment.

Stephen Kitt
  • 434,908
0

What has worked (but is not the official approach), in my case of Transmission 3.00, was to simply add those in front of ./configure like so, I will not alter my command and place it in full:

CFLAGS='-O2 -march=native' CXXFLAGS='-O2 -march=native' CC='gcc-10' CPP='gcc-10 -E' CXX='g++-10' ./configure --disable-cli --disable-mac --disable-daemon --enable-utp --with-gtk --with-crypto=openssl