Skip to content

Commit

Permalink
improve robustness in ruby detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Soeren Sonnenburg committed Aug 21, 2011
1 parent f14ecfb commit ed016f4
Showing 1 changed file with 32 additions and 17 deletions.
49 changes: 32 additions & 17 deletions src/configure
Expand Up @@ -699,12 +699,18 @@ EOF
_ruby_modular=yes
test_ruby_narray
else
echores "no"
if test "$_ruby_modular" = yes
then
die "ruby development files missing"
else
echores "not detected"
_ruby_modular=no
fi
fi
else
if test "$_ruby_modular" = yes
then
die "ruby/ruby development files missing"
die "ruby not found"
else
echores "not detected"
_ruby_modular=no
Expand All @@ -714,16 +720,14 @@ EOF

test_ruby_narray()
{
if test "$_ruby_modular" = yes
then
cat >$TMPRUBY << EOF
require 'narray'
NArray[[1, 0, 0], [0, 1, 2]]
EOF
echocheck "Ruby NArray"
if ruby $TMPRUBY >/dev/null 2>&1
then
echores "yes"
echocheck "Ruby NArray"
if ruby $TMPRUBY >/dev/null 2>&1
then
echores "yes"

cat >$TMPC << EOF
#include <ruby.h>
Expand All @@ -745,20 +749,31 @@ else
puts "#{Config::expand(CONFIG['rubyhdrdir'])}/#{Config::expand(CONFIG['arch'])}/narray.so" if CONFIG['rubyhdrdir']
end
EOF
LINKFLAGS_NARRAY=`ruby "$TMPRUBY" 2>/dev/null`
LINKFLAGS_NARRAY=`ruby "$TMPRUBY" 2>/dev/null`

echocheck "Ruby NArray Developer Files"
if cc_check $INCLUDES_RUBY $LINKFLAGS_RUBY $LINKFLAGS_NARRAY
echocheck "Ruby NArray Developer Files"
if cc_check $INCLUDES_RUBY $LINKFLAGS_RUBY $LINKFLAGS_NARRAY
then
echores "yes"
DEFINES="$DEFINES -DHAVE_RUBY_NARRAY"
HAVE_NARRAY='#define HAVE_RUBY_NARRAY 1'
LINKFLAGS_RUBY="$LINKFLAGS_RUBY $LINKFLAGS_NARRAY"
else
if test "$_ruby_modular" = yes
then
echores "yes"
DEFINES="$DEFINES -DHAVE_RUBY_NARRAY"
HAVE_NARRAY='#define HAVE_RUBY_NARRAY 1'
LINKFLAGS_RUBY="$LINKFLAGS_RUBY $LINKFLAGS_NARRAY"
die "ruby NArray header files missing"
else
echores "no"
echores "not detected"
_ruby_modular=no
fi
fi
else
if test "$_ruby_modular" = yes
then
die "ruby NArray not found"
else
echores "no"
echores "not detected"
_ruby_modular=no
fi
fi
}
Expand Down

0 comments on commit ed016f4

Please sign in to comment.