Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,39 @@ AC_ARG_ENABLE(yangmodules,
no) yangmodules=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-yangmodules) ;;
esac],[yangmodules=true])
AC_ARG_ENABLE(otlp,
[ --enable-otlp Build the OTLP sink (requires opentelemetry-cpp)],
[case "${enableval}" in
yes) otlp=true ;;
no) otlp=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-otlp) ;;
esac],[otlp=false])
AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
AM_CONDITIONAL(PYTHON2, test x$python2 = xtrue)
AM_CONDITIONAL(YANGMODS, test x$yangmodules = xtrue)
AM_CONDITIONAL(OTLP, test x$otlp = xtrue)

if test x$otlp = xtrue; then
PKG_CHECK_MODULES([OPENTELEMETRY],
[opentelemetry_api opentelemetry_sdk opentelemetry_exporter_otlp_grpc],
[have_otlp_pkgconfig=yes],
[have_otlp_pkgconfig=no])
if test x$have_otlp_pkgconfig = xno; then
# opentelemetry-cpp does not ship pkg-config files in all distributions.
# Fall back to header + library probes so the build still succeeds when
# the SDK is installed under a standard prefix.
AC_LANG_PUSH([C++])
AC_CHECK_HEADER([opentelemetry/version.h], [],
[AC_MSG_ERROR([--enable-otlp requested but opentelemetry-cpp headers were not found. Install opentelemetry-cpp or pass CPPFLAGS=-I<prefix>/include.])])
AC_LANG_POP([C++])
OPENTELEMETRY_CFLAGS=""
OPENTELEMETRY_LIBS="-lopentelemetry_exporter_otlp_grpc -lopentelemetry_otlp_recordable -lopentelemetry_proto -lopentelemetry_resources -lopentelemetry_trace -lopentelemetry_metrics -lopentelemetry_common -lgrpc++ -lgrpc -lprotobuf"
fi
AC_DEFINE([HAVE_OTLP], [1], [Define to 1 if the OTLP sink is built])
fi
AC_SUBST([OPENTELEMETRY_CFLAGS])
AC_SUBST([OPENTELEMETRY_LIBS])

if test x$CONFIGURED_ARCH = xarmhf && test x$CROSS_BUILD_ENVIRON = xy; then
AM_CONDITIONAL(ARCH64, false)
else
Expand Down
10 changes: 10 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ else
CONFIGURE_ARGS += --enable-yangmodules
endif

# Build the OTLP sink only when the 'otlp' build profile is active. The
# OTLP sink depends on opentelemetry-cpp, which is not yet packaged in
# every distribution; the default build keeps OTLP off so behaviour is
# unchanged.
ifneq (,$(filter otlp,$(DEB_BUILD_PROFILES)))
CONFIGURE_ARGS += --enable-otlp
else
CONFIGURE_ARGS += --disable-otlp
endif

# main packaging script
%:
dh $@
Expand Down
Loading