Skip to content

Commit

Permalink
add missing macports? and macports_llvm_config methods to configure
Browse files Browse the repository at this point in the history
  • Loading branch information
sshao committed Jun 9, 2015
1 parent b360672 commit 737fee6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions configure
Expand Up @@ -1987,6 +1987,24 @@ Available commands are:
message.index("\n") != nil
end
end
# Returns true if the *port* command is in the PATH and identifies
# itself with "MacPorts" when run interactively.
def macports?
`echo quit | port 2>&-`.start_with? 'MacPorts'
end

# Query MacPorts for the path to the latest installed version of
# llvm-config that is within the range of supported LLVM versions.
def macports_llvm_config
supported_versions = (3.0 .. 3.5)
installed_ports = `port installed | egrep -o 'llvm-[^ ]+'`.split
latest_usable_port = installed_ports.sort.select do |fname|
version = fname.match(/-\K.*/)[0].to_f
supported_versions.include? version
end.last
avail_binaries = `port contents #{latest_usable_port} | fgrep llvm-config`.split
avail_binaries.reject { |fname| fname.include? 'libexec' }.last
end
end

STDOUT.sync = true
Expand Down

0 comments on commit 737fee6

Please sign in to comment.