Skip to content

Commit

Permalink
Detect the Solaris Studio compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
sodabrew committed Aug 9, 2015
1 parent 1b27732 commit 459ae6e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ext/ed.cpp
Expand Up @@ -1024,6 +1024,8 @@ void ConnectionDescriptor::_WriteOutboundData()
for(int i = 0; i < iovcnt; i++){
OutboundPage *op = &(OutboundPages[i]);
#ifdef CC_SUNWspro
// TODO: The void * cast works fine on Solaris 11, but
// I don't know at what point that changed from older Solaris.
iov[i].iov_base = (char *)(op->Buffer + op->Offset);
#else
iov[i].iov_base = (void *)(op->Buffer + op->Offset);
Expand Down
6 changes: 5 additions & 1 deletion ext/extconf.rb
Expand Up @@ -125,13 +125,17 @@ def manual_ssl_config
add_define 'OS_SOLARIS8'
check_libs(%w[nsl socket], true)

if CONFIG['CC'] == 'cc' and `cc -flags 2>&1` =~ /Sun/ # detect SUNWspro compiler
if CONFIG['CC'] == 'cc' && (
`cc -flags 2>&1` =~ /Sun/ || # detect SUNWspro compiler
`cc -V 2>&1` =~ /Sun/ # detect Solaris Studio compiler
)
# SUN CHAIN
add_define 'CC_SUNWspro'
$preload = ["\nCXX = CC"] # hack a CXX= line into the makefile
$CFLAGS = CONFIG['CFLAGS'] = "-KPIC"
CONFIG['CCDLFLAGS'] = "-KPIC"
CONFIG['LDSHARED'] = "$(CXX) -G -KPIC -lCstd"
CONFIG['LDSHAREDXX'] = "$(CXX) -G -KPIC -lCstd"
else
# GNU CHAIN
# on Unix we need a g++ link, not gcc.
Expand Down
6 changes: 5 additions & 1 deletion ext/fastfilereader/extconf.rb
Expand Up @@ -56,13 +56,17 @@ def add_define(name)
add_define 'OS_SOLARIS8'
check_libs(%w[nsl socket], true)

if CONFIG['CC'] == 'cc' and `cc -flags 2>&1` =~ /Sun/ # detect SUNWspro compiler
if CONFIG['CC'] == 'cc' && (
`cc -flags 2>&1` =~ /Sun/ || # detect SUNWspro compiler
`cc -V 2>&1` =~ /Sun/ # detect Solaris Studio compiler
)
# SUN CHAIN
add_define 'CC_SUNWspro'
$preload = ["\nCXX = CC"] # hack a CXX= line into the makefile
$CFLAGS = CONFIG['CFLAGS'] = "-KPIC"
CONFIG['CCDLFLAGS'] = "-KPIC"
CONFIG['LDSHARED'] = "$(CXX) -G -KPIC -lCstd"
CONFIG['LDSHAREDXX'] = "$(CXX) -G -KPIC -lCstd"
else
# GNU CHAIN
# on Unix we need a g++ link, not gcc.
Expand Down
2 changes: 2 additions & 0 deletions ext/fastfilereader/mapper.cpp
Expand Up @@ -89,6 +89,8 @@ void Mapper_t::Close()
// Calls to GetChunk are invalid after a call to Close.
if (MapPoint) {
#ifdef CC_SUNWspro
// TODO: The void * cast works fine on Solaris 11, but
// I don't know at what point that changed from older Solaris.
munmap ((char*)MapPoint, FileSize);
#else
munmap ((void*)MapPoint, FileSize);
Expand Down
4 changes: 4 additions & 0 deletions tests/em_test_helper.rb
Expand Up @@ -41,6 +41,10 @@ def windows?
RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
end

def solaris?
RUBY_PLATFORM =~ /solaris/
end

# http://stackoverflow.com/questions/1342535/how-can-i-tell-if-im-running-from-jruby-vs-ruby/1685970#1685970
def jruby?
defined? JRUBY_VERSION
Expand Down
1 change: 1 addition & 0 deletions tests/test_file_watch.rb
Expand Up @@ -34,6 +34,7 @@ def teardown
end

def test_events
omit_if(solaris?)
EM.run{
file = Tempfile.new('em-watch')
$tmp_path = file.path
Expand Down

0 comments on commit 459ae6e

Please sign in to comment.