OS X Sierra rbenv build errors

I just upgraded OS X Yosemite to Sierra and all seemed will until I updated rbenv with `rbenv update`, removed Ruby 2.4.0 and tried to re-install Ruby 2.4.0. The first error I hit was a readline linking problem which I resolved with:

RUBY_CONFIGURE_OPTS=--with-readline-dir="/opt/local/lib/libreadline.dylib" rbenv install -v 2.4.0

Now I'm facing something similar but can't work it out. Here's the end of the install log:

linking transcoder japanese_euc.bundle
compiling ./enc/trans/japanese_sjis.c
configuring pty
linking transcoder japanese_sjis.bundle
compiling ./enc/trans/korean.c
configuring racc/cparse
configuring rbconfig/sizeof
linking transcoder korean.bundle
compiling ./enc/trans/single_byte.c
linking transcoder single_byte.bundle
compiling ./enc/trans/utf8_mac.c
configuring readline
linking transcoder utf8_mac.bundle
compiling ./enc/trans/utf_16_32.c
linking transcoder utf_16_32.bundle
making encs
make[1]: Nothing to be done for `encs'.
configuring ripper
configuring rubyvm
configuring sdbm
configuring socket
configuring stringio
configuring strscan
configuring syslog
configuring zlib
exts.mk:1470: *** commands commence before first target. Stop.
make: *** [build-ext] Error 2

Another thing. Ruby builds seem to insist on re-compiling OpenSSL from scratch every time which takes FOREVER. So, if a build fails you have to go through the whole tedious build again. Is there no way of linking to a perfectly functional and up-to-date MacPorts/Homebrew openssl?

gvim