[DTrace-devel] [PATCH v3 9/9] build: consistently respect CC env var if set
Nick Alcock
nick.alcock at oracle.com
Fri Jan 26 13:58:49 UTC 2024
We are very close to making this work: only two places (the top-
level makefile's detgermination of the native bitness, and
the code that does the same thing in libproc/mkoffsets.sh) needed
any changes.
(The testsuite refers to /usr/bin/gcc all over the place, and is
not changed in this commit.)
Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
GNUmakefile | 5 +++--
libproc/mkoffsets.sh | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/GNUmakefile b/GNUmakefile
index 4cd0ef6a596c..47d1eb9b50d3 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -103,14 +103,15 @@ DTRACE ?= $(objdir)/dtrace
# Variables derived from the above.
+export CC = gcc
+
BITNESS := 64
-NATIVE_BITNESS_ONLY := $(shell echo 'int main (void) { }' | gcc -x c -o /dev/null -m32 - 2>/dev/null || echo t)
+NATIVE_BITNESS_ONLY := $(shell echo 'int main (void) { }' | $(CC) -x c -o /dev/null -m32 - 2>/dev/null || echo t)
ARCHINC := $(subst sparc64,sparc,$(subst aarch64,arm64,$(subst x86_64,i386,$(ARCH))))
INVARIANT_CFLAGS := -std=gnu99 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 $(if $(NATIVE_BITNESS_ONLY),-DNATIVE_BITNESS_ONLY) -D_DT_VERSION=\"$(VERSION)\"
CPPFLAGS += -Iinclude -Iuts/common -Iinclude/$(ARCHINC) -I$(objdir)
-export CC = gcc
override CFLAGS += $(INVARIANT_CFLAGS)
PREPROCESS = $(CC) -E
export BPFC = bpf-unknown-none-gcc
diff --git a/libproc/mkoffsets.sh b/libproc/mkoffsets.sh
index 938e134bdbb7..301856855128 100755
--- a/libproc/mkoffsets.sh
+++ b/libproc/mkoffsets.sh
@@ -20,7 +20,7 @@ if [[ -n $NATIVE_BITNESS_ONLY ]]; then
NATIVE_BITNESS=64
fi
-NATIVE_BITNESS_OPTION_SUPPORTED="$(echo 'int main (void) { }' | gcc -x c -o /dev/null -m64 - 2>/dev/null && echo t)"
+NATIVE_BITNESS_OPTION_SUPPORTED="$(echo 'int main (void) { }' | ${CC:-gcc} -x c -o /dev/null -m64 - 2>/dev/null && echo t)"
set -e
--
2.43.0.272.gce700b77fd
More information about the DTrace-devel
mailing list