From 133b110534ec3386d8735020e8679236002b6ed1 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Wed, 1 Oct 2014 19:52:26 +0100 Subject: Improve configure cache file handling. - Add a version number to the configure cache file. - Disable configure cache file in non-interactive mode. - Rename configure cache file to .configure.cache to avoid 2.0 files. - Use run_test to produce the "reading .configure.cache" message. --- configure | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 55880fab6..de45bdc79 100755 --- a/configure +++ b/configure @@ -119,10 +119,17 @@ our $interactive = !( my %version = get_version(); print_format "<|BOLD Configuring InspIRCd $version{MAJOR}.$version{MINOR}.$version{PATCH}+$version{LABEL} on $^O.|>\n"; -our %config = read_configure_cache(); - -print "Checking for cache from previous configure... "; -print %config ? "found\n" : "not found\n"; +our %config; +if ($interactive) { + %config = read_configure_cache(); + run_test CONFIGURE_CACHE_FILE, %config; + if (!defined $config{VERSION}) { + $config{VERSION} = CONFIGURE_CACHE_VERSION; + } elsif ($config{VERSION} != CONFIGURE_CACHE_VERSION) { + print_warning "ignoring contents of ${\CONFIGURE_CACHE_FILE} as it was generated by an incompatible version of $0!"; + %config = ('VERSION', CONFIGURE_CACHE_VERSION); + } +} $config{CXX} = defined $ENV{CXX} && !system("$ENV{CXX} -v > /dev/null 2>&1") ? $ENV{CXX} : find_compiler(); if ($config{CXX} eq "") { @@ -290,7 +297,7 @@ if ( && prompt_bool $interactive, 'Would you like to ge system './tools/genssl', 'auto'; } -write_configure_cache %config; +write_configure_cache %config if $interactive; parse_templates \%config, \%compiler; print_format <<"EOM"; -- cgit v1.2.3