Skip to content

Commit 1852ef4

Browse files
committed
Fail if the Ruby specified with --with-baseruby is too old
If the baseruby is explicitly specified, fail because the option is not accepted if it does not meet the requirements. If the option is not specified, just display the warning and continue, in the hope that it is not needed. Follow up rubyGH-15809
1 parent 725e3d0 commit 1852ef4

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

configure.ac

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,17 @@ AC_ARG_WITH(baseruby,
8383
],
8484
[
8585
AC_PATH_PROG([BASERUBY], [ruby], [false])
86+
HAVE_BASERUBY=
8687
])
87-
AS_IF([test "$HAVE_BASERUBY" != no], [
88-
RUBYOPT=- $BASERUBY --disable=gems "${tooldir}/missing-baseruby.bat" --verbose || HAVE_BASERUBY=no
88+
AS_IF([test "$HAVE_BASERUBY" = no], [
89+
# --without-baseruby
90+
], [error=`RUBYOPT=- $BASERUBY --disable=gems "${tooldir}/missing-baseruby.bat" --verbose 2>&1`], [
91+
HAVE_BASERUBY=yes
92+
], [test "$HAVE_BASERUBY" = ""], [ # no --with-baseruby option
93+
AC_MSG_WARN($error) # just warn and continue
94+
HAVE_BASERUBY=no
95+
], [ # the ruby given by --with-baseruby is too old
96+
AC_MSG_ERROR($error) # bail out
8997
])
9098
AS_IF([test "${HAVE_BASERUBY:=no}" != no], [
9199
AS_CASE(["$build_os"], [mingw*], [

win32/configure.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ goto :loop ;
208208
shift
209209
goto :loop ;
210210
:baseruby
211-
echo>> %config_make% HAVE_BASERUBY =
211+
echo>> %config_make% HAVE_BASERUBY = yes
212212
echo>> %config_make% BASERUBY = %~2
213213
echo>>%confargs% %1=%2 \
214214
shift

win32/setup.mak

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ MAKEFILE = Makefile
2424
CPU = PROCESSOR_LEVEL
2525
CC = $(CC) -nologo -source-charset:utf-8
2626
CPP = $(CC) -EP
27+
!if "$(HAVE_BASERUBY)" != "no" && "$(BASERUBY)" == ""
28+
BASERUBY = ruby
29+
!endif
2730

2831
all: -prologue- -generic- -epilogue-
2932
i386-mswin32: -prologue- -i386- -epilogue-
@@ -46,8 +49,8 @@ prefix = $(prefix:\=/)
4649
<<
4750
@type $(config_make) >>$(MAKEFILE)
4851
@del $(config_make) > nul
49-
!if "$(HAVE_BASERUBY)" != "no" && "$(BASERUBY)" != ""
50-
$(BASERUBY:/=\) "$(srcdir)/tool/missing-baseruby.bat" --verbose
52+
!if "$(HAVE_BASERUBY)" != "no"
53+
@$(BASERUBY:/=\) "$(srcdir)/tool/missing-baseruby.bat" --verbose $(HAVE_BASERUBY:yes=|| exit )|| exit 0
5154
!endif
5255
!if "$(WITH_GMP)" != "no"
5356
@($(CC) $(XINCFLAGS) <<conftest.c -link $(XLDFLAGS) gmp.lib > nul && (echo USE_GMP = yes) || exit /b 0) >>$(MAKEFILE)

0 commit comments

Comments
 (0)