This is the mail archive of the mailing list for the systemtap project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

build-time module autoconf

Hi -

As mentioned in today's call, I committed a little hack to the
systemtap probe module compilation mechanism, to permit build-time
autoconfiguration to the actual kernel.  This is to complement the
existing "#if KERNEL_VERSION" type code already in the runtime or
genereated by systemtap.

The hack is copied from vmware module makefiles, though since it
consists of just one or two lines, I'm sure they won't mind. :-) The
gist of it is the addition of a few lines into the generated module

stap_check_gcc = $(shell if $(CC) $(1) -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi)

stap_check_build = $(shell if $(CC) $(CPPFLAGS) $(CFLAGS_KERNEL) $(EXTRA_CFLAGS) -DKBUILD_BASENAME=\".....\" -Werror -S - o /dev/null -xc $(1) > /dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi)

SYSTEMTAP_RUNTIME = "/path/to/runtime"

CFLAGS += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-hrtimer-rel.c, -DSTAPCONF_HRTIMER_REL,)

The effect is to conditionally define STAPCONF_HRTIMER_REL iff the
named file (autoconf/hrtimer-rel.c) compiles successfully.  To add
other tests, new lines of the last one's form ("CFLAGS += ... ")
would need to be added to src/buildrun.cxx, and a corresponding
test C file added to the runtime source tree, and of course
#if conditions for the code that depends on the result.
There is also a stap_check_gcc make macro can be used to check for the
presence of gcc compiler options (as opposed to buildability of a
source file).  This might come in useful for other things.

- FChE

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]