Including C Code for Tcl and Tk in an R package
On 08/30/2010 03:01 AM, Prof Brian Ripley wrote:
On Mon, 30 Aug 2010, Adrian Waddell wrote:
Dear R Community, I adapted the C-Code found at (http://wiki.tcl.tk/25685) implementing fast image resizing for Tk images for my R package. The C Code differs for tcl/tk version 8.4 and 8.5. I have the working code for both versions. How do I integrate this C-Code into my package so that R CMD INSTALL takes care of compiling the function correct for each OS and tcl version? (such that I can submit the package to CRAN). Once the two files would be compiled I could load the correct function
You can't do that: very few systems will have both Tcl 8.4 and 8.5 libraries installed. So you need to use the package's configure script to detect the Tcl/Tk version and also what libraries to compile against. I'm not sure I would try to support Tcl 8.4: 8.5 has been out for a long time now and you could simply make it a package SystemRequirement. We are only support 8.4 in R because we have existing code to do so that has not yet been removed.
Thank you very much for your input. Does anybody know by any chance a package which would provide an example of such a configure script?