R: enable shared library and test

Added an option to build R with shared library. This is necessary for use with rpy2, RSruby or similar libraries that embed R, as well as possibly other R-related software such as IDEs like RStudio.

I also added a basic test that creates a very simple .R script and runs it using r and rscript.
The only reasons I can think of is that I have seen old (2006) discussions on the R mailing list discussing a performance penalty when compiled as a shared library as well as the fact that it does not work on some platforms. That said, most of the major distributions of R including those directly from the main R website come as shared libraries, so enabling this by default would probably be more consistent with non-Homebrew R. 

It probably wouldn't be a bad idea to switch this to default to shared library with an option to omit it.