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