Index: PerlMagick/Makefile.PL.in
--- PerlMagick/Makefile.PL.in.orig	2021-09-02 20:04:00.091612000 +0200
+++ PerlMagick/Makefile.PL.in	2021-09-02 20:05:13.935623000 +0200
@@ -162,10 +162,10 @@
 
 # defaults for LIBS & INC & CCFLAGS params that we later pass to Writemakefile
 my $INC_magick = '-I../ -I@top_srcdir@ @CPPFLAGS@ -I"' . $Config{'usrinc'} . '/ImageMagick"';
-my $LIBS_magick = '-L../MagickCore/.libs -lMagickCore-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@ @MATH_LIBS@ -L' . $Config{'archlib'} . '/CORE';
+my $LIBS_magick = '-L../MagickCore/.libs -lMagickCore @MATH_LIBS@ -L' . $Config{'archlib'} . '/CORE';
 my $CCFLAGS_magick = "$Config{'ccflags'} @CFLAGS@";
-my $LDFLAGS_magick   = "-L../MagickCore/.libs -lMagickCore-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@ $Config{'ldflags'} @LDFLAGS@";
-my $LDDLFLAGS_magick = "-L../MagickCore/.libs -lMagickCore-@MAGICK_MAJOR_VERSION@.@MAGICK_ABI_SUFFIX@ $Config{'lddlflags'} @LDFLAGS@";
+my $LDFLAGS_magick   = "-L../MagickCore/.libs -lMagickCore $Config{'ldflags'} @LDFLAGS@";
+my $LDDLFLAGS_magick = "-L../MagickCore/.libs -lMagickCore $Config{'lddlflags'} @LDFLAGS@";
 
 if (($^O eq 'MSWin32') && ($Config{cc} =~ /gcc/)) {
   my($Ipaths, $Lpaths) = AutodetectWin32gcc();
Index: MagickCore/distribute-cache.c
--- MagickCore/distribute-cache.c.orig	2023-04-22 13:09:49.000000000 +0200
+++ MagickCore/distribute-cache.c	2023-04-22 23:37:45.493269000 +0200
@@ -110,6 +110,12 @@
 #define send(file,buffer,length,flags)  0
 #define recv(file,buffer,length,flags)  0
 #endif
+#ifndef CLOSE_SOCKET
+#define CLOSE_SOCKET(socket) (void) close(socket)
+#endif
+#ifndef LENGTH_TYPE
+#define LENGTH_TYPE int
+#endif
 
 /*
   Define declarations.
