yajl-ruby
yajl-ruby copied to clipboard
Get rid of gcc-ism
this is also a problem with AIX and Solaris
something like this works for me on AIX with the IBM compiler:
if RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
$CFLAGS << ' -Wall -funroll-loops'
$CFLAGS << ' -Wextra -O0 -ggdb3' if ENV['DEBUG']
end
that variable is set to the path of the compiler which is why i used a regex. you could probably use File.basename to drop the path and match ^gcc instead, but you need to worry about gcc invoked as /blah/blah/gcc4, etc.
could also do something more involved like invoke the compiler with --version and see if the output looks like gcc...
here's the File.basename version:
if File.basename(RbConfig::MAKEFILE_CONFIG['CC']) =~ /^gcc/
$CFLAGS << ' -Wall -funroll-loops'
$CFLAGS << ' -Wextra -O0 -ggdb3' if ENV['DEBUG']
end