[DTrace-devel] [PATCH v2 9/9] build: add configure script

Sam James sam at gentoo.org
Fri Jan 26 13:51:24 UTC 2024


Nick Alcock <nick.alcock at oracle.com> writes:

> On 25 Jan 2024, Sam James spake thusly:
>
>> Nick Alcock <nick.alcock at oracle.com> writes:
>>> -NATIVE_BITNESS_ONLY := $(shell echo 'int main (void) { }' | gcc -x c -o /dev/null -m32 - 2>/dev/null || echo t)
>>
>> $(CC) here, we might be pointed to a specific version of GCC or similar
>
> Good point (plus moving the definition of CC up). I've added a patch
> that adjusts everything outside the testsuite accordingly (because doing
> the same inside the testsuite is about ten times as much work :) ).
>
> (We have dropped the -dumpmachine patch in the next series, btw, on the
> grounds that we haven't in any way tested anything about
> cross-compilation and it's better not to make it seem like we have.)
>
>>> +BITNESS := 64
>>> +NATIVE_BITNESS_ONLY := $(shell echo 'int main (void) { }' | gcc -x c -o /dev/null -m32 - 2>/dev/null || echo t)
>>
>> $(CC) again
>
> It's actually the same thing, just code motion. (This is still in the
> latest version of the series because I fix it up in a later commit.)
>
>>> +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
>>
>> Are these overridable too? We may not have exactly the same tuple name
>> (undecided yet).
>
> Yeah, they're all overrideable, like any makefile variable (and more
> specifically $(BPFC) exists because we do expect it to be the sort
> of thing people might want to override).
>
>>> +--kernels="6.1 6.2 6.3"		Space-separated list of kernel versions to
>>> +				produce translators for
>>> +--kernel-mod-dir=DIR		Directory used to search for kernel build trees
>>> +--kernel-src-dir=DIR		Source location of kernel tree for local builds
>>> +--kernel-obj-dir=DIR		O= passed to local kernels built with O=
>>
>> Thank you for this!
>
> Thank you for suggesting it. Having configure options that stick across
> builds makes development a lot more convenient too!
>
>>> [...]
>>> +        HAVE_LIBSYSTEMD=*) write_config_var LIBSYSTEMD "$option";;
>>> +        HAVE_FUSE_LOG=*) write_config_var FUSE_LOG "$option";;
>>> +        --with-libfuse3=*) write_config_var LIBFUSE3 "$option";;
>>> +        HAVE_LIBFUSE3=*) write_config_var LIBFUSE3 "$option";;
>>> +        HAVE_FUSE_NUMA=*) write_config_var FUSE_NUMA "$option";;
>>> +        HAVE_CLOSE_RANGE=*) write_config_var CLOSE_RANGE "$option";;
>>> +        HAVE_GETTID=*) write_config_var GETTID "$option";;
>>> +	*) echo "Unknown option $option" >&2
>>
>> This allows disabling the use of e.g. fuse3 even if it's detected on the
>> system, right? If so, great.
>
> Yes. Not sure why you'd want to, mind you: maybe to force use of fuse2?
> (If you have neither, the build will fail.)

Maybe fuse was a bad example ;)

I should've maybe said systemd. The reason being that sometimes we want
to build on a machine with systemd, but the target won't have it, so
we want to be able to say "I don't care if you found $X, don't use $X
anyway".




More information about the DTrace-devel mailing list