[Rd] Using FPP preprocessor for Fortran Code

Michael Hahsler mhahsler at lyle.smu.edu
Sun Nov 30 07:46:59 CET 2014


Dear R Developers,

For package seriation I use Fortran code. I recently got a request to add

#if defined(__ICC) || defined(__INTEL_COMPILER)
       USE IFPORT
#endif

to the code since the Intel Fortran compiler otherwise has problems with 
rand(). However, to enable the FPP preprocessor I have to either add a 
compiler flag (-cpp for gFortran) which is possibly not portable or 
change the extension to .F, .fpp, .FPP (and a few others) which 
automatically invokes the preprocessor (hopefully on all platforms). I 
tried .fpp and added the following to Makevars:

OBJECTS=arsa.o bburcg.o bbwrcg.o bea.o criterion.o dist.o fprintf.o 
greedy.o optimal.o stress.o

%.o: %.fpp
         $(F77) $(ALL_FFLAGS) -c $< -o $@

It seems to work (I tried Linux and Windows) but R CMD check gives me:

* checking if this is a source package ... WARNING
Subdirectory ‘src’ contains:
   arsa.fpp bburcg.fpp

Is there a different preferred method to do this? Is it possible to add 
support for Fortran with the fpp preprocessor (.fpp files) to the R 
package building process?

Thanks,
Michael

-- 
   Michael Hahsler, Assistant Professor
   Department of Engineering Management, Information, and Systems
   Department of Computer Science and Engineering (by courtesy)
   Bobby B. Lyle School of Engineering
   Southern Methodist University, Dallas, Texas

   office: Caruth Hall, suite 337, room 311
   email:  mhahsler at lyle.smu.edu
   web:    http://lyle.smu.edu/~mhahsler



More information about the R-devel mailing list