From: Jeremy Henty Date: 2005-01-03T21:41:36+09:00 Subject: HOWTO?: fix extconf.rb to use g++? Is there a supported way to get extconf.rb to use g++ instead of gcc? I found the following references but none of them give a really definitive answer. http://www.angelfire.com/electronic2/issac/rb_cpp_ext_tut.txt http://www.rubygarden.com/ruby?WritingExtensionInCpp http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/42146 http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/83208 This came up when I tried to fix the build of ruby-fltk. It uses this hack: # Use "g++" instead of "gcc" CONFIG.each{|key, val| if( val =~ /gcc/ ) CONFIG[key] = CONFIG[key].gsub("gcc", "g++") end } if( defined?(LINK) ) LINK.gsub!("gcc", "g++") end if( defined?(CPP) ) CPP.gsub!("gcc", "g++") end .... but it doesn't work in Ruby 1.8.2 ; the configuration tests still run gcc , so some of them misfire, the build gets misconfigured and breaks. My current fix is: [ Config::CONFIG, Config::MAKEFILE_CONFIG, ].each{|config| config.each{|key, val| if( val =~ /gcc/ ) config[key] = config[key].gsub("gcc", "g++") end } } if( defined?(LINK) ) LINK.gsub!("gcc", "g++") end if( defined?(CPP) ) CPP.gsub!("gcc", "g++") end .... which seems to work but I've no idea if I've covered all the bases. Any suggestions? Cheers, Jeremy Henty