Speeding Up Autoconf - use of a config.cache

hammy

Active member
Jun 1, 2019
109
69
28
UK
Following up on a link of tips provided by @Unxmaal (https://gitlab.com/gnuwget/wget2/-/wikis/Developer-hints:-Increasing-speed-of-GNU-toolchain), here's a little recipe that's currently working pretty well for me.

Caution: Use of the autoconf config.cache can potentially cause weird things to fail that otherwise shouldn't (due to collisions in test naming). This can certainly speed you up when it works flawlessly - but in the case where autoconf (configure) is failing - you _may_ be seeing a false positive. Buyer beware.

So, cautionary tale out of the way - steps for setup:

* Directory and config.site script directing autoconf where stuff is cached

I currently use a ~/devtools/configcache directory, you can adjust this where suits you, adjust paths in the following.

~/devtools/configcache/config.site contents:

Code:
if test "$cache_file" = /dev/null; then
  # Can't do this, results in new cache for each package
  #  hash=`env|shasum|cut -d ' ' -f1`
  hash=`echo $CPPFLAGS $CC $M4 $PERL $PERL_PATH $SED $CXX $CFLAGS $CXXFLAGS $LDFLAGS $LIBS $host_alias $build_alias|shasum|cut -d ' ' -f1`
  cache_file=$HOME/devtools/configcache/config.cache.$hash
  cache_file_dir=$HOME/devtools/config.cache.$hash.dir
  mkdir -p $cache_file_dir
  cache_file_descr=$cache_file_dir/description
  echo "$RPM_PACKAGE_NAME CPPFLAGS=$CPPFLAGS CC=$CC M4=$M4 PERL=$PERL PERL_PATH=$PERL_PATH SED=$SED CXX=$CXX CFLAGS=$CFLAGS CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS LIBS=$LIBS" >>$cache_file_descr
  touch $cache_file
fi


* Environment variable telling configure that you have a cache and want to use it:

Code:
export CONFIG_SITE=$HOME/devtools/configcache/config.site

* Run configure for the package you want (this can include rpmbuild, too)

Be amazed as nothing is sped up - but wait!

* Rerun configure - and now the benefit should start to be a little more obvious.

How this works:

Basically it takes a bunch of environment vars like CFLAGS and LDFLAGS, hashes them and creates a unique configure cache for each of those keys.

On the whole it works pretty well. If you're getting strange behaviour, you can delete the files it creates, or unset the environment variable to avoid it altogether.

Enjoy.
 
  • Like
Reactions: foetz and Elf
Edit: With apologies, I no longer wish to have involvement with SGUG or SGI communities in general,
and have also chosen to remove all of my content. Many things have changed since I co-founded, named, and ultimately
then left SGUG. There are many good people around, to whom I apologize for frustrating by removing these things, and
also many petty people that over the years whittled down both the enjoyment as well as sense of obligation I used to
feel to anyone else regarding what was ultimately just a hobby. Unfortunately one of the latter now writes the rules
and so it is time for me to take my things and go.

This message will replace all of my previous forum posts because deleting threads that I started would have removed
other peoples' posts.
 
Last edited:

About us

  • Silicon Graphics User Group (SGUG) is a community for users, developers, and admirers of Silicon Graphics (SGI) products. We aim to be a friendly hobbyist community for discussing all aspects of SGIs, including use, software development, the IRIX Operating System, and troubleshooting, as well as facilitating hardware exchange.

User Menu