X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=m4%2Flttng_check_sdt_works.m4;fp=m4%2Flttng_check_sdt_works.m4;h=7f2a1ba5671d71a81f65228ade2d6be909d7f0f5;hp=0000000000000000000000000000000000000000;hb=56e59b9b33595a94a1245382250c507bf951bbc3;hpb=6333b87b4a41bb73bd21d8f75906ba3c8f666c1d diff --git a/m4/lttng_check_sdt_works.m4 b/m4/lttng_check_sdt_works.m4 new file mode 100644 index 000000000..7f2a1ba56 --- /dev/null +++ b/m4/lttng_check_sdt_works.m4 @@ -0,0 +1,46 @@ +# SYNOPSIS +# +# LTTNG_CHECK_SDT_WORKS([ACTION-SUCCESS], [ACTION-FAILURE]) +# +# DESCRIPTION +# +# Check whether it's possible to build a binary with Systemtap SDT probes. +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# LICENSE +# +# Copyright (c) 2018 Francis Deslauriers +# Copyright (c) 2019 Michael Jeanson +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 1 + +AC_DEFUN([LTTNG_CHECK_SDT_WORKS], [ + AC_CACHE_CHECK([whether SDT probes compile], [lttng_cv_sdt_works], [ + AC_COMPILE_IFELSE([ + AC_LANG_SOURCE([[ + #define SDT_USE_VARIADIC + #include + void fct(void) + { + STAP_PROBEV(provider,name,1,2,3,4,5,6,7,8,9,10); + } + ]]) + ], [ + lttng_cv_sdt_works=yes + ], [ + lttng_cv_sdt_works=no + ]) + ]) + AS_IF([test "x$lttng_cv_sdt_works" = "xyes"], [ + m4_default([$1], :) + ], [ + m4_default([$2], :) + ]) +])