[PATCH libevdev v2] Disable test-static-link in case of shared only build.

Peter Seiderer ps.report at gmx.net
Fri Mar 13 14:44:31 PDT 2015


Fixes the following buildroot compile failure:

libtool: link: [..]/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc -std=gnu99 -I.. -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -static -o test-static-link test_static_link-test-link.o  ../libevdev/.libs/libevdev.so -Wl,-rpath -Wl,[...]/build/libevdev-1.4/libevdev/.libs
[...]/arm-buildroot-linux-uclibcgnueabi/bin/ld: attempted static link of dynamic object `../libevdev/.libs/libevdev.so'
collect2: error: ld returned 1 exit status
Makefile:719: recipe for target 'test-static-link' failed

Signed-off-by: Peter Seiderer <ps.report at gmx.net>
---
Changes v1 --> v2:
  - disable symbol leak test too
---
 configure.ac     | 19 ++++++++++++++-----
 test/Makefile.am |  9 +++++++--
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index c25b36f..59c691b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,6 +75,7 @@ else
 fi
 AM_CONDITIONAL(HAVE_VALGRIND, [test "x$VALGRIND" != "x"])
 AM_CONDITIONAL(ENABLE_RUNTIME_TESTS, [test "x$HAVE_CHECK" = "xyes"])
+AM_CONDITIONAL(ENABLE_STATIC_LINK_TEST, [test "x$enable_static" = "xyes"])
 
 with_cflags=""
 if test "x$GCC" = "xyes"; then
@@ -128,13 +129,21 @@ AM_PATH_PYTHON([2.6])
 # nm to check for leaking symbols in the static library
 AC_PATH_PROG(NM, [nm])
 AM_CONDITIONAL(HAVE_NM, [test "x$NM" != "x"])
-if test "x$NM" == "x"; then
-	AC_MSG_WARN([nm not found - skipping symbol leak test])
-	have_nm="no"
+if test "x$enable_static" = "xno"; then
+	static_symbol_leaks_test="no - static build disabled"
 else
-	have_nm="yes"
+	if test "x$NM" = "x"; then
+		AC_MSG_WARN([nm not found - skipping symbol leak test])
+		have_nm="no"
+		static_symbol_leaks_test="no - nm not found"
+	else
+		have_nm="yes"
+		static_symbol_leaks_test="yes"
+	fi
 fi
 
+AM_CONDITIONAL(ENABLE_STATIC_SYMBOL_LEAKS_TEST, [test "x$static_symbol_leaks_test" = "xyes"])
+
 AC_CONFIG_FILES([Makefile
 		 libevdev/Makefile
 		 doc/Makefile
@@ -152,5 +161,5 @@ AC_MSG_RESULT([
 	       Build documentation		${have_doxygen}
 	       Enable unit-tests		${HAVE_CHECK}
 	       Enable profiling			${enable_gcov}
-	       Static library symbol check	${have_nm}
+	       Static library symbol check	${static_symbol_leaks_test}
 	       ])
diff --git a/test/Makefile.am b/test/Makefile.am
index ab4752e..e06aa4b 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,4 +1,9 @@
-build_tests = test-compile-pedantic test-link test-static-link
+build_tests = test-compile-pedantic test-link
+
+if ENABLE_STATIC_LINK_TEST
+build_tests += test-static-link
+endif
+
 noinst_PROGRAMS = $(build_tests)
 
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include -I$(top_builddir)/libevdev
@@ -125,7 +130,7 @@ endif # HAVE_VALGRIND
 
 endif # ENABLE_RUNTIME_TESTS
 
-if HAVE_NM
+if ENABLE_STATIC_SYMBOL_LEAKS_TEST
 # Hack to check for leaking symbols in the static library.
 # See https://bugs.freedesktop.org/show_bug.cgi?id=82785
 # Note the spaces in the expressions! After the first grep, each line
-- 
2.1.4



More information about the Input-tools mailing list