From: Dan Kegel Date: Tue, 30 Jun 2020 21:05:04 +0000 (-0700) Subject: configure: canonicalize CHOST. X-Git-Tag: 1.9.9-b1~130 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5aa42c7dbd45d012094049a0702fe5c596efaf6;p=thirdparty%2Fzlib-ng.git configure: canonicalize CHOST. Fixes https://github.com/zlib-ng/zlib-ng/issues/666 for all the CHOST values currently used in .github/workflows/*.yml. Also make ci's shellcheck happy by avoiding backticks in the changed lines. --- diff --git a/config.sub b/config.sub new file mode 100755 index 00000000..3d50a16f --- /dev/null +++ b/config.sub @@ -0,0 +1,17 @@ +#!/bin/sh +# Canonicalize CHOST. +# In particular, converts Debian multiarch tuples into GNU triplets. +# See also +# https://wiki.debian.org/Multiarch/Tuples +# https://wiki.gentoo.org/wiki/CHOST +# If you need an architecture not listed here, file a bug at github.com/zlib-ng/zlib-ng +# and work around the problem by dropping libtool's much more comprehensive config.sub +# on top of this file, see +# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub + +case "$1" in +*-*-linux-gnu) echo $1;; +i686-linux-gnu|x86_64-linux-gnu*) echo $1 | sed 's/-linux-gnu/-pc-linux-gnu/';; +*-linux-gnu*) echo $1 | sed 's/-linux-gnu/-unknown-linux-gnu/';; +*) echo $1;; +esac diff --git a/configure b/configure index 2cc591c1..d9ff8256 100755 --- a/configure +++ b/configure @@ -23,9 +23,11 @@ BUILDDIR=$(pwd) # set command prefix for cross-compilation if [ -n "${CHOST}" ]; then - uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`" + # normalize the chost before parsing it + NORM_CHOST=$(sh "$SRCDIR"/config.sub $CHOST) + uname="$(echo "${NORM_CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/')" CROSS_PREFIX="${CHOST}-" - ARCH="`echo "${CHOST}" | sed -e 's/-.*//'`" + ARCH="$(echo "${NORM_CHOST}" | sed -e 's/-.*//')" else ARCH="`uname -m`" fi