Issue #10572 has been reported by Vit Ondruch.

----------------------------------------
Bug #10572: configure with custom ruby-version does not work
https://bugs.ruby-lang.org/issues/10572

* Author: Vit Ondruch
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.2.0preview2 (2014-11-28 trunk 48628) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
~~~
$ configure --with-ruby-version=foo
...
snip
...

$ make
...
snip
...

In file included from loadpath.c:12:0:
verconf.h:3:28: warning: missing terminating " character
 #define RUBY_LIB_VERSION  \"foo\"
                            ^
loadpath.c:41:1: error: stray '\' in program
 typedef char ruby_lib_version_string[(int)sizeof(RUBY_LIB_VERSION) - 2];
 ^
loadpath.c:41:51: warning: missing terminating " character
 typedef char ruby_lib_version_string[(int)sizeof(RUBY_LIB_VERSION) - 2];
                                                   ^
loadpath.c:41:1: error: missing terminating " character
 typedef char ruby_lib_version_string[(int)sizeof(RUBY_LIB_VERSION) - 2];
 ^
loadpath.c:59:12: error: expected ')' before 'ruby_exec_prefix'
 const char ruby_exec_prefix[] = RUBY_EXEC_PREFIX;
            ^
loadpath.c:68:5: error: stray '\' in program
     RUBY_SITE_LIB2 "\0"
     ^
loadpath.c:68:5: error: stray '\' in program
loadpath.c:68:51: warning: missing terminating " character
     RUBY_SITE_LIB2 "\0"
                                                   ^
loadpath.c:68:5: error: missing terminating " character
     RUBY_SITE_LIB2 "\0"
     ^
loadpath.c:72:5: error: stray '\' in program
     RUBY_SITE_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
     ^
loadpath.c:72:5: error: stray '\' in program
loadpath.c:72:68: warning: missing terminating " character
     RUBY_SITE_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
                                                                    ^
loadpath.c:72:5: error: missing terminating " character
     RUBY_SITE_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
     ^
loadpath.c:77:5: error: stray '\' in program
     RUBY_VENDOR_LIB2 "\0"
     ^
loadpath.c:77:5: error: stray '\' in program
loadpath.c:77:53: warning: missing terminating " character
     RUBY_VENDOR_LIB2 "\0"
                                                     ^
loadpath.c:77:5: error: missing terminating " character
     RUBY_VENDOR_LIB2 "\0"
     ^
loadpath.c:81:5: error: stray '\' in program
     RUBY_VENDOR_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
     ^
loadpath.c:81:5: error: stray '\' in program
loadpath.c:81:70: warning: missing terminating " character
     RUBY_VENDOR_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
                                                                      ^
loadpath.c:81:5: error: missing terminating " character
     RUBY_VENDOR_ARCH_LIB_FOR(RUBY_SITEARCH) "\0"
     ^
loadpath.c:85:5: error: stray '\' in program
     RUBY_LIB "\0"
     ^
loadpath.c:85:5: error: stray '\' in program
loadpath.c:85:38: warning: missing terminating " character
     RUBY_LIB "\0"
                                      ^
loadpath.c:85:5: error: missing terminating " character
     RUBY_LIB "\0"
     ^
loadpath.c:89:5: error: stray '\' in program
     RUBY_ARCH_LIB_FOR(RUBY_ARCH) "\0"
     ^
loadpath.c:89:5: error: stray '\' in program
loadpath.c:89:55: warning: missing terminating " character
     RUBY_ARCH_LIB_FOR(RUBY_ARCH) "\0"
                                                       ^
loadpath.c:89:5: error: missing terminating " character
     RUBY_ARCH_LIB_FOR(RUBY_ARCH) "\0"
     ^
Makefile:349: recipe for target 'loadpath.o' failed
~~~

The attached patch fix the issue for me (although I know there were some back and forth with the quotes before [1])


[1] https://github.com/ruby/ruby/commit/f13a0a4ddaad8131e9fe0a4e74108578d8a098a3

---Files--------------------------------
0001-Fix-with-ruby-version-configuration-option.patch (1.25 KB)


-- 
https://bugs.ruby-lang.org/