summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--configure.in20
-rwxr-xr-xmkconfig.rb6
3 files changed, 16 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 31232532ff..c00a17ca32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 aba01602fd..2210ac53b4 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 c27c210557..fb608137e5 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"