@@ -169,53 +169,69 @@ endif
169169# echo "$$P"
170170
171171define symlink_system_library
172- symlink_$1: $$(build_private_libdir ) /$1.$$(SHLIB_EXT )
173- $$(build_private_libdir ) /$1.$$(SHLIB_EXT ) :
174- REALPATH=`$$(call spawn,$$(build_depsbindir ) /libwhich) -p $$(notdir $$@ ) ` && \
175- $$(call resolve_path,REALPATH) && \
176- [ -e "$$$$REALPATH" ] && \
177- ([ ! -e "$$@ " ] || rm "$$@ ") && \
178- echo ln -sf "$$$$REALPATH" "$$@ " && \
179- ln -sf "$$$$REALPATH" "$$@ "
180- ifneq ($2,)
181- ifneq ($$(USE_SYSTEM_$2 ) ,0)
182- SYMLINK_SYSTEM_LIBRARIES += symlink_$1
183- endif
172+ libname_$2 := $$(notdir $(call versioned_libname,$2,$3) )
173+ libpath_$2 := $$(shell $$(call spawn,$$(build_depsbindir ) /libwhich) -p $$(libname_$2 ) 2>/dev/null)
174+ symlink_$2: $$(build_private_libdir ) /$$(libname_$2 )
175+ $$(build_private_libdir ) /$$(libname_$2 ) :
176+ @if [ -e "$$(libpath_$2 ) " ]; then \
177+ REALPATH=$$(libpath_$2 ) ; \
178+ $$(call resolve_path,REALPATH) && \
179+ [ -e "$$$$REALPATH" ] && \
180+ ([ ! -e "$$@ " ] || rm "$$@ ") && \
181+ echo ln -sf "$$$$REALPATH" "$$@ " && \
182+ ln -sf "$$$$REALPATH" "$$@ "; \
183+ else \
184+ if [ "$4" != "ALLOW_FAILURE" ]; then \
185+ echo "System library symlink failure: Unable to locate $$(libname_$2 ) on your system!" >&2; \
186+ false; \
187+ fi; \
188+ fi
189+ ifneq ($$(USE_SYSTEM_$1 ) ,0)
190+ SYMLINK_SYSTEM_LIBRARIES += symlink_$2
184191endif
185192endef
186193
187194# the following excludes: libuv.a, libutf8proc.a
188195
189- $(eval $(call symlink_system_library,$(LIBMNAME)))
190196ifneq ($(USE_SYSTEM_LIBM ) ,0)
191- SYMLINK_SYSTEM_LIBRARIES += symlink_ $(LIBMNAME )
197+ $(eval $(call symlink_system_library,LIBM, $(LIBMNAME)) )
192198else ifneq ($(USE_SYSTEM_OPENLIBM),0)
193- SYMLINK_SYSTEM_LIBRARIES += symlink_ $(LIBMNAME )
199+ $(eval $(call symlink_system_library,OPENLIBM, $(LIBMNAME)) )
194200endif
195201
196- $(eval $(call symlink_system_library,libpcre2-8,PCRE))
197- $(eval $(call symlink_system_library,libdSFMT,DSFMT))
198- $(eval $(call symlink_system_library,$(LIBBLASNAME),BLAS))
202+ $(eval $(call symlink_system_library,CSL,libgcc_s,1))
203+ ifneq (,$(LIBGFORTRAN_VERSION ) )
204+ $(eval $(call symlink_system_library,CSL,libgfortran,$(LIBGFORTRAN_VERSION)))
205+ endif
206+ $(eval $(call symlink_system_library,CSL,libquadmath,0))
207+ $(eval $(call symlink_system_library,CSL,libstdc++,6))
208+ # We allow libssp, libatomic and libgomp to fail as they are not available on all systems
209+ $(eval $(call symlink_system_library,CSL,libssp,0,ALLOW_FAILURE))
210+ $(eval $(call symlink_system_library,CSL,libatomic,1,ALLOW_FAILURE))
211+ $(eval $(call symlink_system_library,CSL,libgomp,1,ALLOW_FAILURE))
212+ $(eval $(call symlink_system_library,PCRE,libpcre2-8))
213+ $(eval $(call symlink_system_library,DSFMT,libdSFMT))
214+ $(eval $(call symlink_system_library,BLAS,$(LIBBLASNAME)))
199215ifneq ($(LIBLAPACKNAME ) ,$(LIBBLASNAME ) )
200- $(eval $(call symlink_system_library,$(LIBLAPACKNAME),LAPACK ))
216+ $(eval $(call symlink_system_library,LAPACK, $(LIBLAPACKNAME)))
201217endif
202- $(eval $(call symlink_system_library,libgmp, GMP))
203- $(eval $(call symlink_system_library,libmpfr, MPFR))
204- $(eval $(call symlink_system_library,libmbedtls, MBEDTLS))
205- $(eval $(call symlink_system_library,libmbedcrypto, MBEDTLS))
206- $(eval $(call symlink_system_library,libmbedx509, MBEDTLS))
207- $(eval $(call symlink_system_library,libssh2, LIBSSH2))
208- $(eval $(call symlink_system_library,libnghttp2, NGHTTP2))
209- $(eval $(call symlink_system_library,libcurl, CURL))
210- $(eval $(call symlink_system_library,libgit2, LIBGIT2))
211- $(eval $(call symlink_system_library,libamd, SUITESPARSE))
212- $(eval $(call symlink_system_library,libcamd, SUITESPARSE))
213- $(eval $(call symlink_system_library,libccolamd, SUITESPARSE))
214- $(eval $(call symlink_system_library,libcholmod, SUITESPARSE))
215- $(eval $(call symlink_system_library,libcolamd, SUITESPARSE))
216- $(eval $(call symlink_system_library,libumfpack, SUITESPARSE))
217- $(eval $(call symlink_system_library,libspqr, SUITESPARSE))
218- $(eval $(call symlink_system_library,libsuitesparseconfig, SUITESPARSE))
218+ $(eval $(call symlink_system_library,GMP,libgmp ))
219+ $(eval $(call symlink_system_library,MPFR,libmpfr ))
220+ $(eval $(call symlink_system_library,MBEDTLS,libmbedtls ))
221+ $(eval $(call symlink_system_library,MBEDTLS,libmbedcrypto ))
222+ $(eval $(call symlink_system_library,MBEDTLS,libmbedx509 ))
223+ $(eval $(call symlink_system_library,LIBSSH2,libssh2 ))
224+ $(eval $(call symlink_system_library,NGHTTP2,libnghttp2 ))
225+ $(eval $(call symlink_system_library,CURL,libcurl ))
226+ $(eval $(call symlink_system_library,LIBGIT2,libgit2 ))
227+ $(eval $(call symlink_system_library,SUITESPARSE,libamd ))
228+ $(eval $(call symlink_system_library,SUITESPARSE,libcamd ))
229+ $(eval $(call symlink_system_library,SUITESPARSE,libccolamd ))
230+ $(eval $(call symlink_system_library,SUITESPARSE,libcholmod ))
231+ $(eval $(call symlink_system_library,SUITESPARSE,libcolamd ))
232+ $(eval $(call symlink_system_library,SUITESPARSE,libumfpack ))
233+ $(eval $(call symlink_system_library,SUITESPARSE,libspqr ))
234+ $(eval $(call symlink_system_library,SUITESPARSE,libsuitesparseconfig ))
219235# EXCLUDED LIBRARIES (installed/used, but not vendored for use with dlopen):
220236# libunwind
221237endif # WINNT
0 commit comments