From b1781ad338842d4e91d8c851986e8e1a78986fe8 Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Sat, 29 Apr 2023 11:13:26 +0200 Subject: [PATCH] Do not requires GNU mktemp Historically the GNU mktemp was the first one which doesn't requires `-t` to create a directory. Here I've introduced a fallback when `-t` is required. For example MacPorts contains similar patch: https://github.com/macports/macports-ports/blob/bbe8abfe26651cc46d496bf48ecda506faa40a4a/math/OpenBLAS/files/patch-MacOSX-mktemp.diff --- c_check | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/c_check b/c_check index 232adba67..8b633ab8b 100755 --- a/c_check +++ b/c_check @@ -168,7 +168,7 @@ fi no_msa=0 if [ "$architecture" = "mips" ] || [ "$architecture" = "mips64" ]; then - tmpd="$(mktemp -d)" + tmpd=$(mktemp -d 2>/dev/null || mktemp -d -t 'OBC') tmpf="$tmpd/a.c" code='"addvi.b $w0, $w1, 1"' msa_flags='-mmsa -mfp64 -mload-store-pairs' @@ -208,7 +208,7 @@ esac no_avx512=0 if [ "$architecture" = "x86" ] || [ "$architecture" = "x86_64" ]; then - tmpd=`mktemp -d` + tmpd=$(mktemp -d 2>/dev/null || mktemp -d -t 'OBC') tmpf="$tmpd/a.c" code='"vbroadcastss -4 * 4(%rsi), %zmm2"' printf "#include \n\nint main(void){ __asm__ volatile(%s); }\n" "$code" >> "$tmpf" @@ -229,7 +229,7 @@ fi no_rv64gv=0 if [ "$architecture" = "riscv64" ]; then - tmpd=`mktemp -d` + tmpd=$(mktemp -d 2>/dev/null || mktemp -d -t 'OBC') tmpf="$tmpd/a.c" code='"vsetvli zero, zero, e8, m1\n"' printf "int main(void){ __asm__ volatile(%s); }\n" "$code" >> "$tmpf" @@ -245,7 +245,7 @@ fi no_sve=0 if [ "$architecture" = "arm64" ]; then - tmpd=`mktemp -d` + tmpd=$(mktemp -d 2>/dev/null || mktemp -d -t 'OBC') tmpf="$tmpd/a.c" printf "#include \n\n int main(void){}\n">> "$tmpf" args=" -march=armv8-a+sve -c -o $tmpf.o $tmpf" @@ -261,7 +261,7 @@ fi c11_atomics=0 case "$data" in *HAVE_C11*) - tmpd=`mktemp -d` + tmpd=$(mktemp -d 2>/dev/null || mktemp -d -t 'OBC') tmpf="$tmpd/a.c" printf "#include \nint main(void){}\n" >> "$tmpf" args=" -c -o $tmpf.o $tmpf"