
---
 Configurations/unix-Makefile.tmpl | 3 ++-
 Configure                         | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index ebf2096..bcd338d 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -304,7 +304,8 @@ LIBDIR={- our $libdir = $config{libdir};
 # $(libdir) is chosen to be compatible with the GNU coding standards
 libdir={- file_name_is_absolute($libdir)
           ? $libdir : '$(INSTALLTOP)/$(LIBDIR)' -}
-ENGINESDIR=$(libdir)/engines-{- $sover_dirname -}
+ENGINESDIR={- use File::Spec::Functions;
+              $config{enginesdir} -}
 MODULESDIR=$(libdir)/ossl-modules
 
 # Convenience variable for those who want to set the rpath in shared
diff --git a/Configure b/Configure
index ab57c20..6703876 100755
--- a/Configure
+++ b/Configure
@@ -385,6 +385,7 @@ $config{perl_archname} = $Config{archname};
 
 $config{prefix}="";
 $config{openssldir}="";
+$config{enginesdir}="";
 $config{processor}="";
 $config{libdir}="";
 my $auto_threads=1;    # enable threads automatically? true by default
@@ -954,6 +955,10 @@ while (@argvcopy)
                         {
                         $config{openssldir}=$1;
                         }
+		elsif (/^--enginesdir=(.*)$/)
+			{
+			$config{enginesdir}=$1;
+			}
                 elsif (/^--with-zlib-lib=(.*)$/)
                         {
                         $withargs{zlib_lib}=$1;
-- 
2.25.1

