From: Mathieu Desnoyers Date: Fri, 4 Nov 2011 11:32:26 +0000 (-0400) Subject: LTTng-UST support: --disable-lttng-ust build option X-Git-Tag: v2.0-pre15~158 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=74d0b6427faafd5f5d59b7e9d5f78ac52924a7a2;p=lttng-tools.git LTTng-UST support: --disable-lttng-ust build option From now on, configure fails if lttng-ust is not found. --disable-lttng-ust must be explicitely specified to build without UST support. Signed-off-by: Mathieu Desnoyers --- diff --git a/configure.ac b/configure.ac index b4a4b9ebb..8c0eb54d3 100644 --- a/configure.ac +++ b/configure.ac @@ -8,8 +8,6 @@ AM_SILENT_RULES([yes]) AC_CONFIG_HEADERS([include/config.h]) -AH_TEMPLATE([CONFIG_LTTNG_TOOLS_HAVE_UST], [Defined on systems where UST headers can be found.]) - AC_CHECK_HEADERS([ \ sys/types.h unistd.h fcntl.h string.h pthread.h limits.h \ signal.h stdlib.h sys/un.h sys/socket.h stdlib.h stdio.h \ @@ -49,19 +47,25 @@ AC_CHECK_DECL([caa_likely], [], [AC_MSG_ERROR([liburcu $liburcu_version or newer is needed])], [[#include ]] ) -# Check libust library -AC_CHECK_DECL([ustctl_create_session], - [ - AC_DEFINE([CONFIG_LTTNG_TOOLS_HAVE_UST], 1) - have_ust_test=1 - ], - [ - AC_MSG_WARN([UST header not found. Building without UST support.]) - have_ust_test=0 - ], - [[#include ]] -) -AM_CONDITIONAL([LTTNG_TOOLS_HAVE_UST], [ test "x$have_ust_test" = "x1" ]) +# Check liblttng-ust-ctl library +AC_ARG_ENABLE(lttng-ust, + [ --disable-lttng-ust build without LTTng-UST (Userspace Tracing) support.], + lttng_ust_support=no, lttng_ust_support=yes) + +[ +if test "x$lttng_ust_support" = "xno"; then + echo "LTTng-UST support disabled." +else +] + AC_CHECK_LIB([lttng-ust-ctl], [ustctl_create_session], [], + [AC_MSG_ERROR([Cannot find LTTng-UST. Use [LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])] + ) +[ + echo "LTTng-UST support enabled." +fi +] + +AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [ test "x$ac_cv_lib_lttng_ust_ctl_ustctl_create_session" = "xyes" ]) AC_CHECK_FUNCS([sched_getcpu sysconf]) diff --git a/include/lttng-sessiond-comm.h b/include/lttng-sessiond-comm.h index 8843a1133..55647faf0 100644 --- a/include/lttng-sessiond-comm.h +++ b/include/lttng-sessiond-comm.h @@ -227,7 +227,7 @@ struct lttcomm_consumer_msg { } u; }; -#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST +#ifdef HAVE_LIBLTTNG_UST_CTL #include @@ -266,7 +266,7 @@ struct lttcomm_ust_reply { } u; }; -#endif /* CONFIG_LTTNG_TOOLS_HAVE_UST */ +#endif /* HAVE_LIBLTTNG_UST_CTL */ extern int lttcomm_create_unix_sock(const char *pathname); extern int lttcomm_connect_unix_sock(const char *pathname); diff --git a/include/lttng/lttng-ustconsumer.h b/include/lttng/lttng-ustconsumer.h index efc4667c9..eacff654f 100644 --- a/include/lttng/lttng-ustconsumer.h +++ b/include/lttng/lttng-ustconsumer.h @@ -24,7 +24,7 @@ #include #include -#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST +#ifdef HAVE_LIBLTTNG_UST_CTL /* * Mmap the ring buffer, read it and write the data to the tracefile. @@ -66,8 +66,7 @@ extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan); extern int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream *stream); extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream); - -#else /* CONFIG_LTTNG_TOOLS_HAVE_UST */ +#else /* HAVE_LIBLTTNG_UST_CTL */ static inline int lttng_ustconsumer_on_read_subbuffer_mmap( @@ -130,6 +129,6 @@ void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream) { } -#endif /* CONFIG_LTTNG_TOOLS_HAVE_UST */ +#endif /* HAVE_LIBLTTNG_UST_CTL */ #endif /* _LTTNG_USTCONSUMER_H */ diff --git a/liblttng-consumer/Makefile.am b/liblttng-consumer/Makefile.am index e3aa02a22..80f5843da 100644 --- a/liblttng-consumer/Makefile.am +++ b/liblttng-consumer/Makefile.am @@ -9,7 +9,7 @@ liblttng_consumer_la_LIBADD = \ $(top_builddir)/liblttng-kconsumer/liblttng-kconsumer.la -if LTTNG_TOOLS_HAVE_UST +if HAVE_LIBLTTNG_UST_CTL liblttng_consumer_la_LIBADD += \ $(top_builddir)/liblttng-ustconsumer/liblttng-ustconsumer.la endif diff --git a/liblttng-ustconsumer/Makefile.am b/liblttng-ustconsumer/Makefile.am index 1816fef4e..284eccf97 100644 --- a/liblttng-ustconsumer/Makefile.am +++ b/liblttng-ustconsumer/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -if LTTNG_TOOLS_HAVE_UST +if HAVE_LIBLTTNG_UST_CTL noinst_LTLIBRARIES = liblttng-ustconsumer.la liblttng_ustconsumer_la_SOURCES = lttng-ustconsumer.c diff --git a/lttng-consumerd/Makefile.am b/lttng-consumerd/Makefile.am index 9ce0baef6..70ebc5035 100644 --- a/lttng-consumerd/Makefile.am +++ b/lttng-consumerd/Makefile.am @@ -9,6 +9,6 @@ lttng_consumerd_LDADD = \ $(top_builddir)/liblttng-consumer/liblttng-consumer.la \ $(top_builddir)/liblttng-sessiond-comm/liblttng-sessiond-comm.la -if LTTNG_TOOLS_HAVE_UST +if HAVE_LIBLTTNG_UST_CTL lttng_consumerd_LDADD += -llttng-ust-ctl endif diff --git a/lttng-consumerd/lttng-consumerd.c b/lttng-consumerd/lttng-consumerd.c index 946f0aba0..c85914e7f 100644 --- a/lttng-consumerd/lttng-consumerd.c +++ b/lttng-consumerd/lttng-consumerd.c @@ -139,7 +139,7 @@ static void usage(void) "Consumer kernel buffers (default).\n"); fprintf(stderr, " -u, --ust " "Consumer UST buffers.%s\n", -#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST +#ifdef HAVE_LIBLTTNG_UST_CTL "" #else " (support not compiled in)" @@ -163,7 +163,7 @@ static void parse_args(int argc, char **argv) { "verbose", 0, 0, 'v' }, { "version", 0, 0, 'V' }, { "kernel", 0, 0, 'k' }, -#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST +#ifdef HAVE_LIBLTTNG_UST_CTL { "ust", 0, 0, 'u' }, #endif { NULL, 0, 0, 0 } @@ -207,7 +207,7 @@ static void parse_args(int argc, char **argv) case 'k': opt_type = LTTNG_CONSUMER_KERNEL; break; -#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST +#ifdef HAVE_LIBLTTNG_UST_CTL case 'u': opt_type = LTTNG_CONSUMER_UST; break; diff --git a/lttng-sessiond/Makefile.am b/lttng-sessiond/Makefile.am index 52659f4af..26faf89cf 100644 --- a/lttng-sessiond/Makefile.am +++ b/lttng-sessiond/Makefile.am @@ -27,7 +27,7 @@ lttng_sessiond_SOURCES = utils.c utils.h \ ../hashtable/rculfhash.h \ ../hashtable/hash.c ../hashtable/hash.h -if LTTNG_TOOLS_HAVE_UST +if HAVE_LIBLTTNG_UST_CTL lttng_sessiond_SOURCES += trace-ust.c ust-app.c ust-consumer.c ust-consumer.h endif @@ -40,6 +40,6 @@ lttng_sessiond_LDADD = -lrt -lurcu-cds -lurcu \ $(top_builddir)/libkernelctl/libkernelctl.la \ $(top_builddir)/liblttngctl/liblttngctl.la -if LTTNG_TOOLS_HAVE_UST +if HAVE_LIBLTTNG_UST_CTL lttng_sessiond_LDADD += -llttng-ust-comm -llttng-ust-ctl endif diff --git a/lttng-sessiond/trace-ust.h b/lttng-sessiond/trace-ust.h index aea7e714f..35683ebce 100644 --- a/lttng-sessiond/trace-ust.h +++ b/lttng-sessiond/trace-ust.h @@ -110,7 +110,7 @@ struct ltt_ust_session { struct cds_lfht *domain_exec; }; -#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST +#ifdef HAVE_LIBLTTNG_UST_CTL /* * Lookup functions. NULL is returned if not found. @@ -139,7 +139,7 @@ void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata); void trace_ust_destroy_channel(struct ltt_ust_channel *channel); void trace_ust_destroy_event(struct ltt_ust_event *event); -#else +#else /* HAVE_LIBLTTNG_UST_CTL */ static inline struct ltt_ust_event *trace_ust_find_event_by_name(struct cds_lfht *ht, @@ -198,6 +198,6 @@ void trace_ust_destroy_event(struct ltt_ust_event *event) { } -#endif /* CONFIG_CONFIG_LTTNG_TOOLS_HAVE_UST */ +#endif /* HAVE_LIBLTTNG_UST_CTL */ #endif /* _LTT_TRACE_UST_H */ diff --git a/lttng-sessiond/ust-app.h b/lttng-sessiond/ust-app.h index 46fb65427..04c3472dd 100644 --- a/lttng-sessiond/ust-app.h +++ b/lttng-sessiond/ust-app.h @@ -97,7 +97,7 @@ struct ust_app { struct ust_app_key key; }; -#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST +#ifdef HAVE_LIBLTTNG_UST_CTL int ust_app_register(struct ust_register_msg *msg, int sock); void ust_app_unregister(int sock); @@ -113,7 +113,7 @@ void ust_app_ht_alloc(void); struct cds_lfht *ust_app_get_ht(void); struct ust_app *ust_app_find_by_pid(pid_t pid); -#else +#else /* HAVE_LIBLTTNG_UST_CTL */ static inline int ust_app_register(struct ust_register_msg *msg, int sock) @@ -160,6 +160,6 @@ int ust_app_add_channel(struct ltt_ust_session *usess, return 0; } -#endif /* CONFIG_LTTNG_TOOLS_HAVE_UST */ +#endif /* HAVE_LIBLTTNG_UST_CTL */ #endif /* _LTT_UST_APP_H */ diff --git a/lttng-sessiond/ust-ctl.h b/lttng-sessiond/ust-ctl.h index e8c10a712..f4f34ee2f 100644 --- a/lttng-sessiond/ust-ctl.h +++ b/lttng-sessiond/ust-ctl.h @@ -30,7 +30,7 @@ * own internal structures within lttng-tools instead of relying on the * UST ABI. */ -#ifdef CONFIG_LTTNG_TOOLS_HAVE_UST +#ifdef HAVE_LIBLTTNG_UST_CTL #include #include #else