From: Michael Jeanson Date: Mon, 22 Mar 2021 16:57:44 +0000 (-0400) Subject: configure: regroup C header checks X-Git-Tag: v2.13.0-rc1~222 X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=eeef0055aa1d2bff2fbde680b88b3a61fc6b98b9;p=lttng-ust.git configure: regroup C header checks This is part of an effort to standardise our autotools setup across project to simplify maintenance. Change-Id: I659c98ce9eb328e78d1c075a1157f59848195650 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/configure.ac b/configure.ac index 685e6fe4..ed4eeabc 100644 --- a/configure.ac +++ b/configure.ac @@ -116,6 +116,31 @@ AX_CXX_COMPILE_STDCXX([11], [noext], [optional]) AM_CONDITIONAL([HAVE_CXX], [test "$HAVE_CXX11" = "1"]) +## ## +## Header checks ## +## ## + +AC_HEADER_STDBOOL +AC_CHECK_HEADERS([ \ + arpa/inet.h \ + dlfcn.h \ + fcntl.h \ + float.h \ + limits.h \ + linux/perf_event.h \ + locale.h \ + stddef.h \ + sys/socket.h \ + sys/time.h \ + wchar.h \ +]) + +# Check for dlinfo() by testing for RTLD_DI_LINKMAP in dlfcn.h +AS_IF([test "x$ac_cv_header_dlfcn_h" = "xyes"], [ + AC_CHECK_DECL([RTLD_DI_LINKMAP], [], [], [[#include ]]) +]) + + # Checks for programs. AM_PROG_AR AC_PROG_SED @@ -196,20 +221,6 @@ LTTNG_PTHREAD_GETNAME_NP # AC_FUNC_MALLOC causes problems when cross-compiling. #AC_FUNC_MALLOC -# Checks for header files. -AC_HEADER_STDBOOL -AC_CHECK_HEADERS([ \ - arpa/inet.h \ - fcntl.h \ - float.h \ - limits.h \ - locale.h \ - stddef.h \ - sys/socket.h \ - sys/time.h \ - wchar.h \ -]) - # Set architecture specific options AS_CASE([$host_cpu], [i[[3456]]86], [], @@ -261,16 +272,6 @@ AC_CHECK_LIB([$libdl_name], [dlmopen], [AC_DEFINE([HAVE_DLMOPEN], [1])] ) -# Check for dlfcn.h -AC_CHECK_HEADER([dlfcn.h]) -AS_IF([test "x${ac_cv_header_dlfcn_h}" = "xyes"], [ - AC_CHECK_DECLS([RTLD_DI_LINKMAP], [], [], [ - #include - ]) -], [ - ac_cv_have_decl_RTLD_DI_LINKMAP="no" -]) - AM_CONDITIONAL([ENABLE_UST_DL], [test "x${ac_cv_have_decl_RTLD_DI_LINKMAP}" = "xyes"]) # Require URCU >= 0.12 for DEFINE_URCU_TLS_INIT @@ -297,17 +298,7 @@ AS_IF([test "x$enable_numa" = "xyes"], [ ]) AM_CONDITIONAL([ENABLE_NUMA], [test "x$have_libnuma" = "xyes"]) -# optional linux/perf_event.h -AC_CHECK_HEADERS([linux/perf_event.h], [have_perf_event=yes], []) - -# Perf event counters are supported on all architectures supported by -# perf, using the read system call as fallback. -AM_CONDITIONAL([HAVE_PERF_EVENT], [test "x$have_perf_event" = "xyes"]) - -AH_TEMPLATE([HAVE_PERF_EVENT], ["Perf event integration via perf_event.h"]) -AS_IF([test "x$have_perf_event" = "xyes"], [ - AC_DEFINE([HAVE_PERF_EVENT], [1]) -]) +AM_CONDITIONAL([HAVE_PERF_EVENT], [test "x$ac_cv_header_linux_perf_event_h" = "xyes"]) # Check for JNI header files if requested AC_ARG_ENABLE([jni-interface], [ @@ -628,7 +619,7 @@ PPRINT_PROP_BOOL_CUSTOM([JNI interface (JNI)], $value, [use --enable-jni-interfa test "x$python_agent" = xyes && value=1 || value=0 PPRINT_PROP_BOOL_CUSTOM([Python agent], $value, [use --enable-python-agent]) -test "x$have_perf_event" = "xyes" && value=1 || value=0 +test "x$ac_cv_header_linux_perf_event_h" = "xyes" && value=1 || value=0 PPRINT_PROP_BOOL_CUSTOM([Perf event integration], $value) test "x$enable_numa" = xyes && value=1 || value=0 diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index a4a3313a..89b566bd 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -2005,7 +2005,7 @@ int ustctl_get_instance_id(struct ustctl_consumer_stream *stream, return client_cb->instance_id(buf, handle, id); } -#ifdef HAVE_PERF_EVENT +#ifdef HAVE_LINUX_PERF_EVENT_H int ustctl_has_perf_counters(void) { diff --git a/liblttng-ust/lttng-tracer-core.h b/liblttng-ust/lttng-tracer-core.h index 54983cba..668d2a89 100644 --- a/liblttng-ust/lttng-tracer-core.h +++ b/liblttng-ust/lttng-tracer-core.h @@ -113,7 +113,7 @@ void lttng_counter_transport_register(struct lttng_counter_transport *transport) __attribute__((visibility("hidden"))) void lttng_counter_transport_unregister(struct lttng_counter_transport *transport); -#ifdef HAVE_PERF_EVENT +#ifdef HAVE_LINUX_PERF_EVENT_H __attribute__((visibility("hidden"))) void lttng_ust_fixup_perf_counter_tls(void); @@ -122,7 +122,7 @@ void lttng_perf_lock(void); __attribute__((visibility("hidden"))) void lttng_perf_unlock(void); -#else /* #ifdef HAVE_PERF_EVENT */ +#else /* #ifdef HAVE_LINUX_PERF_EVENT_H */ static inline void lttng_ust_fixup_perf_counter_tls(void) { @@ -135,6 +135,6 @@ static inline void lttng_perf_unlock(void) { } -#endif /* #else #ifdef HAVE_PERF_EVENT */ +#endif /* #else #ifdef HAVE_LINUX_PERF_EVENT_H */ #endif /* _LTTNG_TRACER_CORE_H */ diff --git a/liblttng-ust/ust-events-internal.h b/liblttng-ust/ust-events-internal.h index f6ab27a2..f116c2e1 100644 --- a/liblttng-ust/ust-events-internal.h +++ b/liblttng-ust/ust-events-internal.h @@ -754,7 +754,7 @@ struct lttng_counter *lttng_ust_counter_create( const char *counter_transport_name, size_t number_dimensions, const struct lttng_counter_dimension *dimensions); -#ifdef HAVE_PERF_EVENT +#ifdef HAVE_LINUX_PERF_EVENT_H __attribute__((visibility("hidden"))) int lttng_add_perf_counter_to_ctx(uint32_t type, @@ -768,7 +768,7 @@ int lttng_perf_counter_init(void); __attribute__((visibility("hidden"))) void lttng_perf_counter_exit(void); -#else /* #ifdef HAVE_PERF_EVENT */ +#else /* #ifdef HAVE_LINUX_PERF_EVENT_H */ static inline int lttng_add_perf_counter_to_ctx(uint32_t type, @@ -787,7 +787,7 @@ static inline void lttng_perf_counter_exit(void) { } -#endif /* #else #ifdef HAVE_PERF_EVENT */ +#endif /* #else #ifdef HAVE_LINUX_PERF_EVENT_H */ __attribute__((visibility("hidden"))) int lttng_probes_get_event_list(struct lttng_ust_tracepoint_list *list);