Minor API changes.
[ruby-evas.git] / m4 / ac_ruby_ext.m4
1 AC_DEFUN([AC_RUBY_EXT], [
2         AC_CHECK_PROG(RUBY, ruby)
3
4         AC_ARG_WITH(ruby,
5                 [  --with-ruby=PATH        Location of Ruby executable (default: autodetect)],
6                 [rubybin="$withval"])
7
8         AC_CHECK_PROGS(rubybin, ruby)
9
10         rubyver=`$rubybin --version 2> /dev/null`
11         if test -z "$rubyver"; then
12                 AC_MSG_ERROR([ruby binary not found!])
13         fi
14
15         AC_MSG_CHECKING(for Ruby library path)
16
17         RUBYDIR=`($rubybin -rmkmf -e 'print Config::CONFIG[["archdir"]]') 2> /dev/null`
18         if test -d "$RUBYDIR"; then
19                 AC_MSG_RESULT([$RUBYDIR])
20         else
21                 AC_MSG_RESULT(not found)
22                 AC_MSG_ERROR(Ruby library path not found)
23         fi
24
25         AC_MSG_CHECKING(for Ruby site library path)
26         RUBYSITEDIR=`($rubybin -rmkmf -e 'print Config::CONFIG[["sitearchdir"]]') 2> /dev/null`
27         if test -d "$RUBYSITEDIR"; then
28                 AC_MSG_RESULT([$RUBYSITEDIR])
29         else
30                 AC_MSG_RESULT(not found)
31                 AC_MSG_ERROR(Ruby site library path not found)
32         fi
33
34         AC_SUBST(RUBYDIR)
35         AC_SUBST(RUBYSITEDIR)
36 ])