Disable test-static-link in case of shared only build.

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>
This commit is contained in:
Peter Seiderer 2015-03-13 22:44:31 +01:00 committed by Peter Hutterer
parent 6c87163a2a
commit bc428e0211
2 changed files with 21 additions and 7 deletions

View 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
if test "x$enable_static" = "xno"; then
static_symbol_leaks_test="no - static build disabled"
else
if test "x$NM" = "x"; then
AC_MSG_WARN([nm not found - skipping symbol leak test])
have_nm="no"
else
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}
])

View 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