User:Sam/Autoconf cache

Background
tests can be rather time-intensive, especially on lower-end hardware. It's especially frustrating to see this:

It's possible for configure (autoconf-generated, at least) to cache the results of some tests so it doesn't have to re-run them. Note that it's most valuable to cache tests where a small e.g. C program is being compiled and executed as these are often the most expensive.

Implementation within Portage
This was actually implemented within Portage for a period between 2006 and 2008 when it was removed.

It was removed because of various bugs (TODO: links), but the main context is in.

There was also a package  which seems to be on GitHub, but not verified it. I'm curious as to what it did. It ended up being dropped as:

It was hosted at http://gentooexperimental.org/~ferringb/confcache/.

See also.

Thoughts

 * Obviously, you can't easily use this across systems and platforms
 * You can kind of do this if you restrict to a subset of tests, but you really want to generate it at least once on each platform, not guess.


 * Need to invalidate cache on major observable changes (which is easy enough to do, just hash a combination of the below, use a symlink and update it when it changes):
 * CHOST
 * Architecture
 * Profile?
 * Toolchain versions changing


 * Exclude more too-specific variables (stuff from libraries which are way too likely to change) (also, it's good enough even with just the basic autoconf ones, and then less likely to fail)


 * Implement it per-package instead to speed up rebuilds and upgrades at least, rather than system-wide
 * ccache analogue here


 * Would benefit from a shared workaround list like or gentooLTO

Setup
Create a directory for the cache files to reside in:

Initialise the cache:

Then configure as follows:

Populating the cache

 * 1) Build a few packages which use autoconf using FEATURES="keepwork"
 * 2) Manually filter out anything else which looks suspicious from /
 * 3) Go wild!
 * 1) Manually filter out anything else which looks suspicious from /
 * 2) Go wild!
 * 1) Go wild!

Whole system
It may be desirable to run src_configure for everything on the system:

Verification
TODO: explain how to check if it's working

Links

 * GNU autoconf documentation
 * smaeul's Portage configuration