Disable test-static-link in case of shared only build.
authorPeter Seiderer <ps.report@gmx.net>
Fri, 13 Mar 2015 21:44:31 +0000 (22:44 +0100)
committerPeter Hutterer <peter.hutterer@who-t.net>
Sun, 15 Mar 2015 22:57:42 +0000 (08:57 +1000)
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@gmx.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
configure.ac
test/Makefile.am

index c25b36f..59c691b 100644 (file)
@@ -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}
               ])
index ab4752e..e06aa4b 100644 (file)
@@ -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