Cleanup: popt library detection
authorMichael Jeanson <mjeanson@efficios.com>
Fri, 12 May 2017 16:07:40 +0000 (12:07 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 1 Jun 2017 20:41:02 +0000 (16:41 -0400)
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 <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac
src/bin/lttng/Makefile.am
tests/regression/kernel/Makefile.am

index ab3616978ae16e0a060c5dd6a4a497f54f79e885..5b87db91228acf92c49f01d662b7d6a9124e7893 100644 (file)
@@ -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])
 
index c1c2cf6f9b55fe98297837e5f3271db9a18ec7bf..1a6977eb5fb38e4b6aebd40ba60f4575e79d7935 100644 (file)
@@ -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)
index 92c21bc9fb13413db5d80d8db23e3a7e00e1f9e7..c4ee443908cf6bc31c9510a47599bd72f55187d8 100644 (file)
@@ -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:
This page took 0.028899 seconds and 4 git commands to generate.