Skip to content

Instantly share code, notes, and snippets.

@cowboyd
Created February 16, 2010 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cowboyd/305584 to your computer and use it in GitHub Desktop.
Save cowboyd/305584 to your computer and use it in GitHub Desktop.
Find GCC Major Version
#Builds scripts often use the GCC major and minor version
#to make tweaks and adjustments to compilation parameters
#by setting GCC_VERSION=41 for example. However, gcc doesn't
#provide an out of the box way to get at this value.
#this works until we get to GCC version 10 ;)
if /(\d)\.(\d)\.(\d)/ =~ `gcc --version`
puts "#{$1}#{$2}" #=> 44
else
puts "unabled to find gcc version in #{`gcc --version`}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment