We ignore anything that starts with an underscore, anything that starts with
libevdev and main (since we test the test-static-link binary) and a couple of
gcov-related functions. This should catch any functions we accidentally
export.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
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"
+else
+ have_nm="yes"
+fi
+
AC_CONFIG_FILES([Makefile
libevdev/Makefile
doc/Makefile
AC_OUTPUT
AC_MSG_RESULT([
- Build documentation ${have_doxygen}
- Build unit-tests ${HAVE_CHECK}
- Enable profiling ${enable_gcov}
+ Build documentation ${have_doxygen}
+ Build unit-tests ${HAVE_CHECK}
+ Enable profiling ${enable_gcov}
+ Static library symbol check ${have_nm}
])
clean-local: gcov-clean
rm -f *.gcno *.gcda
-check-local: $(check_local_deps)
+if HAVE_NM
+# 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
+# is " T symbol_name"
+static-symbol-leaks: test-static-link
+ $(AM_V_GEN)(\
+ $(NM) --extern-only $(builddir)/test-static-link | \
+ grep -o -e " T .*" | \
+ grep -v -e " main$$" \
+ -e " atexit" \
+ -e " *gcov.*" \
+ -e " _.*" \
+ -e " libevdev_*" && \
+ echo "Leaking symbols found" && \
+ exit 1 || exit 0 \
+ )
+check_local_deps += static-symbol-leaks
+endif
+
+check-local: $(check_local_deps)
endif