fftw: fix include error for 2.x versions (#10039)

Fixes #7372

Added patch method which renames config.h in the fftw subdir of the
source tree. fftw 2.1.5 appears to ship with a copy of this file
with all defines commented out. This gets read by the #include
directives instead of the version in the build directory with the
correct defines. As a result, many C preprocessor macros left
undefined, including F77_FUNC_ which causes the bulk of fttwf77.c
to be skipped due to an #ifdef, so fftw_reverse_int_array et al
not included in library. Fixes #7372

Also fixed some inconsistencies with the handling of quad and
long_double in specs between the configure method and the build,
check, and install methods.
This commit is contained in:
Tom Payerle 2019-01-30 22:18:10 -05:00 committed by Peter Scheibel
parent 2aad75d98f
commit c42528fac2

View File

@ -6,6 +6,8 @@
from spack import *
import llnl.util.lang
# os is used for rename, etc in patch()
import os
class Fftw(AutotoolsPackage):
@ -107,6 +109,13 @@ def libs(self):
return find_libraries(libraries, root=self.prefix, recursive=True)
def patch(self):
# If fftw/config.h exists in the source tree, it will take precedence
# over the copy in build dir. As only the latter has proper config
# for our build, this is a problem. See e.g. issue #7372 on github
if os.path.isfile('fftw/config.h'):
os.rename('fftw/config.h', 'fftw/config.h.SPACK_RENAMED')
def autoreconf(self, spec, prefix):
if '+pfft_patches' in spec:
autoreconf = which('autoreconf')
@ -169,10 +178,10 @@ def build(self, spec, prefix):
if '+float' in spec:
with working_dir('float'):
make()
if '+long_double' in spec:
if spec.satisfies('@3:+long_double'):
with working_dir('long-double'):
make()
if '+quad' in spec:
if spec.satisfies('@3:+quad'):
with working_dir('quad'):
make()
@ -184,10 +193,10 @@ def check(self):
if '+float' in spec:
with working_dir('float'):
make("check")
if '+long_double' in spec:
if spec.satisfies('@3:+long_double'):
with working_dir('long-double'):
make("check")
if '+quad' in spec:
if spec.satisfies('@3:+quad'):
with working_dir('quad'):
make("check")
@ -198,9 +207,9 @@ def install(self, spec, prefix):
if '+float' in spec:
with working_dir('float'):
make("install")
if '+long_double' in spec:
if spec.satisfies('@3:+long_double'):
with working_dir('long-double'):
make("install")
if '+quad' in spec:
if spec.satisfies('@3:+quad'):
with working_dir('quad'):
make("install")