diff -ruN R-4.1.0-orig/Makefile.fw R-4.1.0/Makefile.fw
--- R-4.1.0-orig/Makefile.fw	2021-08-06 09:00:56.000000000 +0900
+++ R-4.1.0/Makefile.fw	2021-08-06 11:40:37.000000000 +0900
@@ -8,7 +8,7 @@
 
 install install-strip: install-R-framework
 		@(sed 's|^LIBR =.*|LIBR = -F$(R_FRAMEWORK_DIR)/.. -framework R|' \
-		  $(top_builddir)/etc/Makeconf > "$(rhome)/etc${R_ARCH}/Makeconf")
+		  $(top_builddir)/etc/Makeconf > "$(DESTDIR)$(R_FRAMEWORK_DIR)/Resources/etc${R_ARCH}/Makeconf")
 		@(sed 's/Versions\/$(FW_VERSION)\/Resources/Resources/' \
 		  "$(DESTDIR)$(R_FRAMEWORK_DIR)/Resources/bin/R" > \
 		  "$(DESTDIR)$(R_FRAMEWORK_DIR)/Resources/bin/RR")
@@ -37,7 +37,7 @@
 	  ln -f -s -n Versions/Current/Resources Resources)
 	@## the resulting libR will point dyld to the fat libR regardless of its origin
 	@(cd "$(DESTDIR)$(R_FRAMEWORK_DIR)/Resources/lib" && \
-	  install_name_tool -id "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/lib/libR.dylib" $(Rexeclibdir)/libR.dylib)
+	  install_name_tool -id "$(R_FRAMEWORK_DIR)/Versions/$(FW_VERSION)/Resources/lib/libR.dylib" $(DESTDIR)$(Rexeclibdir)/libR.dylib)
 	@( otool=otool ; if otool -D "$(DESTDIR)$(Rexeclibdir)/libR.dylib"|grep 'not an object'>/dev/null; then otool=otool64; fi; \
 	   for lib in Rlapack Rblas R; do \
 	   if test -e "$(DESTDIR)$(Rexeclibdir)/lib$${lib}.dylib"; then $(ECHO) "  lib$${lib}"; \
diff -Nurd R-4.1.1.orig/configure R-4.1.1/configure
--- R-4.1.1.orig/configure	2021-08-02 18:15:58.000000000 -0400
+++ R-4.1.1/configure	2023-10-14 01:08:54.000000000 -0400
@@ -3915,8 +3915,8 @@
 
 ## As from R 3.2.0 split up -L... and -lR
 if test "${want_R_shlib}" = yes; then
-  LIBR0="-L\"\$(R_HOME)/lib\$(R_ARCH)\""
-  LIBR1=-lR
+  LIBR0="\$(R_HOME)/lib\$(R_ARCH)/libR\$(DYLIB_EXT)"
+  LIBR1=
 else
   LIBR0=
   LIBR1=
@@ -42049,7 +42049,7 @@
 
 if test "${use_blas_shlib}" = yes; then
   ## set BLAS_LIBS to point at local version
-  BLAS_LIBS="-L\"\$(R_HOME)/lib\$(R_ARCH)\" -lRblas"
+  BLAS_LIBS="\$(R_HOME)/lib\$(R_ARCH)/libRblas\$(DYLIB_EXT)"
 fi
 
  if test "x${use_veclib_g95fix}" = xyes; then
@@ -42214,7 +42214,7 @@
 
 fi
 if test "${acx_lapack_ok}" != "yes"; then
-  LAPACK_LIBS="-L\"\$(R_HOME)/lib\$(R_ARCH)\" -lRlapack"
+  LAPACK_LIBS="\$(R_HOME)/lib\$(R_ARCH)/libRlapack\$(DYLIB_EXT)"
 fi
 
  if test "${acx_lapack_ok}" = "yes"; then
@@ -46035,8 +46035,8 @@
 
 
 if test "x${have_libcurl}" = "xyes"; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libcurl is version 7 and >= 7.28.0" >&5
-$as_echo_n "checking if libcurl is version 7 and >= 7.28.0... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if libcurl is >= 7.28.0" >&5
+$as_echo_n "checking if libcurl is >= 7.28.0... " >&6; }
 if ${r_cv_have_curl728+:} false; then :
   $as_echo_n "(cached) " >&6
 else
