Skip to content

Commit

Permalink
build: consistently respect CC env var if set
Browse files Browse the repository at this point in the history
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@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
nickalcock authored and kvanhees committed Feb 7, 2024
1 parent 9b0410b commit 4397149
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,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
Expand Down
4 changes: 2 additions & 2 deletions libproc/mkoffsets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
#
# Oracle Linux DTrace.
# Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.

Expand All @@ -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

Expand Down

0 comments on commit 4397149

Please sign in to comment.