summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorScott McMillan <scott.andrew.mcmillan@gmail.com>2021-08-24 12:07:03 -0500
committerGitHub <noreply@github.com>2021-08-24 17:07:03 +0000
commit107693fbd18ece0280ff1242d94a22ce37ac6ee8 (patch)
tree145f571fe0ecdb94f6ae6f764de8ca5f7632f669 /var
parent31dcdf7262316d0ab04a82af16a763888cd6439f (diff)
downloadspack-107693fbd18ece0280ff1242d94a22ce37ac6ee8.tar.gz
spack-107693fbd18ece0280ff1242d94a22ce37ac6ee8.tar.bz2
spack-107693fbd18ece0280ff1242d94a22ce37ac6ee8.tar.xz
spack-107693fbd18ece0280ff1242d94a22ce37ac6ee8.zip
m4: fixes for the NVIDIA HPC SDK (#25546)
Co-authored-by: Scott McMillan <smcmillan@nvidia.com>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/m4/nvhpc-1.4.19.patch14
-rw-r--r--var/spack/repos/builtin/packages/m4/nvhpc-long-width.patch17
-rw-r--r--var/spack/repos/builtin/packages/m4/package.py5
3 files changed, 36 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/m4/nvhpc-1.4.19.patch b/var/spack/repos/builtin/packages/m4/nvhpc-1.4.19.patch
new file mode 100644
index 0000000000..ee9398b3bb
--- /dev/null
+++ b/var/spack/repos/builtin/packages/m4/nvhpc-1.4.19.patch
@@ -0,0 +1,14 @@
+--- a/lib/intprops.h
++++ b/lib/intprops.h
+@@ -232,9 +232,9 @@
+ (A, B, P) work when P is non-null. */
+ /* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x,
+ see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98269>. */
+-#if 7 <= __GNUC__ && !defined __ICC
++#if 7 <= __GNUC__ && !defined __ICC && !defined __NVCOMPILER
+ # define _GL_HAS_BUILTIN_ADD_OVERFLOW 1
+-#elif defined __has_builtin
++#elif defined __has_builtin && !defined __NVCOMPILER
+ # define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow)
+ #else
+ # define _GL_HAS_BUILTIN_ADD_OVERFLOW 0
diff --git a/var/spack/repos/builtin/packages/m4/nvhpc-long-width.patch b/var/spack/repos/builtin/packages/m4/nvhpc-long-width.patch
new file mode 100644
index 0000000000..1dceb3a034
--- /dev/null
+++ b/var/spack/repos/builtin/packages/m4/nvhpc-long-width.patch
@@ -0,0 +1,17 @@
+--- a/lib/regex_internal.h
++++ b/lib/regex_internal.h
+@@ -39,6 +39,14 @@
+ #include <intprops.h>
+ #include <verify.h>
+
++#ifndef __LONG_WIDTH__
++#if LONG_WIDTH
++#define __LONG_WIDTH__ LONG_WIDTH
++#else
++#define __LONG_WIDTH__ __WORDSIZE
++#endif
++#endif
++
+ #if defined DEBUG && DEBUG != 0
+ # include <assert.h>
+ # define DEBUG_ASSERT(x) assert (x)
diff --git a/var/spack/repos/builtin/packages/m4/package.py b/var/spack/repos/builtin/packages/m4/package.py
index a71240e4bc..d39ac2450d 100644
--- a/var/spack/repos/builtin/packages/m4/package.py
+++ b/var/spack/repos/builtin/packages/m4/package.py
@@ -18,7 +18,12 @@ class M4(AutotoolsPackage, GNUMirrorPackage):
patch('gnulib-pgi.patch', when='@1.4.18')
patch('pgi.patch', when='@1.4.17')
+ # The NVIDIA compilers do not currently support some GNU builtins.
+ # Detect this case and use the fallback path.
patch('nvhpc.patch', when='@1.4.18 %nvhpc')
+ patch('nvhpc-1.4.19.patch', when='@1.4.19 %nvhpc')
+ # Workaround bug where __LONG_WIDTH__ is not defined
+ patch('nvhpc-long-width.patch', when='@1.4.19 %nvhpc')
patch('oneapi.patch', when='@1.4.18 %oneapi')
# from: https://github.com/Homebrew/homebrew-core/blob/master/Formula/m4.rb
# Patch credit to Jeremy Huddleston Sequoia <jeremyhu@apple.com>