[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Compiling C++ module for Ruby
From:       Paul Brannan <pbrannan () atdesk ! com>
Date:       2006-10-31 21:08:10
Message-ID: 20061031210803.GC13705 () atdesk ! com
[Download RAW message or body]

On Tue, Oct 31, 2006 at 03:05:05PM +0900, Albert Chin wrote:
> What needs to change in extconf.rb to link against a C++ compiler? If
> I set CONFTEST_C="conftest.cxx", then gcc is smart enough to build it
> with g++. However, that is not the case for C compilers from Sun, HP,
> IBM, etc. If Ruby was built with the vendor C compiler, what changes
> need to be made to extconf.rb so C++ tests use the corresponding
> vendor C++ compiler?

There is a rule in the generated makefile for building .cxx files using
$(CXX).  Ruby 1.9 sets this variable; earlier versions seem to rely on
it getting set by make.

If CONFIG['CXX'] is unset, you could use find_executable to find a
binary with the same name as a common C++ compiler (autoconf seems to
search $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC).  Then
open the Makefile for writing and add the line:

  CXX=#{your_cxx_binary}

Paul



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic