From 24513fe21eddef33d513413c0541d8935ec5ad80 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 22 Mar 2012 02:17:30 +0000 Subject: [PATCH] workaround for mingw * lib/mkmf.rb (try_link0, try_compile, try_cpp): check if the target file get created actually. workaround for the case that the exit status of a cygwin program seems lost on mingw. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/mkmf.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 231091ee48..a0cd26a871 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -482,7 +482,7 @@ MSG end else try_do(src, cmd, *opts, &b) - end + end and File.executable?("conftest#{$EXEEXT}") end # Returns whether or not the +src+ can be compiled as a C source and linked @@ -511,7 +511,8 @@ MSG # [+src+] a String which contains a C source # [+opt+] a String which contains compiler options def try_compile(src, opt="", *opts, &b) - with_werror(opt, *opts) {|_opt, *_opts| try_do(src, cc_command(_opt), *_opts, &b)} + with_werror(opt, *opts) {|_opt, *_opts| try_do(src, cc_command(_opt), *_opts, &b)} and + File.file?("conftest.#{$OBJEXT}") ensure MakeMakefile.rm_f "conftest*" end @@ -526,7 +527,8 @@ MSG # [+src+] a String which contains a C source # [+opt+] a String which contains preprocessor options def try_cpp(src, opt="", *opts, &b) - try_do(src, cpp_command(CPPOUTFILE, opt), *opts, &b) + try_do(src, cpp_command(CPPOUTFILE, opt), *opts, &b) and + File.file?("conftest.i") ensure MakeMakefile.rm_f "conftest*" end @@ -2242,6 +2244,7 @@ site-install-rb: install-rb $DLDFLAGS = with_config("dldflags", arg_config("DLDFLAGS", config["DLDFLAGS"])).dup $LIBEXT = config['LIBEXT'].dup $OBJEXT = config["OBJEXT"].dup + $EXEEXT = config["EXEEXT"].dup $LIBS = "#{config['LIBS']} #{config['DLDLIBS']}" $LIBRUBYARG = "" $LIBRUBYARG_STATIC = config['LIBRUBYARG_STATIC']