aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/compilers.rb29
-rw-r--r--Library/Homebrew/formula.rb7
2 files changed, 36 insertions, 0 deletions
diff --git a/Library/Homebrew/compilers.rb b/Library/Homebrew/compilers.rb
index bd3fde698..7473f12a7 100644
--- a/Library/Homebrew/compilers.rb
+++ b/Library/Homebrew/compilers.rb
@@ -28,6 +28,35 @@ class CompilerFailure
attr_reader :compiler, :major_version
attr_rw :cause, :version
+ MESSAGES = {
+ :cxx11 => 'This compiler does not support C++11'
+ }
+
+ COLLECTIONS = {
+ :cxx11 => [
+ [:gcc_4_0, proc { cause MESSAGES[:cxx11] }],
+ [:gcc, proc { cause MESSAGES[:cxx11] }],
+ [:clang, proc { build 425; cause MESSAGES[:cxx11] }],
+ [{:gcc => '4.3'}, proc { cause MESSAGES[:cxx11] }],
+ [{:gcc => '4.4'}, proc { cause MESSAGES[:cxx11] }],
+ [{:gcc => '4.5'}, proc { cause MESSAGES[:cxx11] }],
+ [{:gcc => '4.6'}, proc { cause MESSAGES[:cxx11] }]
+ ],
+ :openmp => [
+ [:clang, proc { cause 'clang does not support OpenMP' }]
+ ]
+ }
+
+ def self.for_standard standard
+ failures = COLLECTIONS.fetch(standard) do
+ raise ArgumentError, "\"#{standard}\" is not a recognized standard"
+ end
+
+ failures.map do |compiler, block|
+ CompilerFailure.new(compiler, &block)
+ end
+ end
+
def initialize compiler, &block
# Non-Apple compilers are in the format fails_with compiler => version
if compiler.is_a? Hash
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 49271b76d..2fe485909 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -761,6 +761,13 @@ class Formula
@cc_failures << CompilerFailure.new(compiler, &block)
end
+ def needs *standards
+ @cc_failures ||= Set.new
+ standards.each do |standard|
+ @cc_failures.merge CompilerFailure.for_standard standard
+ end
+ end
+
def require_universal_deps
specs.each { |spec| spec.build.universal = true }
end