Here's the updated patch. I also used `$(INSTALL_DATA)` instead of `$(LN_S)` 
which I think makes more sense.

- Kirill Makurin

________________________________
From: LIU Hao
Sent: Sunday, February 16, 2025 8:46 PM
To: Kirill Makurin; mingw-w64-public@lists.sourceforge.net
Subject: Re: [Mingw-w64-public] make sure WINPTHREAD_API is correctly defined 
in pthread_time.h

在 2025-02-16 19:38, Kirill Makurin 写道:
> If you're good with that patch, I would like to update it to also remove 
> lines in `configure.ac`
> which define `COPY_STATIC` and `COPY_SHARED` Automake conditionals. Let me 
> know what you decide.
>
>

Yes it makes sense. `LT_OBJDIR` also seems unused thereafter.


--
Best regards,
LIU Hao
From 09a47398f78107903fa42c7fe8c61ef5cfb7ec75 Mon Sep 17 00:00:00 2001
From: Kirill Makurin <maiddais...@outlook.com>
Date: Sun, 16 Feb 2025 21:22:00 +0900
Subject: [PATCH 3/3] winpthreads: handle pthread alias during installation

Remove definition of Automake conditionals COPY_STATIC and COPY_SHARED
from configure.ac as they are no longer used.

Remove SUBST([LT_OBJDIR]) from configure.ac as it is no longer needed.

Signed-off-by: Kirill Makurin <maiddais...@outlook.com>
---
 mingw-w64-libraries/winpthreads/Makefile.am  | 45 +++++++++++---------
 mingw-w64-libraries/winpthreads/configure.ac |  7 ---
 2 files changed, 24 insertions(+), 28 deletions(-)

diff --git a/mingw-w64-libraries/winpthreads/Makefile.am 
b/mingw-w64-libraries/winpthreads/Makefile.am
index 54eca7b81..6b0338af0 100644
--- a/mingw-w64-libraries/winpthreads/Makefile.am
+++ b/mingw-w64-libraries/winpthreads/Makefile.am
@@ -29,29 +29,32 @@ 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 $@
 
-DISTCHECK_CONFIGURE_FLAGS = --host=$(host_triplet)
+# Handle -lpthread alias when installing
+install-exec-hook:
+       . $(builddir)/libwinpthread.la; \
+       if test -n "$${library_names}"; then \
+               alias=$$(printf %s "$${library_names}" | $(SED) 
's|winpthread|pthread|'); \
+               $(INSTALL_DATA) $(DESTDIR)$(libdir)/$${library_names} 
$(DESTDIR)$(libdir)/$${alias}; \
+       fi; \
+       if test -n "$${old_library}"; then \
+               alias=$$(printf %s "$${old_library}" | $(SED) 
's|winpthread|pthread|'); \
+               $(INSTALL_DATA) $(DESTDIR)$(libdir)/$${old_library} 
$(DESTDIR)$(libdir)/$${alias}; \
+       fi
+
+# Likewise when uninstalling
+uninstall-hook:
+       . $(builddir)/libwinpthread.la; \
+       if test -n "$${library_names}"; then \
+               alias=$$(printf %s "$${library_names}" | $(SED) 
's|winpthread|pthread|'); \
+               rm -f $(DESTDIR)$(libdir)/$${alias}; \
+       fi; \
+       if test -n "$${old_library}"; then \
+               alias=$$(printf %s "$${old_library}" | $(SED) 
's|winpthread|pthread|'); \
+               rm -f $(DESTDIR)$(libdir)/$${alias}; \
+       fi
 
+DISTCHECK_CONFIGURE_FLAGS = --host=$(host_triplet)
diff --git a/mingw-w64-libraries/winpthreads/configure.ac 
b/mingw-w64-libraries/winpthreads/configure.ac
index 47be2d6cc..0ae6f027c 100644
--- a/mingw-w64-libraries/winpthreads/configure.ac
+++ b/mingw-w64-libraries/winpthreads/configure.ac
@@ -34,13 +34,6 @@ AM_CONDITIONAL([MSVC], [test x$msvc = xtrue])
 LT_INIT([win32-dll])
 LT_LANG([Windows Resource])
 
-AC_SUBST([LT_OBJDIR],$lt_cv_objdir)
-
-AS_VAR_IF([enable_shared], [yes], [AS_VAR_SET([copy_shared])])
-AS_VAR_IF([enable_static], [yes], [AS_VAR_SET([copy_static])])
-AM_CONDITIONAL( [COPY_SHARED], [AS_VAR_TEST_SET([copy_shared])] )
-AM_CONDITIONAL( [COPY_STATIC], [AS_VAR_TEST_SET([copy_static])] )
-
 # Checks for libraries.
 # FIXME: Replace `main' with a function in `-lpthread':
 #AC_CHECK_LIB([pthread], [main])
-- 
2.46.1.windows.1

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to