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

subscribe Asbjørn Thorsen
Is there any good how-to`s about extending Ruby with c++?
I have found one, but it`s quite old: http://www.angelfire.com/electronic2/issac/rb_cpp_ext_tut.txt.

Thanks, but I already found that. I included a link to it in my
original posting. Unfortunately it doesn't address any of the
problems I'm having with the Ruby-FLTK build.

Cheers,

Jeremy Henty

···

Asbjørn Reglund Thorsen <asbjoert@ifi.uio.no> wrote:

Is there any good how-to`s about extending Ruby with c++? I have
found one, but it`s quite old:=20
http://www.angelfire.com/electronic2/issac/rb_cpp_ext_tut.txt\.