3
votes

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?

2

2 Answers

5
votes

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.

-1
votes

The best way I found (and which I'm using now) is to use symlinks and PATH magic:

$ which -a gcc

/usr/lib/ccache/gcc

/usr/bin/gcc

This way, no special option is needed when invoking ./configure, who can't even see that ccache exists in this build.