xref: /freebsd/crypto/openssl/util/opensslwrap.sh (revision e0c4386e7e71d93b0edc0c8fa156263fc4a8b0b6)
1*e0c4386eSCy Schubert#!/bin/sh
2*e0c4386eSCy Schubert
3*e0c4386eSCy SchubertHERE="`echo $0 | sed -e 's|[^/]*$||'`"
4*e0c4386eSCy SchubertOPENSSL="${HERE}../apps/openssl"
5*e0c4386eSCy Schubert
6*e0c4386eSCy Schubertif [ -d "${HERE}../engines" -a "x$OPENSSL_ENGINES" = "x" ]; then
7*e0c4386eSCy Schubert	OPENSSL_ENGINES="${HERE}../engines"; export OPENSSL_ENGINES
8*e0c4386eSCy Schubertfi
9*e0c4386eSCy Schubertif [ -d "${HERE}../providers" -a "x$OPENSSL_MODULES" = "x" ]; then
10*e0c4386eSCy Schubert	OPENSSL_MODULES="${HERE}../providers"; export OPENSSL_MODULES
11*e0c4386eSCy Schubertfi
12*e0c4386eSCy Schubert
13*e0c4386eSCy Schubertif [ -x "${OPENSSL}.exe" ]; then
14*e0c4386eSCy Schubert	# The original reason for this script existence is to work around
15*e0c4386eSCy Schubert	# certain caveats in run-time linker behaviour. On Windows platforms
16*e0c4386eSCy Schubert	# adjusting $PATH used to be sufficient, but with introduction of
17*e0c4386eSCy Schubert	# SafeDllSearchMode in XP/2003 the only way to get it right in
18*e0c4386eSCy Schubert	# *all* possible situations is to copy newly built .DLLs to apps/
19*e0c4386eSCy Schubert	# and test/, which is now done elsewhere... The $PATH is adjusted
20*e0c4386eSCy Schubert	# for backward compatibility (and nostagical reasons:-).
21*e0c4386eSCy Schubert	if [ "$OSTYPE" != msdosdjgpp ]; then
22*e0c4386eSCy Schubert		PATH="${HERE}..:$PATH"; export PATH
23*e0c4386eSCy Schubert	fi
24*e0c4386eSCy Schubert	exec "${OPENSSL}.exe" "$@"
25*e0c4386eSCy Schubertelif [ -x "${OPENSSL}" -a -x "${HERE}shlib_wrap.sh" ]; then
26*e0c4386eSCy Schubert	exec "${HERE}shlib_wrap.sh" "${OPENSSL}" "$@"
27*e0c4386eSCy Schubertelse
28*e0c4386eSCy Schubert	exec "${OPENSSL}" "$@"	# hope for the best...
29*e0c4386eSCy Schubertfi
30