autotools.py: pic flags for %nvhpc (#29920)

This commit is contained in:
Harmen Stoppels 2022-04-07 14:52:47 +02:00 committed by GitHub
parent 656074a96d
commit 43577beb9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,7 +76,7 @@ def patch_config_files(self):
or self.spec.satisfies('target=riscv64:'))
#: Whether or not to update ``libtool``
#: (currently only for Arm/Clang/Fujitsu compilers)
#: (currently only for Arm/Clang/Fujitsu/NVHPC compilers)
patch_libtool = True
#: Targets for ``make`` during the :py:meth:`~.AutotoolsPackage.build`
@ -252,7 +252,7 @@ def _set_autotools_environment_variables(self):
def _do_patch_libtool(self):
"""If configure generates a "libtool" script that does not correctly
detect the compiler (and patch_libtool is set), patch in the correct
flags for the Arm, Clang/Flang, and Fujitsu compilers."""
flags for the Arm, Clang/Flang, Fujitsu and NVHPC compilers."""
# Exit early if we are required not to patch libtool
if not self.patch_libtool:
@ -263,9 +263,12 @@ def _do_patch_libtool(self):
self._patch_libtool(libtool_path)
def _patch_libtool(self, libtool_path):
if self.spec.satisfies('%arm')\
or self.spec.satisfies('%clang')\
or self.spec.satisfies('%fj'):
if (
self.spec.satisfies('%arm') or
self.spec.satisfies('%clang') or
self.spec.satisfies('%fj') or
self.spec.satisfies('%nvhpc')
):
fs.filter_file('wl=""\n', 'wl="-Wl,"\n', libtool_path)
fs.filter_file('pic_flag=""\n',
'pic_flag="{0}"\n'