Created
February 16, 2010 15:13
-
-
Save cowboyd/305584 to your computer and use it in GitHub Desktop.
Find GCC Major Version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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