Fix build on Ruby 1.9.1 and 1.9.2

Thanks to Darrell Anderson for the patch!
pull/1/head
Timothy Pearson 12 years ago
parent a901a1232a
commit 2712dc645e

@ -8,6 +8,7 @@ if test -z "$RUBY"; then
DO_NOT_COMPILE="$DO_NOT_COMPILE korundum"
else
AC_MSG_CHECKING(for ruby dirs)
# Note: pkgconfig file exists only for ruby >= 1.9.3
if test -n "$PKGCONFIG"; then
RUBY_VERSION=`$PKGCONFIG ruby --modversion 2>/dev/null`
if test -n "$RUBY_VERSION"; then
@ -16,24 +17,51 @@ else
RUBY_VERSION=`$PKGCONFIG ruby-1.9 --modversion 2>/dev/null`
RUBY_CFLAGS=`$PKGCONFIG ruby-1.9 --cflags`
fi
if test -z "$RUBY_VERSION"; then
# pkgconfig file does not exist but might be 1.9.1: RUBY_VERSION defined in ruby/version.h
if test -n "$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"rubyhdrdir"@:>@)'"; then
# rubyhdrdir parameter works only in >=1.9.1; this is 1.9.1
RUBY_MAJOR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"['MAJOR']"@:>@)'`
RUBY_MINOR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"['MINOR']"@:>@)'`
RUBY_TEENY=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"['TEENY']"@:>@)'`
if test "$RUBY_MAJOR" == "1" && test "$RUBY_MINOR" == "9"; then
RUBY_VERSION="$RUBY_MAJOR.$RUBY_MINOR.$RUBY_TEENY"
fi
fi
fi
if test -n "$RUBY_VERSION"; then
RUBY_ARCHDIR=`ruby -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"archdir"@:>@)'`
RUBY_SITEARCHDIR=`ruby -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"sitearchdir"@:>@)'`
RUBY_SITEDIR=`ruby -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"sitelibdir"@:>@)'`
RUBY_RUBYLIBDIR=`ruby -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"rubylibdir"@:>@)'`
RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"archdir"@:>@)'`
RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"sitearchdir"@:>@)'`
RUBY_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"sitelibdir"@:>@)'`
RUBY_RUBYLIBDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"rubylibdir"@:>@)'`
RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"libdir"@:>@)'`
RUBY_INCLUDEDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"rubyhdrdir"@:>@)'`
RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
AC_DEFINE_UNQUOTED(HAVE_RUBY_1_9, 1, [Defines if your system has Ruby 1.9.x])
fi
fi
if test -z "$RUBY_VERSION"; then
RUBY_ARCHDIR=`ruby -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'`
RUBY_SITEARCHDIR=`ruby -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitearchdir"@:>@)'`
RUBY_SITEDIR=`ruby -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitelibdir"@:>@)'`
RUBY_RUBYLIBDIR=`ruby -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"rubylibdir"@:>@)'`
RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'`
RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitearchdir"@:>@)'`
RUBY_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitelibdir"@:>@)'`
RUBY_RUBYLIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"rubylibdir"@:>@)'`
RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'`
RUBY_INCLUDEDIR=$RUBY_ARCHDIR
RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
fi
AC_MSG_RESULT([archdir $RUBY_ARCHDIR, sitearchdir $RUBY_SITEARCHDIR, sitedir $RUBY_SITEDIR, cflags $RUBY_CFLAGS])
AC_MSG_RESULT([
archdir $RUBY_ARCHDIR,
sitearchdir $RUBY_SITEARCHDIR,
sitedir $RUBY_SITEDIR,
rubylibdir $RUBY_RUBYLIBDIR,
libdir $RUBY_LIBDIR,
includedir $RUBY_INCLUDEDIR,
librubyarg $RUBY_LIBRUBYARG,
cflags $RUBY_CFLAGS])
AC_SUBST(RUBY_ARCHDIR)
AC_SUBST(RUBY_SITEARCHDIR)
AC_SUBST(RUBY_RUBYLIBDIR)
AC_SUBST(RUBY_INCLUDEDIR)
AC_SUBST(RUBY_SITEDIR)
AC_SUBST(RUBY_CFLAGS)
fi

@ -16,12 +16,25 @@ else
RUBY_VERSION=`$PKGCONFIG ruby-1.9 --modversion 2>/dev/null`
RUBY_CFLAGS=`$PKGCONFIG ruby-1.9 --cflags`
fi
if test -z "$RUBY_VERSION"; then
# pkgconfig file does not exist but might be 1.9.1: RUBY_VERSION defined in ruby/version.h
if test -n "$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"rubyhdrdir"@:>@)'"; then
# rubyhdrdir parameter works only in >=1.9.1; this is 1.9.1
RUBY_MAJOR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"['MAJOR']"@:>@)'`
RUBY_MINOR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"['MINOR']"@:>@)'`
RUBY_TEENY=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"['TEENY']"@:>@)'`
if test "$RUBY_MAJOR" == "1" && test "$RUBY_MINOR" == "9"; then
RUBY_VERSION="$RUBY_MAJOR.$RUBY_MINOR.$RUBY_TEENY"
fi
fi
fi
if test -n "$RUBY_VERSION"; then
RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"archdir"@:>@)'`
RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"sitearchdir"@:>@)'`
RUBY_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"sitelibdir"@:>@)'`
RUBY_RUBYLIBDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"rubylibdir"@:>@)'`
RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"libdir"@:>@)'`
RUBY_INCLUDEDIR=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"rubyhdrdir"@:>@)'`
RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",RbConfig::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
AC_DEFINE_UNQUOTED(HAVE_RUBY_1_9, 1, [Defines if your system has Ruby 1.9.x])
fi
@ -32,14 +45,24 @@ else
RUBY_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitelibdir"@:>@)'`
RUBY_RUBYLIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"rubylibdir"@:>@)'`
RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'`
RUBY_INCLUDEDIR=$RUBY_ARCHDIR
RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
fi
AC_MSG_RESULT([archdir $RUBY_ARCHDIR, sitearchdir $RUBY_SITEARCHDIR, sitedir $RUBY_SITEDIR, libdir $RUBY_LIBDIR, librubyarg $RUBY_LIBRUBYARG, cflags $RUBY_CFLAGS])
AC_MSG_RESULT([
archdir $RUBY_ARCHDIR,
sitearchdir $RUBY_SITEARCHDIR,
sitedir $RUBY_SITEDIR,
rubylibdir $RUBY_RUBYLIBDIR,
libdir $RUBY_LIBDIR,
includedir $RUBY_INCLUDEDIR,
librubyarg $RUBY_LIBRUBYARG,
cflags $RUBY_CFLAGS])
AC_SUBST(RUBY_ARCHDIR)
AC_SUBST(RUBY_SITEARCHDIR)
AC_SUBST(RUBY_SITEDIR)
AC_SUBST(RUBY_RUBYLIBDIR)
AC_SUBST(RUBY_LIBDIR)
AC_SUBST(RUBY_INCLUDEDIR)
AC_SUBST(RUBY_LIBRUBYARG)
AC_SUBST(RUBY_CFLAGS)
fi

Loading…
Cancel
Save