Skip to content
Prev 11175 / 12125 Next

[R-pkg-devel] SystemRequirements & configure check for FFTW with single precision support

Lukas,

I have not seen the communication so I'm not commenting on that specifically, I only looked at the GitHub link.

Although your configure could be improved (more below), it works well enough to detect fftw3f.

Unfortunately, SystemRequirements don't have a well-defined structure, but there are two commonly used notations:

a) library name and version so in your case that would be something like
libfftw3f (>=3.3.0)

b) deb/rpm package names
libfftw3-dev (deb), fftw3-devel (rpm)

fftw is a bit of a mess, because Debian ships the single-precision static library in libfftw3-dev, but also has libfftw3-single3 which is the dynamic version of the same, while RH does not distinguish. macOS recipe names are usually included only if they are non-obvious, but that would be the case here since installing fftw recipe does not work for you, so mentioning fftw-s is probably a good idea (there are community scripts that try to extract that information from the packages so that the dependencies can be installed).

As for your configure, my main objection would be that it ignores CPPFLAGS (they are not substituted at all even though they *are* used in the tests) and doesn't use pkg-config to get the correct flags. (Also the brew part should go - it's makes unwarranted assumptions [see below] and is entirely superfluous if you use pkg-config instead.) To illustrate what I mean, you get

$ pkg-config --cflags fftw3f
-I/opt/R/x86_64/include
$ pkg-config --libs fftw3f
-L/opt/R/x86_64/lib -lfftw3f -lm

while fCWTr on GitHub only uses

  Configuration for fCWTr 0.2.9000

    cppflags:    
    cxxflags:    
    ldflags:   
    libs:     -lfftw3f    

It actually works despite that, because R will inject the other flags for you, but that will only work is fftw is installed in the same location as the other libraries used by R (which is common, but not guaranteed). I wouldn't say it is dealbreaker, but it would recommend it for robustness.

FWIW with homebrew the correct flags are obtainable from pkg-config:

$ pkg-config --libs fftw3f
-L/opt/brew/Cellar/fftw/3.3.8_1/lib -lfftw3f
$ pkg-config --cflags fftw3f
-I/opt/brew/Cellar/fftw/3.3.8_1/include

Cheers,
Simon