FBSD: Handle amd64 in host triplet

In ostype.m4 and sysname.m4, we detect amd64 FreeBSD by matching $host
against "x86_64-*-freebsd*". On FreeBSD, `uname -p` on these systems
prints "amd64", but the config.guess from the GNU config project (that
is, <https://savannah.gnu.org/projects/config/>) translates amd64 into
x86_64 for FreeBSD, and has for a very long time.

For whatever (historical) reasons, anything built from FreeBSD ports
uses a version of the config.guess script that has FreeBSD-specific
modifications (which lives in /usr/ports/Templates/config.guess). This
version does not translate amd64 into x86_64, and so our $host looks
like, for example:

    $ sh /usr/ports/Templates/config.guess
    amd64-unknown-freebsd12.3

If regen.sh is run on a FreeBSD host, we pull our config.guess from
libtool, which normally is built from FreeBSD ports, and so results in
a host triplet with "amd64" for amd64 hosts. And so the build breaks
early on, because we don't recognize that we're on FreeBSD.

To accommodate this, match our amd64 FreeBSD host triplets against
amd64 or x86_64, so we can build using a config.guess from FreeBSD or
GNU upstream.

Change-Id: I372c9c9150b6639fa0cda96052cf50eb2857a3bb
Reviewed-on: https://gerrit.openafs.org/15159
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Måns Nilsson <mansaxel@besserwisser.org>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
This commit is contained in:
Andrew Deason 2022-10-25 13:24:58 -05:00
parent 9c75cc4579
commit cbc16cec1a
2 changed files with 2 additions and 2 deletions

View File

@ -58,7 +58,7 @@ case $system in
MKAFS_OSTYPE=FBSD
AC_MSG_RESULT(i386_fbsd)
;;
x86_64-*-freebsd*)
x86_64-*-freebsd* | amd64-*-freebsd*)
MKAFS_OSTYPE=FBSD
AC_MSG_RESULT(amd64_fbsd)
;;

View File

@ -28,7 +28,7 @@ else
vm=${v#*.}
AFS_SYSNAME="i386_fbsd_${vM}${vm}"
;;
x86_64-*-freebsd*.*)
x86_64-*-freebsd*.* | amd64-*-freebsd*.*)
v=${host#*freebsd}
vM=${v%.*}
vm=${v#*.}