winpthreads: make testing shared library work Running `make check` when configured with `--disable-static`, depending on whether an installed winpthread library can be found when linking tests, has the following consequences: If an installed winpthread library is found, tests will be linked against installed library instead of the one we just built. If there is no installed winpthread library, tests will be linked against shared library. This will result in tests failing, since they will fail to locate just built DLL at runtime. To fix this: Remove `-static` from `AM_LDFLAGS`, so we can link against the DLL. Use LDADD to link tests against just built winpthread library. Using `-l` is inappropriate to link against built libraries as it should only be used for preinstalled libraries. Instead, pass winpthread.la through LDADD. Executable wrappers created by libtool now will handle runtime search path. Signed-off-by: Kirill Makurin <maiddaisuki@outlook.com> Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-libraries/winpthreads/tests/Makefile.am b/mingw-w64-libraries/winpthreads/tests/Makefile.am index 9dda82f..7fc84d0 100644 --- a/mingw-w64-libraries/winpthreads/tests/Makefile.am +++ b/mingw-w64-libraries/winpthreads/tests/Makefile.am
@@ -1,13 +1,12 @@ AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include -AM_LDFLAGS = +AM_LDFLAGS = -L$(top_builddir) if !MSVC AM_LDFLAGS += -L$(top_builddir)/fakelib endif -AM_LDFLAGS += -L$(top_builddir) -lwinpthread -static +LDADD = $(top_builddir)/libwinpthread.la #FIXME: The test "test.c" is inherently broken currently. check_PROGRAMS = t_clock_getres t_clock_gettime t_clock_nanosleep t_clock_settime t_nanosleep #test TESTS = $(check_PROGRAMS) -