From 17f847af21f1b3eb6b193ddf95bad1efe36034da Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Fri, 5 Nov 2004 09:12:18 +0000 Subject: [PATCH] Make sure LD_PRELOAD is only set when we build shared libraries (and therefore link with them). Add LD_PRELOAD setting code where it was still missing. PR: 966 --- Makefile.org | 8 ++++++++ apps/Makefile | 4 ++++ test/Makefile | 7 +++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Makefile.org b/Makefile.org index 439f033094..2a6eb9ad95 100644 --- a/Makefile.org +++ b/Makefile.org @@ -687,6 +687,10 @@ rehash.time: certs LIBPATH="`pwd`:$$LIBPATH"; \ if [ "$(PLATFORM)" = "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \ export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \ + if [ -n "$(SHARED_LIBS)" ]; then \ + LD_PRELOAD="$$OSSL_LIBPATH/libssl.so $$OSSL_LIBPATH/libcrypto.so"; \ + export LD_PRELOAD; \ + fi; \ $(PERL) tools/c_rehash certs) touch rehash.time @@ -701,6 +705,10 @@ tests: rehash LIBPATH="`pwd`:$$LIBPATH"; \ if [ "$(PLATFORM)" = "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \ export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \ + if [ -n "$(SHARED_LIBS)" ]; then \ + LD_PRELOAD="$$OSSL_LIBPATH/libssl.so $$OSSL_LIBPATH/libcrypto.so"; \ + export LD_PRELOAD; \ + fi; \ apps/openssl version -a report: diff --git a/apps/Makefile b/apps/Makefile index b44c8fa384..e0cb60a47b 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -159,6 +159,10 @@ $(EXE): progs.h $(E_OBJ) $(PROGRAM).o $(DLIBCRYPTO) $(DLIBSSL) LIBPATH="`pwd`:$$LIBPATH"; \ if [ "$(PLATFORM)" = "Cygwin" ]; then PATH="`pwd`:$$PATH"; fi; \ export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \ + if [ -n "$(SHARED_LIBS)" ]; then \ + LD_PRELOAD="$$OSSL_LIBPATH/libssl.so $$OSSL_LIBPATH/libcrypto.so"; \ + export LD_PRELOAD; \ + fi; \ $(PERL) tools/c_rehash certs) progs.h: progs.pl diff --git a/test/Makefile b/test/Makefile index 98e815cbd6..aedd016f3f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -129,9 +129,12 @@ SET_SO_PATHS=OSSL_LIBPATH="`cd ..; pwd`"; \ DYLD_LIBRARY_PATH="$$OSSL_LIBPATH:$$DYLD_LIBRARY_PATH"; \ SHLIB_PATH="$$OSSL_LIBPATH:$$SHLIB_PATH"; \ LIBPATH="$$OSSL_LIBPATH:$$LIBPATH"; \ - LD_PRELOAD="$$OSSL_LIBPATH/libssl.so $$OSSL_LIBPATH/libcrypto.so"; \ if [ "$(PLATFORM)" = "Cygwin" ]; then PATH="$${LIBPATH}:$$PATH"; fi; \ - export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH LD_PRELOAD + export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH PATH; \ + if [ -n "$(SHARED_LIBS)" ]; then \ + LD_PRELOAD="$$OSSL_LIBPATH/libssl.so $$OSSL_LIBPATH/libcrypto.so"; \ + export LD_PRELOAD; \ + fi alltests: \ test_des test_idea test_sha test_md4 test_md5 test_hmac \ -- 2.25.1