Fixed search for ruby.h in ./configure for newer Ruby releases

This commit is contained in:
Tobias Brunner 2012-11-08 16:20:41 +01:00
parent 133fb74841
commit 5057df5b73
1 changed files with 16 additions and 15 deletions

View File

@ -644,24 +644,25 @@ if test x$dumm = xtrue; then
AC_CHECK_PROGS(RUBY, ruby)
AC_MSG_CHECKING([for Ruby header files])
if test -n "$RUBY"; then
RUBYDIR=`($RUBY -rmkmf -e 'print Config::CONFIG[["archdir"]] || $archdir') 2>/dev/null`
if test -n "$RUBYDIR"; then
dirs="$RUBYDIR"
RUBYINCLUDE=none
for i in $dirs; do
if test -r $i/ruby.h; then
AC_MSG_RESULT([$i])
RUBYINCLUDE="-I$i"
break;
fi
done
if test x"$RUBYINCLUDE" = xnone; then
AC_MSG_ERROR([ruby.h not found])
RUBYINCLUDE=
RUBYDIR=`($RUBY -r rbconfig -e 'print RbConfig::CONFIG[["rubyhdrdir"]] || ""') 2>/dev/null`
if test -n "$RUBYDIR" -a -r "$RUBYDIR/ruby.h"; then
RUBYARCH=`($RUBY -r rbconfig -e 'print RbConfig::CONFIG[["arch"]] || ""') 2>/dev/null`
if test -n "$RUBYARCH"; then
AC_MSG_RESULT([$RUBYDIR])
RUBYINCLUDE="-I$RUBYDIR -I$RUBYDIR/$RUBYARCH"
fi
AC_SUBST(RUBYINCLUDE)
else
AC_MSG_ERROR([unable to determine ruby configuration])
RUBYDIR=`($RUBY -r rbconfig -e 'print RbConfig::CONFIG[["archdir"]] || ""') 2>/dev/null`
if test -n "$RUBYDIR" -a -r "$RUBYDIR/ruby.h"; then
AC_MSG_RESULT([$RUBYDIR])
RUBYINCLUDE="-I$RUBYDIR"
fi
fi
if test -z "$RUBYINCLUDE"; then
AC_MSG_ERROR([ruby.h not found])
fi
AC_SUBST(RUBYINCLUDE)
else
AC_MSG_ERROR([don't know how to run ruby])
fi