#!/usr/bin/env ruby
require 'mkmf'

arch = RbConfig::expand(CONFIG["arch"])

distro = if File.exist?("/etc/os-release")
  # this is "", "CentOS" or "Ubuntu"
  `egrep "^ID=.*" /etc/os-release`.split("=")[1].downcase
end

unless %w[centos ubuntu fedora].include?(distro.to_s.chomp)
	STDERR.puts "unhandled /etc/os-release result: #{distro}"
end

# either <arch> or <arch>_<distro> if distro is non-null
puts [arch, distro].compact.join("_")
