Hello,

[[[
 fix Ruby 1.9 deprecation warning for Config, use RbConfig
 * configure.ac
   replace Config with RbConfig
 *  build/ac-macros/swig.m4
  replace Config with RbConfig
]]]

The configure script reads the Ruby major and minor version to reject
configuring swig bindings for Ruby 1.9. It does this by accessing
Config::CONFIG which is deprecated in that release.

ruby -rrbconfig -e 'print Config::CONFIG.fetch(%q(MAJOR))'
ruby -rrbconfig -e 'print Config::CONFIG.fetch(%q(MINOR))'

So instead of meaningful message we get:

checking for Ruby major version... -e:1: Use RbConfig instead of
obsolete and deprecated Config.
checking for Ruby minor version... -e:1: Use RbConfig instead of
obsolete and deprecated Config.

The same warning is triggered when trying to configure SWIG_RB_COMPILE
and SWIG_RB_LINK, although that is moot as these are useless with Ruby
1.9 anyway for now. The following works with at least Ruby 1.8:

ruby -rrbconfig -e 'print Config::RbCONFIG.fetch(%q(MAJOR))'
ruby -rrbconfig -e 'print Config::RbCONFIG.fetch(%q(MINOR))'

This was found during work on the openSUSE package. Please review,
especially concerning backwards compatibility with Ruby versions older
than 1.8.

Andreas
Index: configure.ac
===================================================================
--- configure.ac	(revision 1337403)
+++ configure.ac	(working copy)
@@ -1184,12 +1184,12 @@ if test "$RUBY" != "none"; then
       AC_PATH_PROGS(RDOC, rdoc rdoc1.8 rdoc18, none)
     fi
     AC_CACHE_CHECK([for Ruby major version], [svn_cv_ruby_major],[
-    svn_cv_ruby_major="`$RUBY -rrbconfig -e 'print Config::CONFIG.fetch(%q(MAJOR))'`"
+    svn_cv_ruby_major="`$RUBY -rrbconfig -e 'print RbConfig::CONFIG.fetch(%q(MAJOR))'`"
     ])
     RUBY_MAJOR="$svn_cv_ruby_major"
 
     AC_CACHE_CHECK([for Ruby minor version], [svn_cv_ruby_minor],[
-    svn_cv_ruby_minor="`$RUBY -rrbconfig -e 'print Config::CONFIG.fetch(%q(MINOR))'`"
+    svn_cv_ruby_minor="`$RUBY -rrbconfig -e 'print RbConfig::CONFIG.fetch(%q(MINOR))'`"
     ])
     RUBY_MINOR="$svn_cv_ruby_minor"
 
Index: build/ac-macros/swig.m4
===================================================================
--- build/ac-macros/swig.m4	(revision 1337403)
+++ build/ac-macros/swig.m4	(working copy)
@@ -187,7 +187,7 @@ AC_DEFUN(SVN_FIND_SWIG,
     for var_name in arch archdir CC LDSHARED DLEXT LIBS LIBRUBYARG \
                     rubyhdrdir sitedir sitelibdir sitearchdir libdir
     do
-      rbconfig_tmp=`$rbconfig "print Config::CONFIG@<:@'$var_name'@:>@"`
+      rbconfig_tmp=`$rbconfig "print RbConfig::CONFIG@<:@'$var_name'@:>@"`
       eval "rbconfig_$var_name=\"$rbconfig_tmp\""
     done
 

Reply via email to