Hello,
I tried to build winpthreads using latest MSVC tools from Visual Studio 2022
and have run into some issues. The issues were not serious and were easy to fix
so I would like to contribute a few simple patches. Each patch is independent
of each other.
I have attached the patches generated with git format-patch. The explanation of
each patch follows.
patch1.txt
=========
Declaration of function __pth_gpointer_lockedin in
mingw-w64-libraries/winpthreads/src/thread.h makes cl.exe choke with error code
C2059 (syntax error) because of WINPTHREAD_API after the * character. Patch
simply moves WINPTHREAD_API to the left of the return type.
patch2.txt
=========
Compiling and linking tests/t_nanosleep.c with MSVC tools fails due to
unresolved reference to getntptimeofday. I assume this function is provided by
mingw-w64 runtime.
Patch conditionally defines getntptimeofday as a static function written around
either:
*
timespec_get, if TIME_UTC is defined (which is true at least for latest
versions of UCRT),
*
or winpthreads' own clock_gettime (which is not great, but at least code will
compile and link).
patch3-v1.txt and patch3-v2.txt
=========================
While winpthread.dll and export and static libraries are created successfully,
the overall build fails when it tries to create libpthread[.dll].a from
libwinpthread[.dll].a. While this works with mingw-w64 toolchains (GNU/LLVM) it
fails with MSVC because of difference in library name conventions (.lib
extension instead of .a). (Note also that we cannot use lib_LIBRARIES to define
targets with .lib extension.)
Instead of copying during the build, create a copy of pthread[.dll].{a|lib}
during installation with `install-exec-hook` Automake rule. Also provides
`uninstall-hook` to ensure that pthread[.dll].{a|lib} version of export/static
library is deleted with `make uninstall`.
There is also a little change in tests/Makefile.am which adds
-L$(top_builddir)/fakelib to AM_LDFLAGS only when NOT using MSVC tools. This
directory is only created when using mingw-w64 toolchains and its absence makes
libtool fail when linking executables in tests subdirectory.
The difference between patch3-v1.txt and patch3-v2.txt is that former only
modifies Makefile.am and tests/Makefile.am without regenerating Makefile.in and
tests/Makefile.in. I assume the maintainer may want to regenerate those files
themself to make sure everything works. (Also patch3-v2.txt depends on
patch3-v1.txt, but it probably should be a single commit.)
A comment regarding configure.ac
============================
The configure.ac checks value of $CC against '*cl | *cl.exe' wildcards which
may fail if CC has value like "cl.exe -nologo -std:c11". Try to compile and
check whether macro _MSC_VER is defined may be more robust. I may write a patch
for this as well.
*
Kirill Makurin
From 2d0ef83e3981ebf91fc81f9c48018d2a7fa4fe78 Mon Sep 17 00:00:00 2001
From: Kirill Makurin <[email protected]>
Date: Fri, 25 Oct 2024 19:51:45 +0900
Subject: [PATCH 1/4] headers: Fix mingw-w64-libraries/winpthreads/src/thread.h
Move WINPTHREAD_API left to return type of __pth_gpointer_locked so
cl.exe does not choke with C2059 (syntax error).
Signed-off-by: Kirill Makurin <[email protected]>
---
mingw-w64-libraries/winpthreads/src/thread.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mingw-w64-libraries/winpthreads/src/thread.h
b/mingw-w64-libraries/winpthreads/src/thread.h
index 5b88226e9..e556d2661 100644
--- a/mingw-w64-libraries/winpthreads/src/thread.h
+++ b/mingw-w64-libraries/winpthreads/src/thread.h
@@ -74,6 +74,6 @@ void thread_print_set(int state);
void thread_print(volatile pthread_t t, char *txt);
#endif
int __pthread_shallcancel(void);
-struct _pthread_v *WINPTHREAD_API __pth_gpointer_locked (pthread_t id);
+WINPTHREAD_API struct _pthread_v *__pth_gpointer_locked (pthread_t id);
#endif
--
2.46.1.windows.1
From 4b50ff068eaa5e2b8bd3d2ea5b18ff6c79a8aeba Mon Sep 17 00:00:00 2001
From: Kirill Makurin <[email protected]>
Date: Fri, 25 Oct 2024 21:40:00 +0900
Subject: [PATCH 2/4] tests: Make
mingw-w64-libraries/winpthreads/tests/t_nanosleep.c compile with MSVC
Define getntptimeofday as a static function when compiling using MSVC tools.
Implemented in terms of timespec_get if TIME_UTC is defined, otherwise in
terms of winpthreads' own clock_gettime.
Signed-off-by: Kirill Makurin <[email protected]>
---
mingw-w64-libraries/winpthreads/tests/t_nanosleep.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/mingw-w64-libraries/winpthreads/tests/t_nanosleep.c
b/mingw-w64-libraries/winpthreads/tests/t_nanosleep.c
index 21c0ceb8d..69664bbb1 100644
--- a/mingw-w64-libraries/winpthreads/tests/t_nanosleep.c
+++ b/mingw-w64-libraries/winpthreads/tests/t_nanosleep.c
@@ -8,7 +8,20 @@
#define POW10_3 1000
#define POW10_6 1000000
+#ifndef _MSC_VER
extern int __cdecl getntptimeofday(struct timespec *tp, struct timezone *tz);
+#else
+# ifdef TIME_UTC
+static int getntptimeofday(struct timespec *tp, struct timezone *tz) {
+ return timespec_get(tp, TIME_UTC);
+}
+# else /* !TIME_UTC */
+#include "pthread_time.h"
+static int getntptimeofday(struct timespec *tp, struct timezone *tz) {
+ return clock_gettime(CLOCK_REALTIME, tp);
+}
+# endif /* TIME_UTC */
+#endif
__int64 timespec_diff_as_ms(struct timespec *__old, struct timespec *__new)
{
--
2.46.1.windows.1
From 2dccb59752a8ce14b161282aa0b157be36da4e41 Mon Sep 17 00:00:00 2001
From: Kirill Makurin <[email protected]>
Date: Sat, 26 Oct 2024 06:28:46 +0900
Subject: [PATCH 3/4] Update Makefile.am and test/Makefile.am in
mingw-w64-libraries/winpthreads
Make alias for winpthread[.dll].{a|lib} as pthread[.dll].{a|lib}
work with both mingw-w64 and MSVC (as used by libtool) library names.
Old method worked only with mingw-w64 library names (lib*[.dll].a).
Signed-off-by: Kirill Makurin <[email protected]>
---
mingw-w64-libraries/winpthreads/Makefile.am | 50 +++++++++++--------
.../winpthreads/tests/Makefile.am | 8 ++-
2 files changed, 37 insertions(+), 21 deletions(-)
diff --git a/mingw-w64-libraries/winpthreads/Makefile.am
b/mingw-w64-libraries/winpthreads/Makefile.am
index 54eca7b81..ee85e9b10 100644
--- a/mingw-w64-libraries/winpthreads/Makefile.am
+++ b/mingw-w64-libraries/winpthreads/Makefile.am
@@ -29,29 +29,39 @@ fakelib_libgcc_s_a_SOURCES =
fakelib_libgcc_eh_a_SOURCES =
endif
-lib_LIBRARIES =
-
-if COPY_STATIC
-lib_LIBRARIES += libpthread.a
-libpthread_a_SOURCES =
-libpthread_a_DEPENDENCIES = libwinpthread.la
-#FIXME: Use cp kludge until a better method presents itself
-#libpthread_a_LIBADD = $(LT_OBJDIR)/libwinpthread.a
-libpthread_a_AR = cp -f $(LT_OBJDIR)/libwinpthread.a
-endif
-
-if COPY_SHARED
-lib_LIBRARIES += libpthread.dll.a
-libpthread_dll_a_SOURCES =
-libpthread_dll_a_DEPENDENCIES = libwinpthread.la
-#FIXME: Use cp kludge until a better method presents itself
-#libpthread_dll_a_LIBADD = $(LT_OBJDIR)/libwinpthread.dll.a
-libpthread_dll_a_AR = cp -f $(LT_OBJDIR)/libwinpthread.dll.a
-endif
-
# Tell libtool how to use the resource compiler
.rc.lo:
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile
$(RC) $(RCFLAGS) -i $< -o $@
+# Handle pthread[.dll].{lib|a} alias when installing
+install-exec-hook:
+ if test -f $(DESTDIR)$(libdir)/libwinpthread.a; then \
+ cp -f $(DESTDIR)$(libdir)/libwinpthread.a
$(DESTDIR)$(libdir)/libpthread.a; \
+ else \
+ :; \
+ fi
+ if test -f $(DESTDIR)$(libdir)/libwinpthread.dll.a; then \
+ cp -f $(DESTDIR)$(libdir)/libwinpthread.dll.a
$(DESTDIR)$(libdir)/libpthread.dll.a; \
+ else \
+ :; \
+ fi
+ if test -f $(DESTDIR)$(libdir)/winpthread.lib; then \
+ cp -f $(DESTDIR)$(libdir)/winpthread.lib
$(DESTDIR)$(libdir)/pthread.lib; \
+ else \
+ :; \
+ fi
+ if test -f $(DESTDIR)$(libdir)/winpthread.dll.lib; then \
+ cp -f $(DESTDIR)$(libdir)/winpthread.dll.lib
$(DESTDIR)$(libdir)/pthread.dll.lib; \
+ else \
+ :; \
+ fi
+
+# Likewise when uninstalling
+uninstall-hook:
+ for file in $(DESTDIR)$(libdir)/libpthread.a
$(DESTDIR)$(libdir)/libpthread.dll.a \
+ $(DESTDIR)$(libdir)/pthread.lib
$(DESTDIR)$(libdir)/pthread.dll.lib; do \
+ rm -f $${file}; \
+ done
+
DISTCHECK_CONFIGURE_FLAGS = --host=$(host_triplet)
diff --git a/mingw-w64-libraries/winpthreads/tests/Makefile.am
b/mingw-w64-libraries/winpthreads/tests/Makefile.am
index 19ab5f23e..9dda82f73 100644
--- a/mingw-w64-libraries/winpthreads/tests/Makefile.am
+++ b/mingw-w64-libraries/winpthreads/tests/Makefile.am
@@ -1,5 +1,11 @@
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
-AM_LDFLAGS = -L$(top_builddir)/fakelib -L$(top_builddir) -lwinpthread -static
+AM_LDFLAGS =
+
+if !MSVC
+AM_LDFLAGS += -L$(top_builddir)/fakelib
+endif
+
+AM_LDFLAGS += -L$(top_builddir) -lwinpthread -static
#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
--
2.46.1.windows.1
From 35b1e962908419df91d6973a597cf4a58a91b01e Mon Sep 17 00:00:00 2001
From: Kirill Makurin <[email protected]>
Date: Sat, 26 Oct 2024 06:32:28 +0900
Subject: [PATCH 4/4] Regenerate Makefile.in and tests/Makefile.in in
mingw-w64-libraries/winpthreads
Signed-off-by: Kirill Makurin <[email protected]>
---
mingw-w64-libraries/winpthreads/Makefile.in | 139 +++++++-----------
.../winpthreads/tests/Makefile.in | 3 +-
2 files changed, 56 insertions(+), 86 deletions(-)
diff --git a/mingw-w64-libraries/winpthreads/Makefile.in
b/mingw-w64-libraries/winpthreads/Makefile.in
index e14a95843..bf77bbfba 100644
--- a/mingw-w64-libraries/winpthreads/Makefile.in
+++ b/mingw-w64-libraries/winpthreads/Makefile.in
@@ -94,8 +94,6 @@ host_triplet = @host@
@MSVC_TRUE@am__append_2 = -D_CRT_NONSTDC_NO_WARNINGS
@MSVC_FALSE@am__append_3 = -D__USE_MINGW_ANSI_STDIO=0
@MSVC_FALSE@am__append_4 = -L$(builddir)/fakelib -Wc,-no-pthread
-@COPY_STATIC_TRUE@am__append_5 = libpthread.a
-@COPY_SHARED_TRUE@am__append_6 = libpthread.dll.a
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
@@ -112,6 +110,7 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -139,9 +138,7 @@ am__uninstall_files_from_dir = { \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libdir)" \
- "$(DESTDIR)$(includedir)"
-LIBRARIES = $(lib_LIBRARIES) $(noinst_LIBRARIES)
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
ARFLAGS = cru
AM_V_AR = $(am__v_AR_@AM_V@)
@@ -165,12 +162,6 @@ fakelib_libgcc_s_a_AR = $(AR) $(ARFLAGS)
fakelib_libgcc_s_a_LIBADD =
am_fakelib_libgcc_s_a_OBJECTS =
fakelib_libgcc_s_a_OBJECTS = $(am_fakelib_libgcc_s_a_OBJECTS)
-libpthread_a_LIBADD =
-am_libpthread_a_OBJECTS =
-libpthread_a_OBJECTS = $(am_libpthread_a_OBJECTS)
-libpthread_dll_a_LIBADD =
-am_libpthread_dll_a_OBJECTS =
-libpthread_dll_a_OBJECTS = $(am_libpthread_dll_a_OBJECTS)
libwinpthread_la_LIBADD =
am_libwinpthread_la_OBJECTS = src/libwinpthread_la-barrier.lo \
src/libwinpthread_la-cond.lo src/libwinpthread_la-misc.lo \
@@ -248,11 +239,9 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(fakelib_libgcc_a_SOURCES) $(fakelib_libgcc_eh_a_SOURCES) \
- $(fakelib_libgcc_s_a_SOURCES) $(libpthread_a_SOURCES) \
- $(libpthread_dll_a_SOURCES) $(libwinpthread_la_SOURCES)
+ $(fakelib_libgcc_s_a_SOURCES) $(libwinpthread_la_SOURCES)
DIST_SOURCES = $(am__fakelib_libgcc_a_SOURCES_DIST) \
$(fakelib_libgcc_eh_a_SOURCES) $(fakelib_libgcc_s_a_SOURCES) \
- $(libpthread_a_SOURCES) $(libpthread_dll_a_SOURCES) \
$(libwinpthread_la_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
@@ -498,17 +487,6 @@ libwinpthread_la_SOURCES = \
@MSVC_FALSE@fakelib_libgcc_a_SOURCES = src/libgcc/dll_dependency.S
src/libgcc/dll_math.c
@MSVC_FALSE@fakelib_libgcc_s_a_SOURCES =
@MSVC_FALSE@fakelib_libgcc_eh_a_SOURCES =
-lib_LIBRARIES = $(am__append_5) $(am__append_6)
-@COPY_STATIC_TRUE@libpthread_a_SOURCES =
-@COPY_STATIC_TRUE@libpthread_a_DEPENDENCIES = libwinpthread.la
-#FIXME: Use cp kludge until a better method presents itself
-#libpthread_a_LIBADD = $(LT_OBJDIR)/libwinpthread.a
-@COPY_STATIC_TRUE@libpthread_a_AR = cp -f $(LT_OBJDIR)/libwinpthread.a
-@COPY_SHARED_TRUE@libpthread_dll_a_SOURCES =
-@COPY_SHARED_TRUE@libpthread_dll_a_DEPENDENCIES = libwinpthread.la
-#FIXME: Use cp kludge until a better method presents itself
-#libpthread_dll_a_LIBADD = $(LT_OBJDIR)/libwinpthread.dll.a
-@COPY_SHARED_TRUE@libpthread_dll_a_AR = cp -f $(LT_OBJDIR)/libwinpthread.dll.a
DISTCHECK_CONFIGURE_FLAGS = --host=$(host_triplet)
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -563,37 +541,6 @@ $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@
$(am__configure_deps)
distclean-hdr:
-rm -f config.h stamp-h1
-install-libLIBRARIES: $(lib_LIBRARIES)
- @$(NORMAL_INSTALL)
- @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
- list2=; for p in $$list; do \
- if test -f $$p; then \
- list2="$$list2 $$p"; \
- else :; fi; \
- done; \
- test -z "$$list2" || { \
- echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
- echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(libdir)'"; \
- $(INSTALL_DATA) $$list2 "$(DESTDIR)$(libdir)" || exit $$?; }
- @$(POST_INSTALL)
- @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
- for p in $$list; do \
- if test -f $$p; then \
- $(am__strip_dir) \
- echo " ( cd '$(DESTDIR)$(libdir)' && $(RANLIB) $$f )"; \
- ( cd "$(DESTDIR)$(libdir)" && $(RANLIB) $$f ) || exit $$?; \
- else :; fi; \
- done
-
-uninstall-libLIBRARIES:
- @$(NORMAL_UNINSTALL)
- @list='$(lib_LIBRARIES)'; test -n "$(libdir)" || list=; \
- files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(libdir)'; $(am__uninstall_files_from_dir)
-
-clean-libLIBRARIES:
- -test -z "$(lib_LIBRARIES)" || rm -f $(lib_LIBRARIES)
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
@@ -660,16 +607,6 @@ fakelib/libgcc_s.a: $(fakelib_libgcc_s_a_OBJECTS)
$(fakelib_libgcc_s_a_DEPENDENC
$(AM_V_at)-rm -f fakelib/libgcc_s.a
$(AM_V_AR)$(fakelib_libgcc_s_a_AR) fakelib/libgcc_s.a
$(fakelib_libgcc_s_a_OBJECTS) $(fakelib_libgcc_s_a_LIBADD)
$(AM_V_at)$(RANLIB) fakelib/libgcc_s.a
-
-libpthread.a: $(libpthread_a_OBJECTS) $(libpthread_a_DEPENDENCIES)
$(EXTRA_libpthread_a_DEPENDENCIES)
- $(AM_V_at)-rm -f libpthread.a
- $(AM_V_AR)$(libpthread_a_AR) libpthread.a $(libpthread_a_OBJECTS)
$(libpthread_a_LIBADD)
- $(AM_V_at)$(RANLIB) libpthread.a
-
-libpthread.dll.a: $(libpthread_dll_a_OBJECTS) $(libpthread_dll_a_DEPENDENCIES)
$(EXTRA_libpthread_dll_a_DEPENDENCIES)
- $(AM_V_at)-rm -f libpthread.dll.a
- $(AM_V_AR)$(libpthread_dll_a_AR) libpthread.dll.a
$(libpthread_dll_a_OBJECTS) $(libpthread_dll_a_LIBADD)
- $(AM_V_at)$(RANLIB) libpthread.dll.a
src/$(am__dirstamp):
@$(MKDIR_P) src
@: > src/$(am__dirstamp)
@@ -1205,7 +1142,7 @@ check: check-recursive
all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS) config.h
installdirs: installdirs-recursive
installdirs-am:
- for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libdir)"
"$(DESTDIR)$(includedir)"; do \
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
@@ -1245,8 +1182,8 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
-clean-am: clean-generic clean-libLIBRARIES clean-libLTLIBRARIES \
- clean-libtool clean-noinstLIBRARIES mostlyclean-am
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
@@ -1286,8 +1223,9 @@ install-dvi: install-dvi-recursive
install-dvi-am:
-install-exec-am: install-libLIBRARIES install-libLTLIBRARIES
-
+install-exec-am: install-libLTLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-html: install-html-recursive
install-html-am:
@@ -1341,31 +1279,32 @@ ps: ps-recursive
ps-am:
-uninstall-am: uninstall-includeHEADERS uninstall-libLIBRARIES \
- uninstall-libLTLIBRARIES
-
-.MAKE: $(am__recursive_targets) all install-am install-strip
+uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) uninstall-hook
+.MAKE: $(am__recursive_targets) all install-am install-exec-am \
+ install-strip uninstall-am
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--depfiles am--refresh check check-am clean clean-cscope \
- clean-generic clean-libLIBRARIES clean-libLTLIBRARIES \
- clean-libtool clean-noinstLIBRARIES cscope cscopelist-am ctags \
- ctags-am dist dist-all dist-bzip2 dist-gzip dist-lzip \
- dist-shar dist-tarZ dist-xz dist-zip dist-zstd distcheck \
- distclean distclean-compile distclean-generic distclean-hdr \
+ clean-generic clean-libLTLIBRARIES clean-libtool \
+ clean-noinstLIBRARIES cscope cscopelist-am ctags ctags-am dist \
+ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
+ dist-xz dist-zip dist-zstd distcheck distclean \
+ distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-includeHEADERS install-info \
- install-info-am install-libLIBRARIES install-libLTLIBRARIES \
+ install-dvi-am install-exec install-exec-am install-exec-hook \
+ install-html install-html-am install-includeHEADERS \
+ install-info install-info-am install-libLTLIBRARIES \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags tags-am uninstall uninstall-am uninstall-includeHEADERS \
- uninstall-libLIBRARIES uninstall-libLTLIBRARIES
+ tags tags-am uninstall uninstall-am uninstall-hook \
+ uninstall-includeHEADERS uninstall-libLTLIBRARIES
.PRECIOUS: Makefile
@@ -1374,6 +1313,36 @@ uninstall-am: uninstall-includeHEADERS
uninstall-libLIBRARIES \
.rc.lo:
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --tag=RC --mode=compile
$(RC) $(RCFLAGS) -i $< -o $@
+# Handle pthread[.dll].{lib|a} alias when installing
+install-exec-hook:
+ if test -f $(DESTDIR)$(libdir)/libwinpthread.a; then \
+ cp -f $(DESTDIR)$(libdir)/libwinpthread.a
$(DESTDIR)$(libdir)/libpthread.a; \
+ else \
+ :; \
+ fi
+ if test -f $(DESTDIR)$(libdir)/libwinpthread.dll.a; then \
+ cp -f $(DESTDIR)$(libdir)/libwinpthread.dll.a
$(DESTDIR)$(libdir)/libpthread.dll.a; \
+ else \
+ :; \
+ fi
+ if test -f $(DESTDIR)$(libdir)/winpthread.lib; then \
+ cp -f $(DESTDIR)$(libdir)/winpthread.lib
$(DESTDIR)$(libdir)/pthread.lib; \
+ else \
+ :; \
+ fi
+ if test -f $(DESTDIR)$(libdir)/winpthread.dll.lib; then \
+ cp -f $(DESTDIR)$(libdir)/winpthread.dll.lib
$(DESTDIR)$(libdir)/pthread.dll.lib; \
+ else \
+ :; \
+ fi
+
+# Likewise when uninstalling
+uninstall-hook:
+ for file in $(DESTDIR)$(libdir)/libpthread.a
$(DESTDIR)$(libdir)/libpthread.dll.a \
+ $(DESTDIR)$(libdir)/pthread.lib
$(DESTDIR)$(libdir)/pthread.dll.lib; do \
+ rm -f $${file}; \
+ done
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/mingw-w64-libraries/winpthreads/tests/Makefile.in
b/mingw-w64-libraries/winpthreads/tests/Makefile.in
index bb0e75bcc..89f6eed39 100644
--- a/mingw-w64-libraries/winpthreads/tests/Makefile.in
+++ b/mingw-w64-libraries/winpthreads/tests/Makefile.in
@@ -87,6 +87,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+@MSVC_FALSE@am__append_1 = -L$(top_builddir)/fakelib
check_PROGRAMS = t_clock_getres$(EXEEXT) t_clock_gettime$(EXEEXT) \
t_clock_nanosleep$(EXEEXT) t_clock_settime$(EXEEXT) \
t_nanosleep$(EXEEXT)
@@ -523,7 +524,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
-AM_LDFLAGS = -L$(top_builddir)/fakelib -L$(top_builddir) -lwinpthread -static
+AM_LDFLAGS = $(am__append_1) -L$(top_builddir) -lwinpthread -static
TESTS = $(check_PROGRAMS)
all: all-am
--
2.46.1.windows.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public