diff options
| author | 2025-04-12 16:46:03 +0100 | |
|---|---|---|
| committer | 2025-04-12 16:46:03 +0100 | |
| commit | 1f898006ccc4b1b2b02fde3ddc95b015cd003afc (patch) | |
| tree | 6527163d704bd76eadf5c1846c2684602251c3bb | |
| parent | Warn when a link block has misconfigured TLS. (diff) | |
Add the require_environment() build function.
| -rw-r--r-- | make/directive.pm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/make/directive.pm b/make/directive.pm index 14d587572..aa3005750 100644 --- a/make/directive.pm +++ b/make/directive.pm @@ -345,6 +345,24 @@ sub __function_require_library { return $ok; } +sub __function_require_environment { + my ($file, $name, $value) = @_; + + # Check for an inverted match. + my ($ok, $err) = ("", undef); + if ($name =~ s/^!//) { + ($ok, $err) = ($err, $ok); + } + + return $err unless defined $ENV{$name}; + if (defined $value) { + return $err unless $ENV{$name} eq $value; + } + + # Requirement directives don't change anything directly. + return $ok; +} + sub __function_warning { my ($file, @messages) = @_; print_warning @messages; |
