From: Michael Jeanson Date: Fri, 12 May 2017 16:07:40 +0000 (-0400) Subject: Cleanup: popt library detection X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=commitdiff_plain;h=4f985cf80e50349be45749fe2d4fc490083d4e63 Cleanup: popt library detection 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 --- diff --git a/configure.ac b/configure.ac index ab3616978..5b87db912 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: