]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - make/configure.pm
m_spanningtree Refuse topic changes that would result in desync
[user/henk/code/inspircd.git] / make / configure.pm
index 7614ca8842eb3442895d90295578de05e5241f85..8619d5be265f6b76dcade5f14afbfab7f471cc13 100644 (file)
@@ -41,7 +41,7 @@ use make::console;
 use make::utilities;
 
 use constant CONFIGURE_DIRECTORY     => '.configure';
-use constant CONFIGURE_CACHE_FILE    => '.configure.cache';
+use constant CONFIGURE_CACHE_FILE    => catfile(CONFIGURE_DIRECTORY, 'cache.cfg');
 use constant CONFIGURE_CACHE_VERSION => '1';
 
 our @EXPORT = qw(CONFIGURE_CACHE_FILE
@@ -220,7 +220,7 @@ sub read_configure_cache {
        open(CACHE, CONFIGURE_CACHE_FILE) or return %config;
        while (my $line = <CACHE>) {
                next if $line =~ /^\s*($|\#)/;
-               my ($key, $value) = ($line =~ /^(\S+)="(.*)"$/);
+               my ($key, $value) = ($line =~ /^(\S+)(?:\s(.*))?$/);
                $config{$key} = $value;
        }
        close(CACHE);
@@ -228,12 +228,17 @@ sub read_configure_cache {
 }
 
 sub write_configure_cache(%) {
+       unless (-e CONFIGURE_DIRECTORY) {
+               print_format "Creating <|GREEN ${\CONFIGURE_DIRECTORY}|> ...\n";
+               create_directory CONFIGURE_DIRECTORY, 0750 or print_error "unable to create ${\CONFIGURE_DIRECTORY}: $!";
+       }
+
        print_format "Writing <|GREEN ${\CONFIGURE_CACHE_FILE}|> ...\n";
        my %config = @_;
        open(CACHE, '>', CONFIGURE_CACHE_FILE) or print_error "unable to write ${\CONFIGURE_CACHE_FILE}: $!";
        while (my ($key, $value) = each %config) {
                $value //= '';
-               say CACHE "$key=\"$value\"";
+               say CACHE "$key $value";
        }
        close(CACHE);
 }