makefile: Explicitly add /lib and /usr/lib to the library search path

Some compiler & linkers on some platforms don't dynamically provide
a way to determine the library search path, so if /lib and /usr/lib exist
as directories they are added to the end of the library search path.

As reported in #1026
This commit is contained in:
Mark Pizzolato 2021-04-05 15:15:33 -07:00
parent be4e3c4e33
commit e9025a189f

View file

@ -477,6 +477,16 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin)
endif
endif
endif
ifeq (,$(filter /lib/,$(LIBPATH)))
ifeq (existlib,$(shell if $(TEST) -d /lib/; then echo existlib; fi))
LIBPATH += /lib/
endif
endif
ifeq (,$(filter /usr/lib/,$(LIBPATH)))
ifeq (existusrlib,$(shell if $(TEST) -d /usr/lib/; then echo existusrlib; fi))
LIBPATH += /usr/lib/
endif
endif
# Some gcc versions don't support LTO, so only use LTO when the compiler is known to support it
ifeq (,$(NO_LTO))
ifneq (,$(GCC_VERSION))