From e65db12c60c128865623cc832191c85b021387c9 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Fri, 12 May 2017 12:07:40 -0400 Subject: [PATCH] Cleanup: popt library detection MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Simplify popt detection code and use a variable to store the detected lib instead of using the global LIBS variable. Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau --- configure.ac | 27 +++++++++++++++------------ src/bin/lttng/Makefile.am | 3 ++- tests/regression/kernel/Makefile.am | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 1a377989f..e806f8115 100644 --- a/configure.ac +++ b/configure.ac @@ -362,19 +362,22 @@ AC_DEFINE_DIR([CONFIG_LTTNG_SYSTEM_DATADIR],[datadir], [LTTng system data direct # Check libpopt PKG_CHECK_MODULES([POPT], [popt], - [LIBS="$LIBS $POPT_LIBS"], - [ - AC_MSG_WARN([pkg-config was unable to find a valid .pc for libpopt. Set PKG_CONFIG_PATH to specify the pkgconfig configuration file location]) - AC_MSG_WARN([Finding libpopt without pkg-config.]) - AC_CHECK_LIB([popt], - [poptGetContext], - [], - [ - AC_MSG_ERROR([Cannot find libpopt. Either set PKG_CONFIG_PATH to the configuration file location or use LDFLAGS=-Ldir to specify the library location]) - ] - ) - ] + [ + dnl PKG_CHECK_MODULES defines POPT_LIBS + ], + [ + AC_MSG_WARN([pkg-config was unable to find a valid .pc for libpopt. Set PKG_CONFIG_PATH to specify the pkgconfig configuration file location]) + AC_MSG_WARN([Finding libpopt without pkg-config.]) + AC_CHECK_LIB([popt], + [poptGetContext], + [POPT_LIBS="-lpopt"], + [ + AC_MSG_FAILURE([Cannot find libpopt. Either set PKG_CONFIG_PATH to the configuration file location or use LDFLAGS=-Ldir to specify the library location]) + ] + ) + ] ) +AC_SUBST(POPT_LIBS) PKG_CHECK_MODULES([libxml2], [libxml-2.0 >= 2.7.6]) diff --git a/src/bin/lttng/Makefile.am b/src/bin/lttng/Makefile.am index c1c2cf6f9..1a6977eb5 100644 --- a/src/bin/lttng/Makefile.am +++ b/src/bin/lttng/Makefile.am @@ -28,4 +28,5 @@ lttng_SOURCES = command.h conf.c conf.h commands/start.c \ lttng_LDADD = $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \ $(top_builddir)/src/common/libcommon.la \ $(top_builddir)/src/common/config/libconfig.la \ - $(top_builddir)/src/common/string-utils/libstring-utils.la + $(top_builddir)/src/common/string-utils/libstring-utils.la \ + $(POPT_LIBS) diff --git a/tests/regression/kernel/Makefile.am b/tests/regression/kernel/Makefile.am index 92c21bc9f..c4ee44390 100644 --- a/tests/regression/kernel/Makefile.am +++ b/tests/regression/kernel/Makefile.am @@ -4,7 +4,7 @@ EXTRA_DIST = test_event_basic test_all_events test_syscall \ noinst_PROGRAMS = select_poll_epoll select_poll_epoll_SOURCES = select_poll_epoll.c -select_poll_epoll_LDADD = -lpthread -lpopt +select_poll_epoll_LDADD = $(POPT_LIBS) select_poll_epoll_CFLAGS = -fno-stack-protector -D_FORTIFY_SOURCE=0 $(AM_CFLAGS) all-local: -- 2.34.1