papi: check existence of a fortran compiler (#15968)

fixes #5029
This commit is contained in:
Massimiliano Culpo 2020-04-09 15:33:24 +02:00 committed by GitHub
parent 5320268033
commit e53a98cb4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,12 +2,10 @@
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import glob import glob
import os import os
import sys import sys
from llnl.util.filesystem import fix_darwin_install_name import llnl.util.filesystem as fs
class Papi(AutotoolsPackage): class Papi(AutotoolsPackage):
@ -68,6 +66,12 @@ def configure_args(self):
options.append('--with-components={0}'.format(' '.join(variants))) options.append('--with-components={0}'.format(' '.join(variants)))
return options return options
@run_before('configure')
def fortran_check(self):
if not self.compiler.fc:
msg = 'PAPI requires a Fortran compiler to build'
raise RuntimeError(msg)
@run_before('configure') @run_before('configure')
def component_configure(self): def component_configure(self):
configure_script = Executable('./configure') configure_script = Executable('./configure')
@ -92,4 +96,4 @@ def fix_darwin_install(self):
if sys.platform == 'darwin': if sys.platform == 'darwin':
os.rename(join_path(self.prefix.lib, 'libpapi.so'), os.rename(join_path(self.prefix.lib, 'libpapi.so'),
join_path(self.prefix.lib, 'libpapi.dylib')) join_path(self.prefix.lib, 'libpapi.dylib'))
fix_darwin_install_name(self.prefix.lib) fs.fix_darwin_install_name(self.prefix.lib)