cross-compilingautotoolsconfigureautoconfccache

Using ccache when cross-compiling with autotools


I know the standard way of cross compiling an autoconf-based project:

$ ./configure --host=i686-w64-mingw32

However, what if I want to use ccache?

I know I can override the CC and CXX variables (e.g CC="ccache i686-w64-mingw32-gcc" ./configure --host=i686-w64-mingw32). However, this seems redundant and error prone.

Is there a standard way, I'm missing, like some CC_PREFIX variable?


Solution

  • There isn't, if you want to use ccache you'll have to change your CC/CXX parameters as well as passing --host.

    By the way, prefer

    ./configure --host=i686-w64-mingw32 \
        CC="ccache i686-w64-mingw32-gcc" CXX="ccache i686-w64-mingw32-g++"
    

    rather than pre-fixing the environment variables. This way they will be correctly recorded as overrides in config.log/config.cache if you're using maintainer mode.