From 91993677f464585cd000b51869bd5b6faae780e2 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Tue, 16 Oct 2012 19:37:56 -0500 Subject: [PATCH] Fix building with Ruby 1.9.1 or 1.9.3. (cherry picked from commit e159235799062207ebc20322fe4b1c80a08c90b1) --- configure.in | 72 ++++++++++++++++++++++++++++----------- lib/kross/configure.in.in | 43 +++++++++++++++-------- 2 files changed, 81 insertions(+), 34 deletions(-) diff --git a/configure.in b/configure.in index 7584e5589..e44267a3b 100644 --- a/configure.in +++ b/configure.in @@ -1539,32 +1539,66 @@ AM_CONDITIONAL(compile_kross_python, # Check for Ruby if test "x$compile_kross" = "xyes" ; then - AC_CHECK_PROGS([RUBY], [ruby ruby1.8 ruby18], ruby) + AC_CHECK_PROGS([RUBY], [ruby ruby1.8 ruby18 ruby1.9 ruby19], ruby) if test -n "$RUBY"; then AC_MSG_CHECKING(for Ruby dirs) - 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_INCLUDEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"rubyincludedir"@:>@)'` - RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'` - RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'` - RUBY_ENABLESHARED=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"ENABLE_SHARED"@:>@)'` + # 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 + RUBY_CFLAGS=`$PKGCONFIG ruby --cflags` + 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 + 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_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, - includedir $RUBY_INCLUDEDIR, - libdir $RUBY_LIBDIR, - librubyarg $RUBY_LIBRUBYARG, - rubysharedenabled $RUBY_ENABLESHARED]) + 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_INCLUDEDIR) - AC_SUBST(RUBY_LIBDIR) - AC_SUBST(RUBY_LIBRUBYARG) - AC_SUBST(RUBY_ENABLESHARED) + AC_SUBST(RUBY_SITEDIR) + AC_SUBST(RUBY_CFLAGS) AC_MSG_CHECKING(for Ruby header) diff --git a/lib/kross/configure.in.in b/lib/kross/configure.in.in index c679be43f..16530c7cc 100644 --- a/lib/kross/configure.in.in +++ b/lib/kross/configure.in.in @@ -25,10 +25,11 @@ AM_CONDITIONAL(compile_kross_python, # Check for Ruby if test "x$compile_kross" = "xyes" ; then - AC_CHECK_PROGS([RUBY], [ruby ruby1.8 ruby18], ruby) + AC_CHECK_PROGS([RUBY], [ruby ruby1.8 ruby18 ruby1.9 ruby19], ruby) if test -n "$RUBY"; then 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 @@ -37,13 +38,26 @@ if test "x$compile_kross" = "xyes" ; then 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"@:>@)'` - RUBY_ENABLESHARED=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"ENABLE_SHARED"@:>@)'` AC_DEFINE_UNQUOTED(HAVE_RUBY_1_9, 1, [Defines if your system has Ruby 1.9.x]) fi fi @@ -51,26 +65,25 @@ if test "x$compile_kross" = "xyes" ; 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_INCLUDEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"rubyincludedir"@:>@)'` + 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"@:>@)'` - RUBY_ENABLESHARED=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"ENABLE_SHARED"@:>@)'` fi AC_MSG_RESULT([ - archdir $RUBY_ARCHDIR, - sitearchdir $RUBY_SITEARCHDIR, - sitedir $RUBY_SITEDIR, - includedir $RUBY_INCLUDEDIR, - libdir $RUBY_LIBDIR, - librubyarg $RUBY_LIBRUBYARG, - rubysharedenabled $RUBY_ENABLESHARED]) + 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_INCLUDEDIR) - AC_SUBST(RUBY_LIBDIR) - AC_SUBST(RUBY_LIBRUBYARG) - AC_SUBST(RUBY_ENABLESHARED) + AC_SUBST(RUBY_SITEDIR) AC_SUBST(RUBY_CFLAGS) AC_MSG_CHECKING(for Ruby header)