[DTrace-devel] [PATCH 2/5] build: get the architecture from gcc -dumpmachine, not uname -m

Kris Van Hees kris.van.hees at oracle.com
Thu Dec 21 19:17:46 UTC 2023


On Wed, Nov 29, 2023 at 04:08:26PM +0000, Nick Alcock wrote:
> This makes it at least *possible* to support cross-compilation.
> It doesn't mean we do support it, but it's the first necessary
> prerequisite for such support.

I would leave this out for now and only do it once we need it.  Especially
since we don;t even know whether cross compilation would work.  Let's do this
if/when cross compilation becomes something we need to support.

> Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
> ---
>  GNUmakefile | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/GNUmakefile b/GNUmakefile
> index 2ffd4c497886..c987a1ee19b7 100644
> --- a/GNUmakefile
> +++ b/GNUmakefile
> @@ -18,12 +18,13 @@ VERSION := 2.0.0
>  
>  # Verify supported hardware.
>  
> -ARCH := $(shell uname -m)
> +ARCHOS := $(shell gcc -dumpmachine | sed 's,-redhat,,; s,-unknown,,; s,-pc,,; s,-gnu$$,,')
> +ARCH := $(subst -linux,,$(ARCHOS))
>  
> -$(if $(subst sparc64,,$(subst aarch64,,$(subst x86_64,,$(ARCH)))), \
> +$(if $(subst sparc64-linux,,$(subst aarch64-linux,,$(subst x86_64-linux,,$(ARCHOS)))), \
>      $(error "Error: DTrace for Linux only supports x86_64, ARM64 and sparc64"),)
> -$(if $(subst Linux,,$(shell uname -s)), \
> -    $(error "Error: DTrace only supports Linux"),)
> +$(if $(filter %-linux,$(ARCHOS)),, \
> +    $(error "Error: DTrace only supports Linux"))
>  
>  CFLAGS ?= -O2 -Wall -pedantic -Wno-unknown-pragmas
>  LDFLAGS ?=
> -- 
> 2.42.0.271.g85384428f1
> 
> 



More information about the DTrace-devel mailing list