From c42528fac2ae3620729b75c196662f97d665f88e Mon Sep 17 00:00:00 2001 From: Tom Payerle Date: Wed, 30 Jan 2019 22:18:10 -0500 Subject: 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. --- var/spack/repos/builtin/packages/fftw/package.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/var/spack/repos/builtin/packages/fftw/package.py b/var/spack/repos/builtin/packages/fftw/package.py index 45a481153e..709ad64af4 100644 --- a/var/spack/repos/builtin/packages/fftw/package.py +++ b/var/spack/repos/builtin/packages/fftw/package.py @@ -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 @@ class Fftw(AutotoolsPackage): 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 @@ class Fftw(AutotoolsPackage): 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 @@ class Fftw(AutotoolsPackage): 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 @@ class Fftw(AutotoolsPackage): 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") -- cgit v1.2.3-70-g09d2