diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | configure.in | 20 | ||||
-rwxr-xr-x | mkconfig.rb | 6 |
3 files changed, 16 insertions, 16 deletions
@@ -1,3 +1,9 @@ +Thu Feb 5 14:26:16 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * configure.in (MAJOR, MINOR, TEENY): uses RUBY_VERSION_*. + + * mkconfig.rb (prefix): uses ruby_version in config.status. + Thu Feb 5 12:24:18 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> * array.c (rb_ary_uniq): gets rid of copying. diff --git a/configure.in b/configure.in index aba01602f..2210ac53b 100644 --- a/configure.in +++ b/configure.in @@ -63,20 +63,12 @@ fi GNU_LD=$rb_cv_prog_gnu_ld AC_SUBST(GNU_LD)]) -unset GREP_OPTIONS -rb_version=`grep '^#define RUBY_VERSION ' $srcdir/version.h` -MAJOR=`expr "$rb_version" : '#define RUBY_VERSION "\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*"'` -MINOR=`expr "$rb_version" : '#define RUBY_VERSION "[0-9][0-9]*\.\([0-9][0-9]*\)\.[0-9][0-9]*"'` -TEENY=`expr "$rb_version" : '#define RUBY_VERSION "[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\)"'` -if test "$MAJOR" = ""; then - AC_MSG_ERROR(could not determine MAJOR number from version.h) -fi -if test "$MINOR" = ""; then - AC_MSG_ERROR(could not determine MINOR number from version.h) -fi -if test "$TEENY" = ""; then - AC_MSG_ERROR(could not determine TEENY number from version.h) -fi +eval `sed -n 's/^#define RUBY_VERSION_\([A-Z][A-Z_0-9]*\) \([0-9][0-9]*\)/\1=\2/p' $srcdir/version.h` +for v in MAJOR MINOR TEENY; do + if eval "test \"\$$v\" = ''"; then + AC_MSG_ERROR(could not determine $v number from version.h) + fi +done AC_SUBST(MAJOR) AC_SUBST(MINOR) AC_SUBST(TEENY) diff --git a/mkconfig.rb b/mkconfig.rb index c27c21055..fb608137e 100755 --- a/mkconfig.rb +++ b/mkconfig.rb @@ -101,6 +101,8 @@ File.foreach "config.status" do |line| has_version = true when "PATCHLEVEL" has_patchlevel = true + when "ruby_version" + version = val[/\A"(.*)"\z/, 1] end end # break if /^CEOF/ @@ -108,14 +110,14 @@ end drive = File::PATH_SEPARATOR == ';' -prefix = '/lib/ruby/' + RUBY_VERSION + '/' + RUBY_PLATFORM +prefix = "/lib/ruby/#{version}/#{RUBY_PLATFORM}" print " TOPDIR = File.dirname(__FILE__).chomp!(#{prefix.dump})\n" print " DESTDIR = ", (drive ? "TOPDIR && TOPDIR[/\\A[a-z]:/i] || " : ""), "'' unless defined? DESTDIR\n" print " CONFIG = {}\n" print " CONFIG[\"DESTDIR\"] = DESTDIR\n" unless has_version - RUBY_VERSION.scan(/(\d+)\.(\d+)\.(\d+)/) { + version.scan(/(\d+)\.(\d+)(?:\.(\d+))?/) { print " CONFIG[\"MAJOR\"] = \"" + $1 + "\"\n" print " CONFIG[\"MINOR\"] = \"" + $2 + "\"\n" print " CONFIG[\"TEENY\"] = \"" + $3 + "\"\n" |