Added ac_ruby_ext.m4.
authorTilman Sauerbeck <tilman@code-monkey.de>
Sun, 25 Jul 2004 10:42:06 +0000 (10:42 +0000)
committerTilman Sauerbeck <tilman@code-monkey.de>
Sun, 25 Jul 2004 10:42:06 +0000 (10:42 +0000)
m4/ac_ruby_ext.m4 [new file with mode: 0644]

diff --git a/m4/ac_ruby_ext.m4 b/m4/ac_ruby_ext.m4
new file mode 100644 (file)
index 0000000..17f6259
--- /dev/null
@@ -0,0 +1,36 @@
+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)
+
+       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 library 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 library path not found)
+       fi
+
+       AC_SUBST(RUBYDIR)
+       AC_SUBST(RUBYSITEDIR)
+])