Fixed search for ruby.h in ./configure for newer Ruby releases
authorTobias Brunner <tobias@strongswan.org>
Thu, 8 Nov 2012 15:20:41 +0000 (16:20 +0100)
committerTobias Brunner <tobias@strongswan.org>
Mon, 10 Dec 2012 08:47:46 +0000 (09:47 +0100)
configure.in

index 6fecf8c..c00a478 100644 (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