### Home Classes Methods

### In Files

- ext/libv8/compiler.rb

### Methods

- #check_clang_compiler
- #check_gcc_compiler
- #compiler

### Files

- Makefile

### Class/Module Index

Quicksearch

- Libv8
- Libv8::Arch
- Libv8::Builder
- Libv8::Checkout
- Libv8::Compiler
- Libv8::Location
- Libv8::Location::MkmfContext
- Libv8::Location::System
- Libv8::Location::System::NotFoundError
- Libv8::Location::Vendor
- Libv8::Location::Vendor::ArchiveNotFound
- Libv8::Make
- Libv8::Paths

No matching classes.

# Libv8::Compiler

### Public Instance Methods

check_clang_compiler(name) click to toggle source

    # File ext/libv8/compiler.rb, line 44
    def check_clang_compiler(name)
      compiler = `which #{name} 2> /dev/null`
      return nil unless $?.success?
      compiler.chomp
    end

check_gcc_compiler(name) click to toggle source

    # File ext/libv8/compiler.rb, line 30
    def check_gcc_compiler(name)
      # in SmartOS, `which` returns success with no arguments. 'with_config' above may return nil
      return nil if "#{name}".empty?

      compiler = `which #{name} 2> /dev/null`
      return nil unless $?.success?

      compiler.chomp!
      return nil unless `#{compiler} --version` =~ /([0-9]\.[0-9]\.[0-9])/

      return nil if $1 < "4.4"
      compiler
    end

compiler() click to toggle source

    # File ext/libv8/compiler.rb, line 5
    def compiler
      unless defined?(@compiler)
        cc   = check_gcc_compiler with_config("cxx")
        cc ||= check_gcc_compiler ENV["CXX"]
        cc ||= check_gcc_compiler "g++"

        # Check alternative GCC names
        # These are common on BSD's after
        # GCC has been installed by a port
        cc ||= check_gcc_compiler "g++44"
        cc ||= check_gcc_compiler "g++46"
        cc ||= check_gcc_compiler "g++48"

        if cc.nil?
          warn "Unable to find a compiler officially supported by v8."
          warn "It is recommended to use GCC v4.4 or higher"
          @compiler = cc = 'g++'
        end

        @compiler = cc
      end

      @compiler
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.