From 4f4348b71f5f899aa66216695a7ca7b8ae1cd676 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Mon, 6 Jun 2022 21:33:19 +1000 Subject: [PATCH] on freebsd replace the first part of archname with `uname -p` On FreeBSD C produces "powerpc" for all of 32-bit power pc, 32-powerpc little endian, 64-bit powerpc and 64-bit powerpc little endian, which means we produce the same archname for all 4 of those incompatible architectures. To avoid that, if no -Darchname has been supplied, the FreeBSD hints now creates an archname.cbu to postprocess archname replacing a leading "`uname -m`-" with "`uname -p`-" which does distinguish between the different architectures. This change isn't suitable for all non-FreeBSD systems, on Linux at least, C is "unknown" on my x86_64 machine. Fixes #19791 --- hints/freebsd.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hints/freebsd.sh b/hints/freebsd.sh index 72db521ef75e..bbde9d497876 100644 --- a/hints/freebsd.sh +++ b/hints/freebsd.sh @@ -352,3 +352,18 @@ arm|mips) test "$optimize" || optimize='-O2' ;; esac + +# don't modify a supplied -Darchname +case "$archname" in +'') + cat > UU/archname.cbu <<'EOCBU' +unamem=`uname -m` +case "$archname" in +"$unamem"-*) + arch=`uname -p` + archname=`echo "$archname" | sed -e "s/^$unamem-/$arch-/"` + ;; +esac +EOCBU + ;; +esac