From: Laurent Sansonetti Date: 2008-03-17T08:48:55+09:00 Subject: [PATCH] make sure version numbers can be determined Hi, Someone reported me an installation problem, while installing MacRuby. After a long investigation, it turned out to be because the reporter was using a customized GREP_OPTIONS environment variable, set to the "--color=always" value. With that value, configure cannot determine MAJOR, MINOR and TEENY because the output of `grep RUBY_VERSION version.h' is different (probably because it contains ANSI sequences). But configure doesn't complain about that, and leave you with incomplete installation paths. I think configure should fail if one of these numbers could not be determined. Following is an attempt to do that, but I'm not an autotools expert, maybe there is a better way to do it. Laurent Index: configure.in =================================================================== --- configure.in (revision 87) +++ configure.in (working copy) @@ -67,6 +67,15 @@ 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 AC_SUBST(MAJOR) AC_SUBST(MINOR) AC_SUBST(TEENY)