]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Add a directive for requiring a specific compiler.
authorPeter Powell <petpow@saberuk.com>
Thu, 4 Oct 2018 12:16:25 +0000 (14:16 +0200)
committerPeter Powell <petpow@saberuk.com>
Thu, 4 Oct 2018 12:17:02 +0000 (14:17 +0200)
make/directive.pm

index b178228fd67014db3f274ca73ad51ac5ed8709aa..ef6bb1bf5609b2e609480d389c7249207197a50d 100644 (file)
@@ -222,6 +222,22 @@ sub __function_find_linker_flags {
        __error $file, "unable to find the <|GREEN $name|> linker flags for <|GREEN ${\basename $file, '.cpp'}|>!";
 }
 
+sub __function_require_compiler {
+       my ($file, $name, $minimum, $maximum) =  @_;
+
+       # Look up information about the compiler.
+       return undef unless $ENV{CXX};
+       my %compiler = get_compiler_info($ENV{CXX});
+
+       # Check whether the current compiler is suitable.
+       return undef unless $compiler{NAME} eq $name;
+       return undef if defined $minimum && $compiler{VERSION} < $minimum;
+       return undef if defined $maximum && $compiler{VERSION} > $maximum;
+
+       # Requirement directives don't change anything directly.
+       return "";
+}
+
 sub __function_require_system {
        my ($file, $name, $minimum, $maximum) = @_;
        my ($system, $version);