diff --git a/.github/workflows/test-action.yaml b/.github/workflows/test-action.yaml index fb97a78..f2898a4 100644 --- a/.github/workflows/test-action.yaml +++ b/.github/workflows/test-action.yaml @@ -44,4 +44,4 @@ jobs: upstream: https://github.com/researchapps/spack branch: develop pull_request: false - open_issue: false + open_issue: false \ No newline at end of file diff --git a/packages/m4/checks-198.sysval.1.patch b/packages/m4/checks-198.sysval.1.patch new file mode 100644 index 0000000..3731fd8 --- /dev/null +++ b/packages/m4/checks-198.sysval.1.patch @@ -0,0 +1,27 @@ +From a1354086d92efa06f5866b008a019f6d801367ca Mon Sep 17 00:00:00 2001 +From: Eric Blake +Date: Sat, 29 May 2021 06:51:53 -0500 +Subject: doc: Minor formatting tweak. + +* doc/m4.texi (Sysval): Fix overfull /hbox. +--- + doc/m4.texi | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/doc/m4.texi b/doc/m4.texi +index 94ac851d..247f2be5 100644 +--- a/doc/m4.texi ++++ b/doc/m4.texi +@@ -6756,7 +6756,8 @@ ifdef(`__unix__', , + ')m4exit(`77')')dnl + changequote(`[', `]') + @result{} +-syscmd([/bin/sh -c 'kill -9 $$'; st=$?; test $st = 137 || test $st = 265]) ++syscmd([/bin/sh -c 'kill -9 $$'; st=$?; ++test $st = 137 || test $st = 265]) + @result{} + ifelse(sysval, [0], , [errprint([ skipping: shell does not send signal 9 + ])m4exit([77])])dnl +-- +cgit v1.2.1 + diff --git a/packages/m4/checks-198.sysval.2.patch b/packages/m4/checks-198.sysval.2.patch new file mode 100644 index 0000000..e71273e --- /dev/null +++ b/packages/m4/checks-198.sysval.2.patch @@ -0,0 +1,31 @@ +From cd7f4d153ccccf601751e9fa82424412f6ecfc96 Mon Sep 17 00:00:00 2001 +From: Eric Blake +Date: Tue, 1 Jun 2021 08:10:51 -0500 +Subject: tests: Fix 198.sysval + +In my attempt to avoid test failures on Haiku, I caused test failures +on platforms where sh is noisy when reporting a killed sub-process. + +* doc/m4.texi (Sysval): Avoid stderr noise during test. +Fixes: 17011ea76a (tests: Skip signal detection on Haiku) +Fixes: https://lists.gnu.org/archive/html/bug-m4/2021-05/msg00029.html +--- + doc/m4.texi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/doc/m4.texi b/doc/m4.texi +index 247f2be5..3b833b2a 100644 +--- a/doc/m4.texi ++++ b/doc/m4.texi +@@ -6756,7 +6756,7 @@ ifdef(`__unix__', , + ')m4exit(`77')')dnl + changequote(`[', `]') + @result{} +-syscmd([/bin/sh -c 'kill -9 $$'; st=$?; ++syscmd([@{ /bin/sh -c 'kill -9 $$'; @} 2>/dev/null; st=$?; + test $st = 137 || test $st = 265]) + @result{} + ifelse(sysval, [0], , [errprint([ skipping: shell does not send signal 9 +-- +cgit v1.2.1 + diff --git a/packages/m4/gnulib-pgi.patch b/packages/m4/gnulib-pgi.patch new file mode 100644 index 0000000..059d897 --- /dev/null +++ b/packages/m4/gnulib-pgi.patch @@ -0,0 +1,195 @@ +Port to PGI 16.10 x86-64 + +This patch fixes one real bug in gl_anylinked_list2.h, along with some minor +glitches that are not bugs. It does not silence PGI's thousands of bogus +warnings when compiling test-intprops.c. Fortunately, the warnings do not +cause a failure. + +* lib/c-ctype.h (_C_CTYPE_LOWER_A_THRU_F_N, _C_CTYPE_LOWER_N): Rename parameter + to avoid PGI warning about '#define f(n) 'n''. My goodness, PGI goes back a + long ways - this predates C89! +* lib/gl_anylinked_list2.h (ASYNCSAFE): Fix bug caught by PGI. For example, + ASYNCSAFE (const void *) should expand to 'const void *volatile', not to + 'volatile const void *'. +* lib/spawn.in.h (POSIX_SPAWN_USEVFORK): Don't define if already defined. +* lib/verify.h (verify) [!__GNUC__]: Use shorter albeit meaningless string to + bypass silly compiler limits. +* tests/infinity.h (Infinityf, Infinityd, Infinityl) [__PGI]: +* tests/nan.h (NaNf, NaNd, NaNl): Use static functions to avoid misguided + compiler diagnostics. Is there some reason we don’t use static functions + on all platforms? + +diff --git a/lib/c-ctype.h b/lib/c-ctype.h +index bdca1f1..ec6a3a0 100644 +--- a/lib/c-ctype.h ++++ b/lib/c-ctype.h +@@ -115,16 +115,16 @@ extern "C" { + + /* Cases for lowercase hex letters, and lowercase letters, all offset by N. */ + +-#define _C_CTYPE_LOWER_A_THRU_F_N(n) \ +- case 'a' + (n): case 'b' + (n): case 'c' + (n): case 'd' + (n): \ +- case 'e' + (n): case 'f' + (n) +-#define _C_CTYPE_LOWER_N(n) \ +- _C_CTYPE_LOWER_A_THRU_F_N(n): \ +- case 'g' + (n): case 'h' + (n): case 'i' + (n): case 'j' + (n): \ +- case 'k' + (n): case 'l' + (n): case 'm' + (n): case 'n' + (n): \ +- case 'o' + (n): case 'p' + (n): case 'q' + (n): case 'r' + (n): \ +- case 's' + (n): case 't' + (n): case 'u' + (n): case 'v' + (n): \ +- case 'w' + (n): case 'x' + (n): case 'y' + (n): case 'z' + (n) ++#define _C_CTYPE_LOWER_A_THRU_F_N(N) \ ++ case 'a' + (N): case 'b' + (N): case 'c' + (N): case 'd' + (N): \ ++ case 'e' + (N): case 'f' + (N) ++#define _C_CTYPE_LOWER_N(N) \ ++ _C_CTYPE_LOWER_A_THRU_F_N(N): \ ++ case 'g' + (N): case 'h' + (N): case 'i' + (N): case 'j' + (N): \ ++ case 'k' + (N): case 'l' + (N): case 'm' + (N): case 'n' + (N): \ ++ case 'o' + (N): case 'p' + (N): case 'q' + (N): case 'r' + (N): \ ++ case 's' + (N): case 't' + (N): case 'u' + (N): case 'v' + (N): \ ++ case 'w' + (N): case 'x' + (N): case 'y' + (N): case 'z' + (N) + + /* Cases for hex letters, digits, lower, punct, and upper. */ + +diff --git a/lib/gl_anylinked_list2.h b/lib/gl_anylinked_list2.h +index c249f31..4545da9 100644 +--- a/lib/gl_anylinked_list2.h ++++ b/lib/gl_anylinked_list2.h +@@ -29,7 +29,7 @@ + and we use 'volatile' assignments to prevent the compiler from reordering + such assignments. */ + #ifdef SIGNAL_SAFE_LIST +-# define ASYNCSAFE(type) *(volatile type *)& ++# define ASYNCSAFE(type) *(type volatile *)& + #else + # define ASYNCSAFE(type) + #endif +diff --git a/lib/spawn.in.h b/lib/spawn.in.h +index e8116f9..b4b9197 100644 +--- a/lib/spawn.in.h ++++ b/lib/spawn.in.h +@@ -142,7 +142,8 @@ typedef struct + # endif + #endif + /* A GNU extension. Use the next free bit position. */ +-#define POSIX_SPAWN_USEVFORK \ ++#ifndef POSIX_SPAWN_USEVFORK ++# define POSIX_SPAWN_USEVFORK \ + ((POSIX_SPAWN_RESETIDS | (POSIX_SPAWN_RESETIDS - 1) \ + | POSIX_SPAWN_SETPGROUP | (POSIX_SPAWN_SETPGROUP - 1) \ + | POSIX_SPAWN_SETSIGDEF | (POSIX_SPAWN_SETSIGDEF - 1) \ +@@ -152,6 +153,7 @@ typedef struct + | POSIX_SPAWN_SETSCHEDULER \ + | (POSIX_SPAWN_SETSCHEDULER > 0 ? POSIX_SPAWN_SETSCHEDULER - 1 : 0)) \ + + 1) ++#endif + #if !GNULIB_defined_verify_POSIX_SPAWN_USEVFORK_no_overlap + typedef int verify_POSIX_SPAWN_USEVFORK_no_overlap + [(((POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP +diff --git a/lib/verify.h b/lib/verify.h +index dcaf7ca..dcba9c8 100644 +--- a/lib/verify.h ++++ b/lib/verify.h +@@ -248,7 +248,12 @@ template + /* Verify requirement R at compile-time, as a declaration without a + trailing ';'. */ + +-#define verify(R) _GL_VERIFY (R, "verify (" #R ")") ++#ifdef __GNUC__ ++# define verify(R) _GL_VERIFY (R, "verify (" #R ")") ++#else ++/* PGI barfs if R is long. Play it safe. */ ++# define verify(R) _GL_VERIFY (R, "verify (...)") ++#endif + + #ifndef __has_builtin + # define __has_builtin(x) 0 +diff --git a/tests/infinity.h b/tests/infinity.h +index 431f700..ef5d3bd 100644 +--- a/tests/infinity.h ++++ b/tests/infinity.h +@@ -18,8 +18,9 @@ + /* Infinityf () returns a 'float' +Infinity. */ + + /* The Microsoft MSVC 9 compiler chokes on the expression 1.0f / 0.0f. +- The IBM XL C compiler on z/OS complains. */ +-#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) ++ The IBM XL C compiler on z/OS complains. ++ PGI 16.10 complains. */ ++#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI + static float + Infinityf () + { +@@ -34,8 +35,9 @@ Infinityf () + /* Infinityd () returns a 'double' +Infinity. */ + + /* The Microsoft MSVC 9 compiler chokes on the expression 1.0 / 0.0. +- The IBM XL C compiler on z/OS complains. */ +-#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) ++ The IBM XL C compiler on z/OS complains. ++ PGI 16.10 complains. */ ++#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI + static double + Infinityd () + { +@@ -50,8 +52,9 @@ Infinityd () + /* Infinityl () returns a 'long double' +Infinity. */ + + /* The Microsoft MSVC 9 compiler chokes on the expression 1.0L / 0.0L. +- The IBM XL C compiler on z/OS complains. */ +-#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) ++ The IBM XL C compiler on z/OS complains. ++ PGI 16.10 complains. */ ++#if defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI + static long double + Infinityl () + { +diff --git a/tests/nan.h b/tests/nan.h +index 48236b5..b5a0f29 100644 +--- a/tests/nan.h ++++ b/tests/nan.h +@@ -25,8 +25,11 @@ + /* NaNf () returns a 'float' not-a-number. */ + + /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke +- on the expression 0.0 / 0.0. The IBM XL C compiler on z/OS complains. */ +-#if defined __DECC || defined _MSC_VER || (defined __MVS__ && defined __IBMC__) ++ on the expression 0.0 / 0.0. The IBM XL C compiler on z/OS complains. ++ PGI 16.10 complains. */ ++#if (defined __DECC || defined _MSC_VER \ ++ || (defined __MVS__ && defined __IBMC__) \ ++ || defined __PGI) + static float + NaNf () + { +@@ -41,8 +44,11 @@ NaNf () + /* NaNd () returns a 'double' not-a-number. */ + + /* The Compaq (ex-DEC) C 6.4 compiler and the Microsoft MSVC 9 compiler choke +- on the expression 0.0 / 0.0. The IBM XL C compiler on z/OS complains. */ +-#if defined __DECC || defined _MSC_VER || (defined __MVS__ && defined __IBMC__) ++ on the expression 0.0 / 0.0. The IBM XL C compiler on z/OS complains. ++ PGI 16.10 complains. */ ++#if (defined __DECC || defined _MSC_VER \ ++ || (defined __MVS__ && defined __IBMC__) \ ++ || defined __PGI) + static double + NaNd () + { +@@ -59,14 +65,15 @@ NaNd () + /* On Irix 6.5, gcc 3.4.3 can't compute compile-time NaN, and needs the + runtime type conversion. + The Microsoft MSVC 9 compiler chokes on the expression 0.0L / 0.0L. +- The IBM XL C compiler on z/OS complains. */ ++ The IBM XL C compiler on z/OS complains. ++ PGI 16.10 complains. */ + #ifdef __sgi + static long double NaNl () + { + double zero = 0.0; + return zero / zero; + } +-#elif defined _MSC_VER || (defined __MVS__ && defined __IBMC__) ++#elif defined _MSC_VER || (defined __MVS__ && defined __IBMC__) || defined __PGI + static long double + NaNl () + { diff --git a/packages/m4/nvhpc-1.4.19.patch b/packages/m4/nvhpc-1.4.19.patch new file mode 100644 index 0000000..ee9398b --- /dev/null +++ b/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 . */ +-#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/packages/m4/nvhpc-long-width.patch b/packages/m4/nvhpc-long-width.patch new file mode 100644 index 0000000..1dceb3a --- /dev/null +++ b/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 + #include + ++#ifndef __LONG_WIDTH__ ++#if LONG_WIDTH ++#define __LONG_WIDTH__ LONG_WIDTH ++#else ++#define __LONG_WIDTH__ __WORDSIZE ++#endif ++#endif ++ + #if defined DEBUG && DEBUG != 0 + # include + # define DEBUG_ASSERT(x) assert (x) diff --git a/packages/m4/nvhpc.patch b/packages/m4/nvhpc.patch new file mode 100644 index 0000000..2fc74f4 --- /dev/null +++ b/packages/m4/nvhpc.patch @@ -0,0 +1,34 @@ +--- a/lib/xalloc-oversized.h 2020-08-07 11:04:56.154698639 -0700 ++++ b/lib/xalloc-oversized.h 2020-08-07 11:06:11.667997389 -0700 +@@ -46,13 +46,13 @@ + positive and N must be nonnegative. This is a macro, not a + function, so that it works correctly even when SIZE_MAX < N. */ + +-#if 7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p) ++#if ((7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) && !defined __NVCOMPILER) + # define xalloc_oversized(n, s) \ + __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) + #elif ((5 <= __GNUC__ \ + || (__has_builtin (__builtin_mul_overflow) \ + && __has_builtin (__builtin_constant_p))) \ +- && !__STRICT_ANSI__) ++ && !__STRICT_ANSI__ && !defined __NVCOMPILER) + # define xalloc_oversized(n, s) \ + (__builtin_constant_p (n) && __builtin_constant_p (s) \ + ? __xalloc_oversized (n, s) \ +--- a/lib/intprops.h 2020-08-07 11:06:15.508012580 -0700 ++++ b/lib/intprops.h 2020-08-07 11:07:54.379403731 -0700 +@@ -242,11 +242,11 @@ + + /* True if __builtin_add_overflow (A, B, P) works when P is non-null. */ + #define _GL_HAS_BUILTIN_OVERFLOW \ +- (5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)) ++ ((5 <= __GNUC__ || __has_builtin (__builtin_add_overflow)) && !defined __NVCOMPILER) + + /* True if __builtin_add_overflow_p (A, B, C) works. */ + #define _GL_HAS_BUILTIN_OVERFLOW_P \ +- (7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) ++ ((7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) && !defined __NVCOMPILER) + + /* The _GL*_OVERFLOW macros have the same restrictions as the + *_RANGE_OVERFLOW macros, except that they do not assume that operands diff --git a/packages/m4/oneapi.patch b/packages/m4/oneapi.patch new file mode 100644 index 0000000..d659c1e --- /dev/null +++ b/packages/m4/oneapi.patch @@ -0,0 +1,18 @@ +--- a/lib/xalloc-oversized.h 2020-08-07 11:04:56.154698639 -0700 ++++ b/lib/xalloc-oversized.h 2020-08-07 11:06:11.667997389 -0700 +@@ -46,13 +46,13 @@ + positive and N must be nonnegative. This is a macro, not a + function, so that it works correctly even when SIZE_MAX < N. */ + +-#if 7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p) ++#if ((7 <= __GNUC__ || __has_builtin (__builtin_add_overflow_p)) && !defined __INTEL_LLVM_COMPILER) + # define xalloc_oversized(n, s) \ + __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) + #elif ((5 <= __GNUC__ \ + || (__has_builtin (__builtin_mul_overflow) \ + && __has_builtin (__builtin_constant_p))) \ +- && !__STRICT_ANSI__) ++ && !__STRICT_ANSI__ && !defined __INTEL_LLVM_COMPILER) + # define xalloc_oversized(n, s) \ + (__builtin_constant_p (n) && __builtin_constant_p (s) \ + ? __xalloc_oversized (n, s) \ diff --git a/packages/m4/package.py b/packages/m4/package.py new file mode 100644 index 0000000..1dad2aa --- /dev/null +++ b/packages/m4/package.py @@ -0,0 +1,127 @@ +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os +import re + +from spack.package import * + + +class M4(AutotoolsPackage, GNUMirrorPackage): + """GNU M4 is an implementation of the traditional Unix macro processor.""" + + homepage = "https://www.gnu.org/software/m4/m4.html" + gnu_mirror_path = "m4/m4-1.4.18.tar.gz" + + version("1.4.19", sha256="3be4a26d825ffdfda52a56fc43246456989a3630093cced3fbddf4771ee58a70") + version("1.4.18", sha256="ab2633921a5cd38e48797bf5521ad259bdc4b979078034a3b790d7fec5493fab") + version("1.4.17", sha256="3ce725133ee552b8b4baca7837fb772940b25e81b2a9dc92537aeaf733538c9e") + + 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 + patch("secure_snprintf.patch", when="@:1.4.18 os=highsierra") + patch("secure_snprintf.patch", when="@:1.4.18 os=mojave") + patch("secure_snprintf.patch", when="@:1.4.18 os=catalina") + patch("secure_snprintf.patch", when="@:1.4.18 os=bigsur") + # https://bugzilla.redhat.com/show_bug.cgi?id=1573342 + patch( + "https://src.fedoraproject.org/rpms/m4/raw/5d147168d4b93f38a4833f5dd1d650ad88af5a8a/f/m4-1.4.18-glibc-change-work-around.patch", + sha256="fc9b61654a3ba1a8d6cd78ce087e7c96366c290bc8d2c299f09828d793b853c8", + when="@1.4.18", + ) + # from: https://www.mail-archive.com/m4-patches@gnu.org/msg01208.html + # tests: Fix failing test checks/198.sysval with upstream patch for doc/m4.texi + patch("checks-198.sysval.1.patch", when="@1.4.19") + patch("checks-198.sysval.2.patch", when="@1.4.19") + + variant("sigsegv", default=True, description="Build the libsigsegv dependency") + + depends_on("diffutils", type="build") + depends_on("libsigsegv", when="+sigsegv") + + build_directory = "spack-build" + + tags = ["build-tools"] + + executables = ["^g?m4$"] + + @when("@1.4.19") + def patch(self): + """skip texinfo of m4.info for patched m4.texi (patched only a test in it)""" + timestamp = os.path.getmtime("doc/m4.info") + os.utime("doc/m4.texi", (timestamp, timestamp)) + + @classmethod + def determine_version(cls, exe): + # Output on macOS: + # GNU M4 1.4.6 + # Output on Linux: + # m4 (GNU M4) 1.4.18 + output = Executable(exe)("--version", output=str, error=str) + match = re.search(r"GNU M4\)?\s+(\S+)", output) + return match.group(1) if match else None + + def setup_dependent_build_environment(self, env, dependent_spec): + # Inform autom4te if it wasn't built correctly (some external + # installations such as homebrew). See + # https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/autom4te-Invocation.html + env.set("M4", self.prefix.bin.m4) + + def setup_run_environment(self, env): + env.set("M4", self.prefix.bin.m4) + + def configure_args(self): + spec = self.spec + args = ["--enable-c++"] + + if spec.satisfies("%cce@9:"): + args.append("LDFLAGS=-rtlib=compiler-rt") + + if ( + spec.satisfies("%clang") + or spec.satisfies("%aocc") + or spec.satisfies("%arm") + or spec.satisfies("%fj") + ) and not spec.satisfies("platform=darwin"): + args.append("LDFLAGS=-rtlib=compiler-rt") + + if spec.satisfies("%intel@:18"): + args.append("CFLAGS=-no-gcc") + + if "+sigsegv" in spec: + args.append("--with-libsigsegv-prefix={0}".format(spec["libsigsegv"].prefix)) + else: + args.append("--without-libsigsegv-prefix") + + # https://lists.gnu.org/archive/html/bug-m4/2016-09/msg00002.html + arch = spec.architecture + if arch.platform == "darwin" and arch.os == "sierra" and "%gcc" in spec: + args.append("ac_cv_type_struct_sched_param=yes") + + return args + + def test(self): + spec_vers = str(self.spec.version) + reason = "test: ensuring m4 version is {0}".format(spec_vers) + self.run_test( + "m4", "--version", spec_vers, installed=True, purpose=reason, skip_missing=False + ) + + reason = "test: ensuring m4 example succeeds" + test_data_dir = self.test_suite.current_test_data_dir + hello_file = test_data_dir.join("hello.m4") + expected = get_escaped_text_output(test_data_dir.join("hello.out")) + self.run_test( + "m4", hello_file, expected, installed=True, purpose=reason, skip_missing=False + ) diff --git a/packages/m4/pgi.patch b/packages/m4/pgi.patch new file mode 100644 index 0000000..1ad63e2 --- /dev/null +++ b/packages/m4/pgi.patch @@ -0,0 +1,10 @@ +--- a/lib/config.hin ++++ b/lib/config.hin +@@ -1510,6 +1510,7 @@ + ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ + : (199901L <= __STDC_VERSION__ \ + && !defined __HP_cc \ ++ && !defined __PGI \ + && !(defined __SUNPRO_C && __STDC__))) \ + && !defined _GL_EXTERN_INLINE_APPLE_BUG) + # define _GL_INLINE inline diff --git a/packages/m4/secure_snprintf.patch b/packages/m4/secure_snprintf.patch new file mode 100644 index 0000000..da3ae5b --- /dev/null +++ b/packages/m4/secure_snprintf.patch @@ -0,0 +1,15 @@ +With format string strictness, High Sierra also enforces that %n isn't used +in dynamic format strings, but we should just disable its use on darwin in +general. + +--- a/lib/vasnprintf.c.orig 2017-06-22 15:19:15.000000000 -0700 ++++ b/lib/vasnprintf.c 2017-06-22 15:20:20.000000000 -0700 +@@ -4869,7 +4869,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t * + #endif + *fbp = dp->conversion; + #if USE_SNPRINTF +-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) ++# if !defined(__APPLE__) && !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) + fbp[1] = '%'; + fbp[2] = 'n'; + fbp[3] = '\0'; diff --git a/packages/m4/test/hello.m4 b/packages/m4/test/hello.m4 new file mode 100644 index 0000000..6132c41 --- /dev/null +++ b/packages/m4/test/hello.m4 @@ -0,0 +1,4 @@ +define(NAME, World) +dnl This line should not show up +// macro is ifdef(`NAME', , not)defined +Hello, NAME! diff --git a/packages/m4/test/hello.out b/packages/m4/test/hello.out new file mode 100644 index 0000000..c8d3be7 --- /dev/null +++ b/packages/m4/test/hello.out @@ -0,0 +1,3 @@ + +// macro is defined +Hello, World!