@@ -46052,7 +46052,7 @@
 {
 #ifdef LIBCURL_VERSION_MAJOR
 #if LIBCURL_VERSION_MAJOR > 7
-  exit(1);
+  exit(0);
 #elif LIBCURL_VERSION_MAJOR == 7 && LIBCURL_VERSION_MINOR >= 28
   exit(0);
 #else
diff -ruN R-4.1.0-orig/src/extra/intl/vasnprintf.c R-4.1.0/src/extra/intl/vasnprintf.c
--- R-4.1.0-orig/src/extra/intl/vasnprintf.c	2021-08-06 09:00:56.000000000 +0900
+++ R-4.1.0/src/extra/intl/vasnprintf.c	2021-08-06 11:40:37.000000000 +0900
@@ -4006,7 +4006,7 @@
 #endif
 		  *fbp = dp->conversion;
 #if USE_SNPRINTF
-# if !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3))
+# if !defined(__APPLE__) && !(__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3))
 		fbp[1] = '%';
 		fbp[2] = 'n';
 		fbp[3] = '\0';
diff -ruN R-4.1.0-orig/src/main/Makefile.in R-4.1.0/src/main/Makefile.in
--- R-4.1.0-orig/src/main/Makefile.in	2021-08-06 09:01:04.000000000 +0900
+++ R-4.1.0/src/main/Makefile.in	2021-08-06 17:09:48.000000000 +0900
@@ -102,7 +102,7 @@
 R_bin_OBJECTS = Rmain.o @WANT_R_SHLIB_FALSE@$(OBJECTS)
 @WANT_R_SHLIB_FALSE@R_bin_LDADD = $(MAIN_OBJS) $(EXTRA_STATIC_LIBS) $(EXTRA_LIBS)
 ## Linked against -lRblas because -lR is and otherwise ld complains.
-@WANT_R_SHLIB_TRUE@R_bin_LDADD = -lR @BLAS_SHLIB_TRUE@-lRblas
+@WANT_R_SHLIB_TRUE@R_bin_LDADD = ../../lib@R_ARCH@/libR$(DYLIB_EXT) @BLAS_SHLIB_TRUE@../../lib@R_ARCH@/libRblas$(DYLIB_EXT)
 ## This should depend on MAIN_OBJS not MAIN_LIBS, but we can't use that.
 ## There is also a dependence on libRblas when that is internal and static.
 @WANT_R_SHLIB_FALSE@R_bin_DEPENDENCIES = $(MAIN_LIBS) $(EXTRA_STATIC_LIBS)@USE_EXPORTFILES_TRUE@ $(top_builddir)/etc/R.exp
diff -ruN R-4.1.0-orig/src/nmath/standalone/Makefile.in R-4.1.0/src/nmath/standalone/Makefile.in
--- R-4.1.0-orig/src/nmath/standalone/Makefile.in	2021-08-06 09:01:05.000000000 +0900
+++ R-4.1.0/src/nmath/standalone/Makefile.in	2021-08-06 11:40:37.000000000 +0900
@@ -134,7 +134,7 @@
 
 test: $(srcdir)/test.c
 	$(CC) -o $@ $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(srcdir)/test.c \
-	  -L. -lRmath $(LIBM)
+	  libRmath$(DYLIB_EXT) $(LIBM)
 
 install: installdirs install-header @WANT_R_FRAMEWORK_FALSE@ install-pc
 @WANT_R_FRAMEWORK_FALSE@	@!(test -f $(libRmath_la)) || $(SHELL) $(top_srcdir)/tools/copy-if-change $(libRmath_la) $(DESTDIR)$(libdir)/$(libRmath_la)