AC_DEFUN([AC_RUBY_EXT], [ AC_CHECK_PROG(RUBY, ruby) AC_ARG_WITH(ruby, [ --with-ruby=PATH Location of Ruby executable (default: autodetect)], [rubybin="$withval"]) AC_CHECK_PROGS(rubybin, ruby) rubyver=`$rubybin --version 2> /dev/null` if test -z "$rubyver"; then AC_MSG_ERROR([ruby binary not found!]) fi AC_MSG_CHECKING(for Ruby library path) RUBYLIBDIR=`($rubybin -rmkmf -e 'print Config::CONFIG[["libdir"]]') 2> /dev/null` if test -d "$RUBYLIBDIR"; then AC_MSG_RESULT([$RUBYLIBDIR]) else AC_MSG_RESULT(not found) AC_MSG_ERROR(Ruby library path not found) fi AC_MSG_CHECKING(for Ruby extension path) RUBYDIR=`($rubybin -rmkmf -e 'print Config::CONFIG[["archdir"]]') 2> /dev/null` if test -d "$RUBYDIR"; then AC_MSG_RESULT([$RUBYDIR]) else AC_MSG_RESULT(not found) AC_MSG_ERROR(Ruby extension path not found) fi AC_MSG_CHECKING(for Ruby site library path) RUBYSITEDIR=`($rubybin -rmkmf -e 'print Config::CONFIG[["sitearchdir"]]') 2> /dev/null` if test -d "$RUBYSITEDIR"; then AC_MSG_RESULT([$RUBYSITEDIR]) else AC_MSG_RESULT(not found) AC_MSG_ERROR(Ruby site extension path not found) fi AC_MSG_CHECKING(for Ruby shared library) RUBYLIB=`($rubybin -rmkmf -e 'print Config::CONFIG[["LIBRUBYARG_SHARED"]]') 2> /dev/null` AC_MSG_RESULT([$RUBYLIB]) AC_SUBST(RUBYLIB) AC_SUBST(RUBYLIBDIR) AC_SUBST(RUBYDIR) AC_SUBST(RUBYSITEDIR) ])