[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Fri Feb 19 10:53:42 UTC 2016


The branch master has been updated
       via  0fb3b629026831339489b0bae506281e7f2064e6 (commit)
       via  520f434b42c83d63d8777075eb66967618551d5b (commit)
       via  f99f91f1218d12e2e3a0fe10bb97445984a830c8 (commit)
       via  98e5534e65712641930173f85262726d6fd6496e (commit)
       via  5386287cfcf0a4165fac742aa21455db3d49b3ab (commit)
       via  c8c2b77900f9808fc644d206d8715a78dd9801bd (commit)
       via  9ee0ed3de66678a15db126d10b3e4226e835b8f5 (commit)
       via  24e75727bddff81004e13dea4cb771cf63a307b7 (commit)
       via  e048fd517178d6e608b4c7f3d41799bcf5798d07 (commit)
       via  f5c174ff9396053a2fbb73eec8b5e28d3da75797 (commit)
       via  e987f9f271a13558213e56659fba943df1578f98 (commit)
      from  a8a421b1136a7aefa6d8658ab1095bb87e90b82e (commit)


- Log -----------------------------------------------------------------
commit 0fb3b629026831339489b0bae506281e7f2064e6
Author: Richard Levitte <levitte at openssl.org>
Date:   Thu Feb 18 17:18:55 2016 +0100

    Make sure the linked programs have the correct extension
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>

commit 520f434b42c83d63d8777075eb66967618551d5b
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Feb 16 20:37:28 2016 +0100

    Big rename fest of MingW shared libraries
    
    So far, MingW shared libraries were named like this
    
      libeay32.dll + libeay32.dll.a
      ssleay32.dll + ssleay32.dll.a
    
    That naming scheme is antiquated, a reminicense of SSLeay.  We're
    therefore changing the scheme to something that's more like the rest
    of OpenSSL.
    
    There are two factors to remember:
    
      - Windows libraries have no recorded SOvers, which means that the
        shared library version must be encoded in the name.  According to
        some, it's unwise to encode extra periods in a Windows file name,
        so we convert version number periods to underscores.
      - MingW has multilib ability.  However, DLLs need to reside with the
        binaries that use them, so to allow both 32-bit and 64-bit DLLs to
        reside in the same place, we add '-x64' in the name of the 64-bit
        ones.
    
    The resulting name scheme (for SOver 1.1) is this:
    
      on x86:
      libcrypto-1_1.dll + libcrypto.dll.a
      libssl-1_1.dll + libssl.dll.a
    
      on x86_64:
      libcrypto-1_1-x64.dll + libcrypto.dll.a
      libssl-1_1-x64.dll + libssl.dll.a
    
    An observation is that the import lib is the same for both
    architectures.  Not to worry, though, as they will be installed in
    PREFIX/lib/ for x86 and PREFIX/lib64/ for x86_64.
    
    As a side effect, MingW got its own targets in Makefile.shared.
    link_dso.mingw-shared and link_app.mingw-shared are aliases for the
    corresponding cygwin-shared targets.  link_shlib.mingw-shared is,
    however, a target separated from the cygwin one.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>

commit f99f91f1218d12e2e3a0fe10bb97445984a830c8
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Feb 15 22:13:41 2016 +0100

    Misc small fixes.
    
    Better libclean that removes the exact files that have been built,
    nothing more and nothing less.
    
    Corrected typo
    
    A couple of editorial changes.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>

commit 98e5534e65712641930173f85262726d6fd6496e
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Feb 15 22:12:24 2016 +0100

    Try removing installation directories after having uninstalled files
    
    Of course, if there are remaining files in a directory, it won't be removed.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>

commit 5386287cfcf0a4165fac742aa21455db3d49b3ab
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Feb 15 18:45:54 2016 +0100

    Small rename fest in unified, obj2dynlib -> obj2dso
    
    Since we're using the acronym DSO everywhere else and that's a common
    name for that kind of object, we might as well do so here as well.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>

commit c8c2b77900f9808fc644d206d8715a78dd9801bd
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Feb 15 18:39:49 2016 +0100

    Remake the installation of shared libraries in unix-Makefile.tmpl
    
    Instead of having the installation recipe rely on special knowledge,
    feed it with information, including what shared library files belong
    together.  For Cygwin and Mingw, that's the .dll and its import
    library .dll.a.  For Unixen, it's the shared library file name with SO
    version and the one without.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>

commit 9ee0ed3de66678a15db126d10b3e4226e835b8f5
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Feb 15 18:29:09 2016 +0100

    Big rename fest of engine DSO names, from libFOO.so to FOO.so
    
    The engine DSOs were named as if they were shared libraries, and could
    end up having all sorts of fancy names:
    
      Cygwin: cygFOO.dll
      Mingw:  FOOeay32.dll
      Unix:   libFOO.so / libFOO.sl / libFOO.dylib / ...
    
    This may be confusing, since they look like libraries one should link
    with at link time, when they're just DSOs.
    
    It's therefore time to rename them, and do it consistently on all
    platforms:
    
      Cygwin & Mingw: FOO.dll
      Unix:           FOO.{so,sl,dylib,...}
    
    Interestingly enough, the MSVC and VMS builds always did it this way.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>

commit 24e75727bddff81004e13dea4cb771cf63a307b7
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Feb 15 18:19:49 2016 +0100

    Simplify the generation of ld scripts for Linux and Solaris
    
    Because we know for certain that the link_shlib targets are used
    exclusively for shared libraries (libcrypto and libssl) and that they
    must have an associated .num file, we don't need to check the library
    name to produce an ld script.  Just do it unconditionally.
    
    link_shlib.linux-shared can be simplified further, as most of it is
    exactly the same as $(DO_GNU_SO) with just one variable modification.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>

commit e048fd517178d6e608b4c7f3d41799bcf5798d07
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Feb 15 18:02:52 2016 +0100

    Big rename fest in makefile.shared: link_a / link_o -> link_shlib / link_dso
    
    Originally, the Makefile.shared targets described what they used as
    input for a shared object, be it a shared library or a DSO.  It turned
    out, however, that the link_o targets were used exclusively for
    engines and the link_a targets were for libcrypto and libssl.
    
    This rename fest turns and indication on the kind of input the targets
    get to the intention with using them.
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>

commit f5c174ff9396053a2fbb73eec8b5e28d3da75797
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Feb 15 17:42:14 2016 +0100

    Centralise the shared library / dso name info in unix-Makefile.tmpl
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>

commit e987f9f271a13558213e56659fba943df1578f98
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Feb 15 17:20:15 2016 +0100

    Let Configure figure out the diverse shared library and DSO extensions
    
    Then it can pass around the information where it belongs.  The
    Makefile templates pick it up along with other target data, the
    DSO module gets to pick up the information through
    crypto/include/internal/dso_conf.h
    
    Reviewed-by: Andy Polyakov <appro at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 Configurations/10-main.conf                      |   6 +-
 Configurations/README                            |  13 +-
 Configurations/common.tmpl                       |  10 +-
 Configurations/descrip.mms.tmpl                  |   2 +-
 Configurations/unix-Makefile.tmpl                | 179 +++++++++----
 Configure                                        |  16 +-
 Makefile.in                                      | 109 ++++----
 Makefile.shared                                  | 312 +++++++++++------------
 build.info                                       |   4 +-
 crypto/dso/dso_dl.c                              |  12 +-
 crypto/dso/dso_dlfcn.c                           |  15 +-
 crypto/engine/eng_dyn.c                          |   2 +
 crypto/include/internal/{err.h => dso_conf.h.in} |  10 +-
 engines/Makefile.in                              |  35 +--
 engines/build.info                               |  26 +-
 15 files changed, 406 insertions(+), 345 deletions(-)
 copy crypto/include/internal/{err.h => dso_conf.h.in} (94%)

diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
index 4372d92..5ab71b5 100644
--- a/Configurations/10-main.conf
+++ b/Configurations/10-main.conf
@@ -1174,11 +1174,12 @@
         bn_ops           => "BN_LLONG EXPORT_VAR_AS_FN",
         perlasm_scheme   => "coff",
         dso_scheme       => "win32",
-        shared_target    => "cygwin-shared",
+        shared_target    => "mingw-shared",
         shared_cflag     => add(" ", "-D_WINDLL"),
         shared_ldflag    => "-static-libgcc",
         shared_rcflag    => "--target=pe-i386",
         shared_extension => ".dll",
+        multilib         => "",
     },
     "mingw64" => {
         # As for OPENSSL_USE_APPLINK. Applink makes it possible to use
@@ -1200,11 +1201,12 @@
         bn_ops           => "SIXTY_FOUR_BIT EXPORT_VAR_AS_FN",
         perlasm_scheme   => "mingw64",
         dso_scheme       => "win32",
-        shared_target    => "cygwin-shared",
+        shared_target    => "mingw-shared",
         shared_cflag     => add(" ", "-D_WINDLL"),
         shared_ldflag    => "-static-libgcc",
         shared_rcflag    => "--target=pe-x86-64",
         shared_extension => ".dll",
+        multilib         => "64",
     },
 
 #### UEFI
diff --git a/Configurations/README b/Configurations/README
index 4945c1c..58c4d96 100644
--- a/Configurations/README
+++ b/Configurations/README
@@ -542,16 +542,15 @@ They are all expected to return a string with the lines they produce.
                   corresponding static library as input to make the
                   shared library, or the list of object files.
 
-    obj2dynlib  - function that produces build file lines to build a
-                  dynamically loadable library file ("libfoo.so" on
-                  Unix) from object files.
+    obj2dso     - function that produces build file lines to build a
+                  dynamic shared object file from object files.
 
                   called like this:
 
-                        obj2dynlib(lib => "PATH/TO/libfile",
-                                   objs => [ "PATH/TO/objectfile", ... ],
-                                   deps => [ "PATH/TO/otherlibfile",
-                                   ... ]);
+                        obj2dso(lib => "PATH/TO/libfile",
+                                objs => [ "PATH/TO/objectfile", ... ],
+                                deps => [ "PATH/TO/otherlibfile",
+                                ... ]);
 
                   This is almost the same as libobj2shlib, but the
                   intent is to build a shareable library that can be
diff --git a/Configurations/common.tmpl b/Configurations/common.tmpl
index d7d01dc..f0860dd 100644
--- a/Configurations/common.tmpl
+++ b/Configurations/common.tmpl
@@ -70,14 +70,14 @@
  }
 
  # doengine is responsible for building engines.  It will call
- # obj2dynlib, and also makes sure all object files for the library
+ # obj2dso, and also makes sure all object files for the library
  # are built.
  sub doengine {
      my $lib = shift;
-     $OUT .= obj2dynlib(lib => $lib,
-                        objs => [ map { (my $x = $_) =~ s|\.o$||; $x }
-                                  @{$unified_info{sources}->{$lib}} ],
-                        deps => [ resolvedepends($lib) ]);
+     $OUT .= obj2dso(lib => $lib,
+                     objs => [ map { (my $x = $_) =~ s|\.o$||; $x }
+                               @{$unified_info{sources}->{$lib}} ],
+                     deps => [ resolvedepends($lib) ]);
      map { doobj($_, $lib, intent => "lib") } @{$unified_info{sources}->{$lib}};
  }
 
diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl
index ee240d1..f277bce 100644
--- a/Configurations/descrip.mms.tmpl
+++ b/Configurations/descrip.mms.tmpl
@@ -512,7 +512,7 @@ $shlib.EXE : $lib.OLB $deps $ordinalsfile
         - PURGE $shlib.EXE,$shlib.OPT,$shlib.MAP
 EOF
   }
-  sub obj2dynlib {
+  sub obj2dso {
       my %args = @_;
       my $lib = $args{lib};
       my $libd = dirname($lib);
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index d5a108e..57108ce 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -4,10 +4,50 @@
 ## {- join("\n## ", @autowarntext) -}
 {-
      sub windowsdll { $config{target} =~ /^(?:Cygwin|mingw)/ }
-     sub shlib_ext { $target{shared_extension} || ".so" }
-     sub shlib_ext_simple { (my $x = $target{shared_extension})
-                                =~ s/\.\$\(SHLIB_MAJOR\)\.\$\(SHLIB_MINOR\)//;
-                            $x }
+
+     # shlib and shlib_simple both take a static library name and figure
+     # out what the shlib name should be.
+     #
+     # When OpenSSL is configured "no-shared", these functions will just
+     # return empty lists, making them suitable to join().
+     #
+     # With Windows DLL producers, shlib($libname) will return the shared
+     # library name (which usually is different from the static library
+     # name) with the default shared extension appended to it, while
+     # shlib_simple($libname) will return the static library name with
+     # the shared extension followed by ".a" appended to it.  The former
+     # result is used as the runtime shared library while the latter is
+     # used as the DLL import library.
+     #
+     # On all Unix systems, shlib($libname) will return the library name
+     # with the default shared extension, while shlib_simple($libname)
+     # will return the name from shlib($libname) with any SO version number
+     # removed.  On some systems, they may therefore return the exact same
+     # string.
+     sub shlib {
+         return () if $config{no_shared};
+         my $lib = shift;
+         return $unified_info{sharednames}->{$lib} . '$(SHLIB_EXT)';
+     }
+     sub shlib_simple {
+         return () if $config{no_shared};
+
+         my $lib = shift;
+         if (windowsdll()) {
+             return $lib . '$(SHLIB_EXT_IMPORT)';
+         }
+         return $lib . '$(SHLIB_EXT_SIMPLE)';
+     }
+
+     # dso is a complement to shlib / shlib_simple that returns the
+     # given libname with the simple shared extension (possible SO version
+     # removed).  This differs from shlib_simple() by being unconditional.
+     sub dso {
+         return () if $config{no_shared};
+         my $engine = shift;
+
+         return $engine . '$(DSO_EXT)';
+     }
 -}
 PLATFORM={- $config{target} -}
 OPTIONS={- $config{options} -}
@@ -26,14 +66,16 @@ SHLIB_TARGET={- $target{shared_target} -}
 
 EXE_EXT={- $target{exe_extension} || "" -}
 LIB_EXT={- $target{lib_extension} || ".a" -}
-SHLIB_EXT={- shlib_ext() -}
-SHLIB_EXT_SIMPLE={- shlib_ext_simple() -}
+SHLIB_EXT={- $target{shared_extension} || ".so" -}
+SHLIB_EXT_SIMPLE={- $target{shared_extension_simple} || ".so" -}
+SHLIB_EXT_IMPORT={- $target{shared_import_extension} || "" -}
+DSO_EXT={- $target{dso_extension} || ".so" -}
 OBJ_EXT={- $target{obj_extension} || ".o" -}
 DEP_EXT={- $target{dep_extension} || ".d" -}
 
 LIBS={- join(" ", map { $_."\$(LIB_EXT)" } @{$unified_info{libraries}}) -}
-SHLIBS={- join(" ", map { $_."\$(SHLIB_EXT)" } map { $unified_info{sharednames}->{$_} || () } @{$unified_info{libraries}}) -}
-ENGINES={- join(" ", map { $_."\$(SHLIB_EXT_SIMPLE)" } @{$unified_info{engines}}) -}
+SHLIBS={- join(" ", map { shlib($_) } @{$unified_info{libraries}}) -}
+ENGINES={- join(" ", map { dso($_) } @{$unified_info{engines}}) -}
 PROGRAMS={- join(" ", map { $_."\$(EXE_EXT)" } grep { !m|^test/| } @{$unified_info{programs}}) -}
 TESTPROGS={- join(" ", map { $_."\$(EXE_EXT)" } grep { m|^test/| } @{$unified_info{programs}}) -}
 SCRIPTS={- join(" ", @{$unified_info{scripts}}) -}
@@ -46,6 +88,8 @@ MISC_SCRIPTS=$(SRCDIR)/tools/c_hash $(SRCDIR)/tools/c_info \
 	     $(SRCDIR)/tools/c_issuer $(SRCDIR)/tools/c_name \
 	     $(BLDDIR)/apps/CA.pl $(SRCDIR)/apps/tsget
 
+SHLIB_INFO={- join(" ", map { "\"".shlib($_).";".shlib_simple($_)."\"" } @{$unified_info{libraries}}) -}
+
 # DESTDIR is for package builders so that they can configure for, say,
 # /usr/ and yet have everything installed to /tmp/somedir/usr/.
 # Normally it is left empty.
@@ -128,6 +172,7 @@ AR=$(CROSS_COMPILE){- $target{ar} || "ar" -} $(ARFLAGS) r
 RANLIB= {- $target{ranlib} -}
 NM= $(CROSS_COMPILE){- $target{nm} || "nm" -}
 RM= rm -f
+RMDIR= rmdir
 TAR= {- $target{tar} || "tar" -}
 TARFLAGS= {- $target{tarflags} -}
 MAKEDEPEND=$(CROSS_COMPILE){- $config{makedepprog} -}
@@ -174,7 +219,17 @@ list-tests:
 	@TOP=$(SRCDIR) PERL=$(PERL) $(PERL) $(SRCDIR)/test/run_tests.pl list
 
 libclean:
-	-rm -f `find $(BLDDIR) -name '*$(LIB_EXT)' -o -name '*$(SHLIB_EXT)'`
+	@set -e; for s in $(SHLIB_INFO); do \
+		s1=`echo "$$s" | cut -f1 -d";"`; \
+		s2=`echo "$$s" | cut -f2 -d";"`; \
+		echo $(RM) $$s1; \
+		$(RM) $$s1; \
+		if [ "$$s1" != "$$s2" ]; then \
+			echo $(RM) $$s2; \
+			$(RM) $$s2; \
+		fi; \
+	done
+	$(RM) $(LIBS)
 
 install: install_sw install_ssldirs install_docs
 
@@ -207,7 +262,7 @@ Makefile: FORCE
 
 install_sw: all install_dev install_engines install_runtime
 
-uninstall_sw: uninstall_dev uninstall_engines uninstall_runtime
+uninstall_sw: uninstall_runtime uninstall_engines uninstall_dev
 
 install_docs: install_man_docs install_html_docs
 
@@ -240,25 +295,28 @@ install_dev:
 		      $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
 	done
 	@ : {- output_off() if $config{no_shared}; "" -}
-	@set -e; for s in $(SHLIBS); do \
-		fn=`basename $$s`; \
-		echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
-		cp $$s $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
-		chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new; \
-		mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.new \
-		      $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
-		if [ "$(SHLIB_EXT)" != "$(SHLIB_EXT_SIMPLE)" ]; then \
-			echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
-			fn2=`basename $$fn $(SHLIB_EXT)`$(SHLIB_EXT_SIMPLE); \
-			ln -sf $$fn $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
+	@set -e; for s in $(SHLIB_INFO); do \
+		s1=`echo "$$s" | cut -f1 -d";"`; \
+		s2=`echo "$$s" | cut -f2 -d";"`; \
+		fn1=`basename $$s1`; \
+		fn2=`basename $$s2`; \
+		: {- output_off() if windowsdll(); "" -}; \
+		echo "install $$s1 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
+		cp $$s1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
+		chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new; \
+		mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1.new \
+		      $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
+		if [ "$$fn1" != "$$fn2" ]; then \
+			echo "link $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
+			ln -sf $$fn1 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
 		fi; \
+		: {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
+		echo "install $$s2 -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
+		cp $$s2 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
+		chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new; \
+		mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2.new \
+		      $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
 		: {- output_off() unless windowsdll(); "" -}; \
-		echo "install $$s.a -> $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a"; \
-		cp $$s.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a.new; \
-		chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a.new; \
-		mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a.new \
-		      $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a; \
-		: {- output_on() unless windowsdll(); "" -}; \
 	done
 	@ : {- output_on() if $config{no_shared}; "" -}
 	@$(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
@@ -280,31 +338,42 @@ uninstall_dev:
 		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn"; \
 		$(RM) $(DESTDIR)$(INSTALLTOP)/include/openssl/$$fn; \
 	done
+	-$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include/openssl
+	-$(RMDIR) $(DESTDIR)$(INSTALLTOP)/include
 	@set -e; for l in $(LIBS); do \
 		fn=`basename $$l`; \
 		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
 		$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
 	done
-	@set -e; for s in $(SHLIBS); do \
-		fn=`basename $$s`; \
-		if [ "$(SHLIB_EXT)" != "$(SHLIB_EXT_SIMPLE)" ]; then \
-			fn2=`basename $$fn $(SHLIB_EXT)`$(SHLIB_EXT_SIMPLE); \
+	@ : {- output_off() if $config{no_shared}; "" -}
+	@set -e; for s in $(SHLIB_INFO); do \
+		s1=`echo "$$s" | cut -f1 -d";"`; \
+		s2=`echo "$$s" | cut -f2 -d";"`; \
+		fn1=`basename $$s1`; \
+		fn2=`basename $$s2`; \
+		: {- output_off() if windowsdll(); "" -}; \
+		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1"; \
+		$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn1; \
+		if [ "$$fn1" != "$$fn2" ]; then \
 			echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
 			$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
 		fi; \
-		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn"; \
-		$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn; \
+		: {- output_on() if windowsdll(); "" -}{- output_off() unless windowsdll(); "" -}; \
+		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2"; \
+		$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn2; \
 		: {- output_off() unless windowsdll(); "" -}; \
-		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a"; \
-		$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$fn.a; \
-		: {- output_on() unless windowsdll(); "" -}; \
 	done
+	@ : {- output_on() if $config{no_shared}; "" -}
 	@echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc"
 	@$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libcrypto.pc
 	@echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc"
 	@$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/libssl.pc
 	@echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc"
 	@$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig/openssl.pc
+	@echo $(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
+	-@$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/pkgconfig
+	@echo $(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
+	-@$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)
 
 install_engines:
 	@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
@@ -332,6 +401,8 @@ uninstall_engines:
 		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn"; \
 		$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$fn; \
 	done
+	@echo "$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines"
+	-@$(RMDIR) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines
 
 install_runtime:
 	@[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
@@ -340,7 +411,7 @@ install_runtime:
 	@echo "*** Installing runtime files"
 	: {- output_off() unless windowsdll(); "" -};
 	@set -e; for s in $(SHLIBS); do \
-		fn=`basename $$i`; \
+		fn=`basename $$s`; \
 		echo "install $$s -> $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
 		cp $$s $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
 		chmod 644 $(DESTDIR)$(INSTALLTOP)/bin/$$fn.new; \
@@ -399,12 +470,16 @@ uninstall_runtime:
 	done
 	: {- output_off() unless windowsdll(); "" -};
 	@set -e; for s in $(SHLIBS); do \
-		fn=`basename $$i`; \
+		fn=`basename $$s`; \
 		echo "$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn"; \
 		$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$fn; \
 	done
 	: {- output_on() unless windowsdll(); "" -};
 	$(RM) $(DESTDIR)$(OPENSSLDIR)/openssl.cnf
+	@echo "$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin"
+	-@$(RMDIR) $(DESTDIR)$(INSTALLTOP)/bin
+	@echo "$(RMDIR) $(DESTDIR)$(OPENSSLDIR)/misc"
+	-@$(RMDIR) $(DESTDIR)$(OPENSSLDIR)/misc
 
 # A method to extract all names from a .pod file
 # The first sed extracts everything between "=head1 NAME" and the next =head1
@@ -738,13 +813,7 @@ configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configure $(SRCDIR)/
       # Depending on shared libraries:
       # On Windows POSIX layers, we depend on {libname}.dll.a
       # On Unix platforms, we depend on {shlibname}.so
-      return map { if (windowsdll()) {
-                       "$_\$(SHLIB_EXT_SIMPLE).a"
-		   } else {
-		       my $libname =
-		           $unified_info{sharednames}->{$_} || $_;
-		       "$libname\$(SHLIB_EXT_SIMPLE)"
-		   } } @_;
+      return map { shlib_simple($_) } @_;
   }
 
   sub src2obj {
@@ -790,17 +859,16 @@ EOF
       my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
       my $shlib_target = $target{shared_target};
       my $ordinalsfile = defined($args{ordinals}) ? $args{ordinals}->[1] : "";
-      my $shlibtarget = windowsdll() ?
-	  "$lib\$(SHLIB_EXT_SIMPLE).a" : "$shlib\$(SHLIB_EXT_SIMPLE)";
+      my $target = shlib_simple($lib);
       return <<"EOF"
 # With a build on a Windows POSIX layer (Cygwin or Mingw), we know for a fact
 # that two files get produced, {shlibname}.dll and {libname}.dll.a.
 # With all other Unix platforms, we often build a shared library with the
 # SO version built into the file name and a symlink without the SO version
 # It's not necessary to have both as targets.  The choice falls on the
-# simplest, {libname}\$(SHLIB_EXT_SIMPLE).a for Windows POSIX layers and
+# simplest, {libname}\$(SHLIB_EXT_IMPORT) for Windows POSIX layers and
 # {libname}\$(SHLIB_EXT_SIMPLE) for the Unix platforms.
-$shlibtarget: $lib\$(LIB_EXT) $deps $ordinalsfile
+$target : $lib\$(LIB_EXT) $deps $ordinalsfile
 	\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
 		PLATFORM=\$(PLATFORM) \\
 		PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\
@@ -812,7 +880,7 @@ $shlibtarget: $lib\$(LIB_EXT) $deps $ordinalsfile
 		CROSS_COMPILE="\$(CROSS_COMPILE)" \\
 		SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" SHLIB_EXT=\$(SHLIB_EXT) \\
 		SHARED_RCFLAGS="\$(SHARED_RCFLAGS)" \\
-		link_a.$shlib_target
+		link_shlib.$shlib_target
 EOF
 	  . (windowsdll() ? <<"EOF" : "");
 	rm -f apps/$shlib\$(SHLIB_EXT)
@@ -821,7 +889,7 @@ EOF
 	cp -p $shlib\$(SHLIB_EXT) test/
 EOF
   }
-  sub obj2dynlib {
+  sub obj2dso {
       my %args = @_;
       my $lib = $args{lib};
       my $libd = dirname($lib);
@@ -834,8 +902,9 @@ EOF
       my $deps = join(" ",compute_lib_depends(@{$args{deps}}));
       my $shlib_target = $target{shared_target};
       my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}});
+      my $target = dso($lib);
       return <<"EOF";
-$lib\$(SHLIB_EXT_SIMPLE): $objs $deps
+$target: $objs $deps
 	\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
 		PLATFORM=\$(PLATFORM) \\
 		PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\
@@ -843,9 +912,9 @@ $lib\$(SHLIB_EXT_SIMPLE): $objs $deps
 		LIBNAME=$libname LDFLAGS="\$(LDFLAGS)" \\
 		CC="\$(CC)" CFLAGS="\$(CFLAGS)" \\
 		SHARED_LDFLAGS="\$(SHARED_LDFLAGS)" \\
-		SHLIB_EXT=\$(SHLIB_EXT_SIMPLE) \\
+		SHLIB_EXT=\$(DSO_EXT) \\
 		LIBEXTRAS="$objs" \\
-		link_o.$shlib_target
+		link_dso.$shlib_target
 EOF
   }
   sub obj2lib {
@@ -876,7 +945,7 @@ $bin\$(EXE_EXT): $objs $deps
 	\$(RM) $bin\$(EXE_EXT)
 	\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
 		PERL=\$(PERL) SRCDIR=\$(SRCDIR) \\
-		APPNAME=$bin OBJECTS="$objs" \\
+		APPNAME=$bin\$(EXE_EXT) OBJECTS="$objs" \\
 		LIBDEPS="\$(PLIB_LDFLAGS) $linklibs \$(EX_LIBS)" \\
 		CC="\$(CC)" CFLAGS="\$(CFLAGS)" LDFLAGS="\$(LDFLAGS)" \\
 		LIBRPATH="\$(INSTALLTOP)/\$(LIBDIR)" \\
diff --git a/Configure b/Configure
index 8fb2969..4136673 100755
--- a/Configure
+++ b/Configure
@@ -406,7 +406,8 @@ while ((my $first, my $second) = (shift @list, shift @list)) {
 
 my @generated_headers = (
     "include/openssl/opensslconf.h",
-    "crypto/include/internal/bn_conf.h"
+    "crypto/include/internal/bn_conf.h",
+    "crypto/include/internal/dso_conf.h"
     );
 
 my @generated_by_make_headers = (
@@ -809,10 +810,18 @@ my %target = ( %{$table{$base_target}}, resolve_config($target) );
 &usage if (!%target || $target{template});
 
 $target{exe_extension}="";
-$target{exe_extension}=".exe" if ($config{target} eq "Cygwin" || $config{target} eq "DJGPP" || $config{target} =~ /^mingw/);
+$target{exe_extension}=".exe" if ($config{target} eq "DJGPP"
+                                  || $config{target} =~ /^(?:Cygwin|mingw)/);
 $target{exe_extension}=".nlm" if ($config{target} =~ /netware/);
 $target{exe_extension}=".pm"  if ($config{target} =~ /vos/);
 
+($target{shared_extension_simple}=$target{shared_extension})
+    =~ s|\.\$\(SHLIB_MAJOR\)\.\$\(SHLIB_MINOR\)||;
+$target{dso_extension}=$target{shared_extension_simple};
+($target{shared_import_extension}=$target{shared_extension_simple}.".a")
+    if ($config{target} =~ /^(?:Cygwin|mingw)/);
+
+
 $default_ranlib	= which("ranlib") || "true";
 $config{perl}	= $ENV{'PERL'} || which("perl5") || which("perl") || "perl";
 my $make	= $ENV{'MAKE'} || "make";
@@ -2167,6 +2176,9 @@ sub print_table_entry
 	"shared_ldflag",
 	"shared_rcflag",
 	"shared_extension",
+	"shared_extension_simple",
+	"shared_import_extension",
+	"dso_extension",
 	"obj_extension",
 	"exe_extension",
 	"ranlib",
diff --git a/Makefile.in b/Makefile.in
index 9912d88..a7cd757 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -10,7 +10,10 @@ SHLIB_VERSION_NUMBER={- $config{shlib_version_number} -}
 SHLIB_VERSION_HISTORY={- $config{shlib_version_history} -}
 SHLIB_MAJOR={- $config{shlib_major} -}
 SHLIB_MINOR={- $config{shlib_minor} -}
-SHLIB_EXT={- $target{shared_extension} -}
+SHLIB_EXT={- $target{shared_extension} || ".so" -}
+SHLIB_EXT_SIMPLE={- $target{shared_extension_simple} || ".so" -}
+SHLIB_EXT_IMPORT={- $target{shared_import_extension} || "" -}
+DSO_EXT={- $target{dso_extension} || ".so" -}
 PLATFORM={- $config{target} -}
 OPTIONS={- $config{options} -}
 CONFIGURE_ARGS=({- join(", ",quotify_l(@{$config{perlargv}})) -})
@@ -90,7 +93,7 @@ ENGINESDIR={- use File::Spec::Functions;
 
 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
 CC= $(CROSS_COMPILE){- $target{cc} -}
-CFLAG={- our $cflags2 = join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -}
+CFLAG={- our $cflags2 = join(" ",(map { "-D".$_} @{$config{defines}},"OPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","ENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"")) -} {- $config{cflags} -}
 CFLAG_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
 LDFLAG= {- $config{lflags} -}
 PLIB_LDFLAG= {- $config{plib_lflags} -}
@@ -258,7 +261,8 @@ BUILDENV=	LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
 		SHARED_RCFLAG='$(SHARED_RCFLAG)'		\
 		ZLIB_INCLUDE='$(ZLIB_INCLUDE)' LIBZLIB='$(LIBZLIB)'	\
 		EXE_EXT='$(EXE_EXT)' SHARED_LIBS='$(SHARED_LIBS)'	\
-		SHLIB_EXT='$(SHLIB_EXT)' SHLIB_TARGET='$(SHLIB_TARGET)'	\
+		SHLIB_EXT='$(SHLIB_EXT)' DSO_EXT='$(DSO_EXT)'	\
+		SHLIB_TARGET='$(SHLIB_TARGET)'	\
 		LDFLAG='$(LDFLAG)'				\
 		PLIB_LDFLAG='$(PLIB_LDFLAG)' EX_LIBS='$(EX_LIBS)'	\
 		APPS_OBJ='$(APPS_OBJ)'				\
@@ -374,7 +378,7 @@ do_$(SHLIB_TARGET):
 			LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
 			LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
 			LIBDEPS="$$libs $(EX_LIBS)" \
-			link_a.$(SHLIB_TARGET); \
+			link_shlib.$(SHLIB_TARGET); \
 		libs="-l$$i $$libs"; \
 		case "$(PLATFORM)" in \
 		Cygwin*) \
@@ -384,14 +388,15 @@ do_$(SHLIB_TARGET):
 			cp cyg$$i-$(SHLIB_MAJOR).$(SHLIB_MINOR).dll test/; \
 			;; \
 		mingw*) \
-			case $$i in \
-				crypto) i=libeay32;; \
-				ssl) i=ssleay32;; \
-			esac; \
-			rm -f apps/$$i.dll; \
-			rm -f test/$$i.dll; \
-			cp $$i.dll apps/; \
-			cp $$i.dll test/; \
+			arch=; \
+		        if expr $(PLATFORM) : mingw64 > /dev/null; then \
+				arch=-x64; \
+			fi; \
+			rm -f apps/lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll; \
+			rm -f test/lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll; \
+			cp lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll apps/; \
+			cp lib$$i-$(SHLIB_MAJOR)_$(SHLIB_MINOR)$$arch.dll test/; \
+			;; \
 		esac; \
 	done
 
@@ -585,30 +590,40 @@ install_sw:
 		for i in $${tmp:-x}; \
 		do \
 			if [ -f "$$i" -o -f "$$i.a" ]; then \
-			(       echo installing $$i; \
-				if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
-					c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
+				case "$(PLATFORM)" in \
+				Cygwin*) \
+					c=`echo $$i | sed 's/^lib\(.*\)\.dll/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
+					echo installing $$c; \
 					cp $$c $(DESTDIR)$(INSTALLTOP)/bin/$$c.new; \
 					chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$c.new; \
 					mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$c.new $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
-					cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
-					chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
-					mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
-				else \
+					echo installing $$i.a; \
+					cp $$i.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
+					chmod 644 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
+					mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
+					;; \
+				mingw*) \
+					arch=; \
+				        if expr $(PLATFORM) : mingw64 > /dev/null; then \
+						arch=-x64; \
+					fi; \
+					m=`echo $$i | sed -e 's/\.dll$$/-$(SHLIB_MAJOR)_$(SHLIB_MINOR)'"$$arch"'.dll/'`; \
+					echo installing $$m; \
+					cp $$m $(DESTDIR)$(INSTALLTOP)/bin/$$m.new; \
+					chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$m.new; \
+					mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$m.new $(DESTDIR)$(INSTALLTOP)/bin/$$m; \
+					echo installing $$i.a; \
+					cp $$i.a $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
+					chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new; \
+					mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
+					;; \
+			        *) \
+					echo installing $$i; \
 					cp $$i $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
 					chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new; \
 					mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
-				fi ); \
-				if expr $(PLATFORM) : 'mingw' > /dev/null; then \
-				(	case $$i in \
-						*crypto*) i=libeay32.dll;; \
-						*ssl*)    i=ssleay32.dll;; \
-					esac; \
-					echo installing $$i; \
-					cp $$i $(DESTDIR)$(INSTALLTOP)/bin/$$i.new; \
-					chmod 755 $(DESTDIR)$(INSTALLTOP)/bin/$$i.new; \
-					mv -f $(DESTDIR)$(INSTALLTOP)/bin/$$i.new $(DESTDIR)$(INSTALLTOP)/bin/$$i ); \
-				fi; \
+					;; \
+				esac; \
 			fi; \
 		done; \
 		(	here="`pwd`"; \
@@ -639,24 +654,30 @@ uninstall_sw:
 		for i in $${tmp:-x}; \
 		do \
 			if [ -f "$$i" -o -f "$$i.a" ]; then \
-				if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
-					c=`echo $$i | sed 's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
+				case "$(PLATFORM)" in \
+				Cygwin*) \
+					c=`echo $$i | sed 's/^lib\(.*\)\.dll/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
 					echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
 					$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$c; \
+					echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
+					$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
+					;; \
+				mingw*) \
+					arch=; \
+				        if expr $(PLATFORM) : mingw64 > /dev/null; then \
+						arch=-x64; \
+					fi; \
+					m=`echo $$i | sed -e 's/\.dll$$/-$(SHLIB_MAJOR)_$(SHLIB_MINOR)'"$$arch"'.dll/'`; \
+					echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$m; \
+					$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$m; \
+					echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
+					$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i.a; \
+					;; \
+				*) \
 					echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
 					$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
-				else \
-					echo $(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
-					$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/$$i; \
-				fi; \
-				if expr $(PLATFORM) : 'mingw' > /dev/null; then \
-					case $$i in \
-						*crypto*) i=libeay32.dll;; \
-						*ssl*)    i=ssleay32.dll;; \
-					esac; \
-					echo $(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$i; \
-					$(RM) $(DESTDIR)$(INSTALLTOP)/bin/$$i; \
-				fi; \
+					;; \
+				esac; \
 			fi; \
 		done; \
 	fi
diff --git a/Makefile.shared b/Makefile.shared
index 90290d1..57e1936 100644
--- a/Makefile.shared
+++ b/Makefile.shared
@@ -50,8 +50,8 @@ OBJECTS=
 # For example, if a second library, say libbar.a needs to be linked into
 # libfoo.so, you need to do the following:
 #LIBEXTRAS=libbar.a
-# Note that this MUST be used when using the link_o targets, to hold the
-# names of all object files that go into the target library.
+# Note that this MUST be used when using the link_dso targets, to hold the
+# names of all object files that go into the target shared object.
 LIBEXTRAS=
 
 # LIBVERSION contains the current version of the library.
@@ -143,17 +143,17 @@ SYMLINK_SO=	\
 		fi; \
 	fi
 
-LINK_SO_A=	SHOBJECTS="$(DSTDIR)/lib$(LIBNAME).a $(LIBEXTRAS)"; $(LINK_SO)
-LINK_SO_O=	SHOBJECTS="$(LIBEXTRAS)"; $(LINK_SO)
+LINK_SO_SHLIB=	SHOBJECTS="$(DSTDIR)/lib$(LIBNAME).a $(LIBEXTRAS)"; $(LINK_SO)
+LINK_SO_DSO=	INHIBIT_SYMLINKS=yes; SHOBJECTS="$(LIBEXTRAS)"; $(LINK_SO)
 
-LINK_SO_A_VIA_O=	\
+LINK_SO_SHLIB_VIA_O=	\
   SHOBJECTS=$(DSTDIR)/lib$(LIBNAME).o; \
   ALL=$$ALLSYMSFLAGS; ALLSYMSFLAGS=; NOALLSYMSFLAGS=; \
   ( echo ld $(LDFLAGS) -r -o $$SHOBJECTS.o $$ALL lib$(LIBNAME).a $(LIBEXTRAS); \
     ld $(LDFLAGS) -r -o $$SHOBJECTS.o $$ALL $(DSTDIR)/lib$(LIBNAME).a $(LIBEXTRAS) ); \
   $(LINK_SO) && ( echo rm -f $$SHOBJECTS; rm -f $$SHOBJECTS )
 
-LINK_SO_A_UNPACKED=	\
+LINK_SO_SHLIB_UNPACKED=	\
   UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
   (cd $$UNPACKDIR; ar x ../$(DSTDIR)/lib$(LIBNAME).a) && \
   ([ -z "$(LIBEXTRAS)" ] || cp $(LIBEXTRAS) $$UNPACKDIR) && \
@@ -162,13 +162,13 @@ LINK_SO_A_UNPACKED=	\
 
 DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
 
-DO_GNU_SO=$(CALC_VERSIONS); \
-	SHLIB=lib$(LIBNAME).so; \
+DO_GNU_SO_NOCALC=\
+	SHLIB=$(LIBNAME).so; \
 	SHLIB_SUFFIX=; \
 	ALLSYMSFLAGS='-Wl,--whole-archive'; \
 	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
 	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"
-
+DO_GNU_SO=$(CALC_VERSIONS); $(DO_GNU_SO_NOCALC); SHLIB=lib$$SHLIB
 DO_GNU_APP=LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBRPATH)"
 
 #This is rather special.  It's a special target with which one can link
@@ -179,35 +179,29 @@ DO_GNU_APP=LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBRPATH)"
 link_app.:
 	$(LINK_APP)
 
-link_o.gnu:
-	@ $(DO_GNU_SO); $(LINK_SO_O)
-link_a.gnu:
-	@ $(DO_GNU_SO); $(LINK_SO_A)
+link_dso.gnu:
+	@ $(DO_GNU_SO_NOCALC); $(LINK_SO_DSO)
+link_shlib.gnu:
+	@ $(DO_GNU_SO); $(LINK_SO_SHLIB)
 link_app.gnu:
 	@ $(DO_GNU_APP); $(LINK_APP)
 
-link_a.linux-shared:
-	@if [ $(LIBNAME) != "crypto" -a $(LIBNAME) != "ssl" ]; then $(DO_GNU_SO); else \
-	$(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \
-	$(CALC_VERSIONS); \
-	SHLIB=lib$(LIBNAME).so; \
-	SHLIB_SUFFIX=; \
+link_shlib.linux-shared:
+	@$(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \
+	$(DO_GNU_SO); \
 	ALLSYMSFLAGS='-Wl,--whole-archive,--version-script=$(LIBNAME).map'; \
-	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
-	fi; $(LINK_SO_A)
+	$(LINK_SO_SHLIB)
 
-link_o.bsd:
-	@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
-	$(CALC_VERSIONS); \
-	SHLIB=lib$(LIBNAME).so; \
+link_dso.bsd:
+	@if $(DETECT_GNU_LD); then $(DO_GNU_SO_NOCALC); else \
+	SHLIB=$(LIBNAME).so; \
 	SHLIB_SUFFIX=; \
 	LIBDEPS=" "; \
 	ALLSYMSFLAGS="-Wl,-Bforcearchive"; \
 	NOALLSYMSFLAGS=; \
 	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
-	fi; $(LINK_SO_O)
-link_a.bsd:
+	fi; $(LINK_SO_DSO)
+link_shlib.bsd:
 	@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
 	$(CALC_VERSIONS); \
 	SHLIB=lib$(LIBNAME).so; \
@@ -216,17 +210,17 @@ link_a.bsd:
 	ALLSYMSFLAGS="-Wl,-Bforcearchive"; \
 	NOALLSYMSFLAGS=; \
 	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -nostdlib"; \
-	fi; $(LINK_SO_A)
+	fi; $(LINK_SO_SHLIB)
 link_app.bsd:
 	@if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
 	LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBPATH)"; \
 	fi; $(LINK_APP)
 
 # For Darwin AKA Mac OS/X (dyld)
-# Originally link_o.darwin produced .so, because it was hard-coded
+# Originally link_dso.darwin produced .so, because it was hard-coded
 # in dso_dlfcn module. At later point dso_dlfcn switched to .dylib
 # extension in order to allow for run-time linking with vendor-
-# supplied shared libraries such as libz, so that link_o.darwin had
+# supplied shared libraries such as libz, so that link_dso.darwin had
 # to be harmonized with it. This caused minor controversy, because
 # it was believed that dlopen can't be used to dynamically load
 # .dylib-s, only so called bundle modules (ones linked with -bundle
@@ -239,21 +233,14 @@ link_app.bsd:
 # It works, because dlopen is [and always was] extension-agnostic.
 # Alternative to this heuristic approach is to develop specific
 # MacOS X dso module relying on whichever "native" dyld interface.
-link_o.darwin:
-	@ $(CALC_VERSIONS); \
-	SHLIB=lib$(LIBNAME); \
+link_dso.darwin:
+	@ SHLIB=$(LIBNAME); \
 	SHLIB_SUFFIX=.dylib; \
 	ALLSYMSFLAGS='-all_load'; \
 	NOALLSYMSFLAGS=''; \
 	SHAREDFLAGS="$(CFLAGS) `echo $(SHARED_LDFLAGS) | sed s/dynamiclib/bundle/`"; \
-	if [ -n "$(LIBVERSION)" ]; then \
-		SHAREDFLAGS="$$SHAREDFLAGS -current_version $(LIBVERSION)"; \
-	fi; \
-	if [ -n "$$SHLIB_SOVER_NODOT" ]; then \
-		SHAREDFLAGS="$$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
-	fi; \
-	$(LINK_SO_O)
-link_a.darwin:
+	$(LINK_SO_DSO)
+link_shlib.darwin:
 	@ $(CALC_VERSIONS); \
 	SHLIB=lib$(LIBNAME); \
 	SHLIB_SUFFIX=.dylib; \
@@ -267,82 +254,73 @@ link_a.darwin:
 		SHAREDFLAGS="$$SHAREDFLAGS -compatibility_version $$SHLIB_SOVER_NODOT"; \
 	fi; \
 	SHAREDFLAGS="$$SHAREDFLAGS -install_name $(INSTALLTOP)/$(LIBDIR)/$$SHLIB$(SHLIB_EXT)"; \
-	$(LINK_SO_A)
+	$(LINK_SO_SHLIB)
 link_app.darwin:	# is there run-path on darwin?
 	$(LINK_APP)
 
-link_o.cygwin:
-	@ $(CALC_VERSIONS); \
-	INHIBIT_SYMLINKS=yes; \
-	SHLIB=cyg$(LIBNAME); \
-	base=-Wl,--enable-auto-image-base; \
-	deffile=; \
-	if expr $(PLATFORM) : 'mingw' > /dev/null; then \
-		SHLIB=$(LIBNAME)eay32; base=; \
-		if test -f $(LIBNAME)eay32.def; then \
-			deffile=$(LIBNAME)eay32.def; \
-		fi; \
-	fi; \
+link_dso.cygwin:
+	@SHLIB=$(LIBNAME); \
 	SHLIB_SUFFIX=.dll; \
-	LIBVERSION="$(LIBVERSION)"; \
-	SHLIB_SOVER=${LIBVERSION:+"-$(LIBVERSION)"}; \
 	ALLSYMSFLAGS='-Wl,--whole-archive'; \
 	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base $$deffile -Wl,-Bsymbolic"; \
-	$(LINK_SO_O)
-#for mingw target if def-file is in use dll-name should match library-name
-link_a.cygwin:
+	base=-Wl,--enable-auto-image-base; \
+	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic"; \
+	$(LINK_SO_DSO)
+link_shlib.cygwin:
 	@ $(CALC_VERSIONS); \
 	INHIBIT_SYMLINKS=yes; \
 	SHLIB=cyg$(LIBNAME); SHLIB_SOVER=-$(LIBVERSION); SHLIB_SUFFIX=.dll; \
-	dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; extras=; \
-	base=-Wl,--enable-auto-image-base; \
-	if expr $(PLATFORM) : 'mingw' > /dev/null; then \
-		case $(LIBNAME) in \
-			crypto) SHLIB=libeay;; \
-			ssl) SHLIB=ssleay;; \
-		esac; \
-		SHLIB_SOVER=32; \
-		extras="$(LIBNAME).def"; \
-		$(PERL) $(SRCDIR)/util/mkdef.pl 32 $$SHLIB > $$extras; \
-		base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
-	fi; \
 	dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
 	echo "$(PERL) $(SRCDIR)/util/mkrc.pl $$dll_name |" \
 		     "$(CROSS_COMPILE)windres $(SHARED_RCFLAGS) -o rc.o"; \
 	$(PERL) $(SRCDIR)/util/mkrc.pl $$dll_name | \
 		$(CROSS_COMPILE)windres $(SHARED_RCFLAGS) -o rc.o; \
-	extras="$$extras rc.o"; \
 	ALLSYMSFLAGS='-Wl,--whole-archive'; \
 	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a $$extras"; \
-	$(LINK_SO_A) || exit 1; \
-	rm $$extras
+	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,--enable-auto-image-base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a rc.o"; \
+	$(LINK_SO_SHLIB) || exit 1; \
+	rm rc.o
 link_app.cygwin:
 	$(LINK_APP)
 
-link_o.alpha-osf1:
+# link_dso.mingw-shared and link_app.mingw-shared are mapped to the
+# corresponding cygwin targets, as they do the exact same thing.
+link_shlib.mingw:
+	@ $(CALC_VERSIONS); \
+	INHIBIT_SYMLINKS=yes; \
+	arch=; \
+	if expr $(PLATFORM) : mingw64 > /dev/null; then arch=-x64; fi; \
+	sover=`echo $(LIBVERSION) | sed -e 's/\./_/g'` ; \
+	SHLIB=lib$(LIBNAME); \
+	SHLIB_SOVER=-$$sover$$arch; \
+	SHLIB_SUFFIX=.dll; \
+	dll_name=$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX; \
+	base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
+	$(PERL) $(SRCDIR)/util/mkdef.pl 32 $(LIBNAME) \
+		| sed -e 's|^\(LIBRARY  *\)$(LIBNAME)32|\1'"$$dll_name"'|' \
+		> $(LIBNAME).def; \
+	echo "$(PERL) $(SRCDIR)/util/mkrc.pl $$dll_name |" \
+		"$(CROSS_COMPILE)windres $(SHARED_RCFLAGS) -o rc.o"; \
+	$(PERL) $(SRCDIR)/util/mkrc.pl $$dll_name | \
+		$(CROSS_COMPILE)windres $(SHARED_RCFLAGS) -o rc.o; \
+	ALLSYMSFLAGS='-Wl,--whole-archive'; \
+	NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
+	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a $(LIBNAME).def rc.o"; \
+	$(LINK_SO_SHLIB) || exit 1; \
+	rm $(LIBNAME).def rc.o
+
+link_dso.alpha-osf1:
 	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_SO); \
+		$(DO_GNU_SO_NOCALC); \
 	else \
-		SHLIB=lib$(LIBNAME).so; \
+		SHLIB=$(LIBNAME).so; \
 		SHLIB_SUFFIX=; \
-		SHLIB_HIST=`echo "$(LIBCOMPATVERSIONS)" | cut -d';' -f2 | sed -e 's/ */:/'`; \
-		if [ -n "$$SHLIB_HIST" ]; then \
-			SHLIB_HIST="$${SHLIB_HIST}:$(LIBVERSION)"; \
-		else \
-			SHLIB_HIST="$(LIBVERSION)"; \
-		fi; \
-		SHLIB_SOVER=; \
 		ALLSYMSFLAGS='-all'; \
 		NOALLSYMSFLAGS='-none'; \
 		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-B,symbolic"; \
-		if [ -n "$$SHLIB_HIST" ]; then \
-			SHAREDFLAGS="$$SHAREDFLAGS -set_version $$SHLIB_HIST"; \
-		fi; \
 	fi; \
-	$(LINK_SO_O)
-link_a.alpha-osf1:
+	$(LINK_SO_DSO)
+link_shlib.alpha-osf1:
 	@ if $(DETECT_GNU_LD); then \
 		$(DO_GNU_SO); \
 	else \
@@ -362,7 +340,7 @@ link_a.alpha-osf1:
 			SHAREDFLAGS="$$SHAREDFLAGS -set_version $$SHLIB_HIST"; \
 		fi; \
 	fi; \
-	$(LINK_SO_A)
+	$(LINK_SO_SHLIB)
 link_app.alpha-osf1:
 	@if $(DETECT_GNU_LD); then \
 		$(DO_GNU_APP); \
@@ -371,9 +349,9 @@ link_app.alpha-osf1:
 	fi; \
 	$(LINK_APP)
 
-link_o.solaris:
+link_dso.solaris:
 	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_SO); \
+		$(DO_GNU_SO_NOCALC); \
 	else \
 		$(CALC_VERSIONS); \
 		SHLIB=lib$(LIBNAME).so; \
@@ -382,24 +360,20 @@ link_o.solaris:
 		NOALLSYMSFLAGS="-Wl,-z,defaultextract"; \
 		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -Wl,-Bsymbolic"; \
 	fi; \
-	$(LINK_SO_O)
-link_a.solaris:
+	$(LINK_SO_DSO)
+link_shlib.solaris:
 	@ if $(DETECT_GNU_LD); then \
 		$(DO_GNU_SO); \
 	else \
 		$(CALC_VERSIONS); \
 		SHLIB=lib$(LIBNAME).so; \
 		SHLIB_SUFFIX=;\
-		if [ $(LIBNAME) != "crypto" -a $(LIBNAME) != "ssl" ]; then \
-			ALLSYMSFLAGS="-Wl,-z,allextract"; \
-		else \
-			$(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \
-			ALLSYMSFLAGS="-Wl,-z,allextract,-M,$(LIBNAME).map"; \
-		fi; \
+		$(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \
+		ALLSYMSFLAGS="-Wl,-z,allextract,-M,$(LIBNAME).map"; \
 		NOALLSYMSFLAGS="-Wl,-z,defaultextract"; \
 		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX -Wl,-Bsymbolic"; \
 	fi; \
-	$(LINK_SO_A)
+	$(LINK_SO_SHLIB)
 link_app.solaris:
 	@ if $(DETECT_GNU_LD); then \
 		$(DO_GNU_APP); \
@@ -409,19 +383,19 @@ link_app.solaris:
 	$(LINK_APP)
 
 # OpenServer 5 native compilers used
-link_o.svr3:
+link_dso.svr3:
 	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_SO); \
+		$(DO_GNU_SO_NOCALC); \
 	else \
 		$(CALC_VERSIONS); \
-		SHLIB=lib$(LIBNAME).so; \
+		SHLIB=$(LIBNAME).so; \
 		SHLIB_SUFFIX=; \
 		ALLSYMSFLAGS=''; \
 		NOALLSYMSFLAGS=''; \
-		SHAREDFLAGS="$(CFLAGS) -G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
+		SHAREDFLAGS="$(CFLAGS) -G -h $$SHLIB$$SHLIB_SUFFIX"; \
 	fi; \
-	$(LINK_SO_O)
-link_a.svr3:
+	$(LINK_SO_DSO)
+link_shlib.svr3:
 	@ if $(DETECT_GNU_LD); then \
 		$(DO_GNU_SO); \
 	else \
@@ -432,27 +406,26 @@ link_a.svr3:
 		NOALLSYMSFLAGS=''; \
 		SHAREDFLAGS="$(CFLAGS) -G -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
 	fi; \
-	$(LINK_SO_A_UNPACKED)
+	$(LINK_SO_SHLIB_UNPACKED)
 link_app.svr3:
 	@$(DETECT_GNU_LD) && $(DO_GNU_APP); \
 	$(LINK_APP)
 
 # UnixWare 7 and OpenUNIX 8 native compilers used
-link_o.svr5:
+link_dso.svr5:
 	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_SO); \
+		$(DO_GNU_SO_NOCALC); \
 	else \
-		$(CALC_VERSIONS); \
 		SHARE_FLAG='-G'; \
 		($(CC) -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
-		SHLIB=lib$(LIBNAME).so; \
+		SHLIB=$(LIBNAME).so; \
 		SHLIB_SUFFIX=; \
 		ALLSYMSFLAGS=''; \
 		NOALLSYMSFLAGS=''; \
-		SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
+		SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $$SHLIB$$SHLIB_SUFFIX"; \
 	fi; \
-	$(LINK_SO_O)
-link_a.svr5:
+	$(LINK_SO_DSO)
+link_shlib.svr5:
 	@ if $(DETECT_GNU_LD); then \
 		$(DO_GNU_SO); \
 	else \
@@ -465,26 +438,25 @@ link_a.svr5:
 		NOALLSYMSFLAGS=''; \
 		SHAREDFLAGS="$(CFLAGS) $${SHARE_FLAG} -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
 	fi; \
-	$(LINK_SO_A_UNPACKED)
+	$(LINK_SO_SHLIB_UNPACKED)
 link_app.svr5:
 	@$(DETECT_GNU_LD) && $(DO_GNU_APP); \
 	$(LINK_APP)
 
-link_o.irix:
+link_dso.irix:
 	@ if $(DETECT_GNU_LD); then \
-		$(DO_GNU_SO); \
+		$(DO_GNU_SO_NOCALC); \
 	else \
-		$(CALC_VERSIONS); \
-		SHLIB=lib$(LIBNAME).so; \
+		SHLIB=$(LIBNAME).so; \
 		SHLIB_SUFFIX=; \
 		MINUSWL=""; \
 		($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL="-Wl,"; \
 		ALLSYMSFLAGS="$${MINUSWL}-all"; \
 		NOALLSYMSFLAGS="$${MINUSWL}-none"; \
-		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,-B,symbolic"; \
+		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$$SHLIB$$SHLIB_SUFFIX,-B,symbolic"; \
 	fi; \
-	$(LINK_SO_O)
-link_a.irix:
+	$(LINK_SO_DSO)
+link_shlib.irix:
 	@ if $(DETECT_GNU_LD); then \
 		$(DO_GNU_SO); \
 	else \
@@ -497,7 +469,7 @@ link_a.irix:
 		NOALLSYMSFLAGS="$${MINUSWL}-none"; \
 		SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,-B,symbolic"; \
 	fi; \
-	$(LINK_SO_A)
+	$(LINK_SO_SHLIB)
 link_app.irix:
 	@LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-rpath,$(LIBRPATH)"; \
 	$(LINK_APP)
@@ -510,20 +482,19 @@ link_app.irix:
 # editor context only [it's simply ignored in other cases, which are all
 # ELFs by the way].
 #
-link_o.hpux:
-	@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
-	$(CALC_VERSIONS); \
-	SHLIB=lib$(LIBNAME).sl; \
+link_dso.hpux:
+	@if $(DETECT_GNU_LD); then $(DO_GNU_SO_NOCALC); else \
+	SHLIB=$(LIBNAME).sl; \
 	expr "$(CFLAGS)" : '.*DSO_DLFCN' > /dev/null && SHLIB=lib$(LIBNAME).so; \
 	SHLIB_SUFFIX=; \
 	ALLSYMSFLAGS='-Wl,-Fl'; \
 	NOALLSYMSFLAGS=''; \
 	expr $(PLATFORM) : 'hpux64' > /dev/null && ALLSYMSFLAGS='-Wl,+forceload'; \
-	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,+cdp,../:,+cdp,./:"; \
+	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SUFFIX,+cdp,../:,+cdp,./:"; \
 	fi; \
-	rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
-	$(LINK_SO_O) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
-link_a.hpux:
+	rm -f $$SHLIB$$SHLIB_SUFFIX || :; \
+	$(LINK_SO_DSO) && chmod a=rx $$SHLIB$$SHLIB_SUFFIX
+link_shlib.hpux:
 	@if $(DETECT_GNU_LD); then $(DO_GNU_SO); else \
 	$(CALC_VERSIONS); \
 	SHLIB=lib$(LIBNAME).sl; \
@@ -535,24 +506,23 @@ link_a.hpux:
 	SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-B,symbolic,+vnocompatwarnings,-z,+s,+h,$$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX,+cdp,../:,+cdp,./:"; \
 	fi; \
 	rm -f $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX || :; \
-	$(LINK_SO_A) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
+	$(LINK_SO_SHLIB) && chmod a=rx $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX
 link_app.hpux:
 	@if $(DETECT_GNU_LD); then $(DO_GNU_APP); else \
 	LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,+s,+cdp,../:,+cdp,./:,+b,$(LIBRPATH)"; \
 	fi; \
 	$(LINK_APP)
 
-link_o.aix:
-	@ $(CALC_VERSIONS); \
-	OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || :; \
+link_dso.aix:
+	@OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || :; \
 	OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
-	SHLIB=lib$(LIBNAME).so; \
+	SHLIB=$(LIBNAME).so; \
 	SHLIB_SUFFIX=; \
 	ALLSYMSFLAGS=''; \
 	NOALLSYMSFLAGS=''; \
 	SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
-	$(LINK_SO_O);
-link_a.aix:
+	$(LINK_SO_DSO);
+link_shlib.aix:
 	@ $(CALC_VERSIONS); \
 	OBJECT_MODE=`expr "x$(SHARED_LDFLAGS)" : 'x\-[a-z]*\(64\)'` || : ; \
 	OBJECT_MODE=$${OBJECT_MODE:-32}; export OBJECT_MODE; \
@@ -561,7 +531,7 @@ link_a.aix:
 	ALLSYMSFLAGS='-bnogc'; \
 	NOALLSYMSFLAGS=''; \
 	SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -Wl,-bexpall,-bnolibpath,-bM:SRE'; \
-	$(LINK_SO_A_VIA_O)
+	$(LINK_SO_SHLIB_VIA_O)
 link_app.aix:
 	LDFLAGS="$(CFLAGS) $(LDFLAGS) -Wl,-brtl,-blibpath:$(LIBRPATH):$${LIBPATH:-/usr/lib:/lib}"; \
 	$(LINK_APP)
@@ -587,54 +557,58 @@ symlink.hpux:
 symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
 
 # Compatibility targets
-link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
-link_a.bsd-gcc-shared link_a.gnu-shared: link_a.gnu
+link_dso.bsd-gcc-shared link_dso.linux-shared link_dso.gnu-shared: link_dso.gnu
+link_shlib.bsd-gcc-shared link_shlib.gnu-shared: link_shlib.gnu
 link_app.bsd-gcc-shared link_app.linux-shared link_app.gnu-shared: link_app.gnu
 symlink.bsd-gcc-shared symlink.bsd-shared symlink.linux-shared symlink.gnu-shared: symlink.gnu
-link_o.bsd-shared: link_o.bsd
-link_a.bsd-shared: link_a.bsd
+link_dso.bsd-shared: link_dso.bsd
+link_shlib.bsd-shared: link_shlib.bsd
 link_app.bsd-shared: link_app.bsd
-link_o.darwin-shared: link_o.darwin
-link_a.darwin-shared: link_a.darwin
+link_dso.darwin-shared: link_dso.darwin
+link_shlib.darwin-shared: link_shlib.darwin
 link_app.darwin-shared: link_app.darwin
 symlink.darwin-shared: symlink.darwin
-link_o.cygwin-shared: link_o.cygwin
-link_a.cygwin-shared: link_a.cygwin
+link_dso.cygwin-shared: link_dso.cygwin
+link_shlib.cygwin-shared: link_shlib.cygwin
 link_app.cygwin-shared: link_app.cygwin
 symlink.cygwin-shared: symlink.cygwin
-link_o.alpha-osf1-shared: link_o.alpha-osf1
-link_a.alpha-osf1-shared: link_a.alpha-osf1
+link_dso.mingw-shared: link_dso.cygwin
+link_shlib.mingw-shared: link_shlib.mingw
+link_app.mingw-shared: link_app.cygwin
+symlink.mingw-shared: symlink.cygwin
+link_dso.alpha-osf1-shared: link_dso.alpha-osf1
+link_shlib.alpha-osf1-shared: link_shlib.alpha-osf1
 link_app.alpha-osf1-shared: link_app.alpha-osf1
 symlink.alpha-osf1-shared: symlink.alpha-osf1
-link_o.tru64-shared: link_o.tru64
-link_a.tru64-shared: link_a.tru64
+link_dso.tru64-shared: link_dso.tru64
+link_shlib.tru64-shared: link_shlib.tru64
 link_app.tru64-shared: link_app.tru64
 symlink.tru64-shared: symlink.tru64
-link_o.tru64-shared-rpath: link_o.tru64-rpath
-link_a.tru64-shared-rpath: link_a.tru64-rpath
+link_dso.tru64-shared-rpath: link_dso.tru64-rpath
+link_shlib.tru64-shared-rpath: link_shlib.tru64-rpath
 link_app.tru64-shared-rpath: link_app.tru64-rpath
 symlink.tru64-shared-rpath: symlink.tru64-rpath
-link_o.solaris-shared: link_o.solaris
-link_a.solaris-shared: link_a.solaris
+link_dso.solaris-shared: link_dso.solaris
+link_shlib.solaris-shared: link_shlib.solaris
 link_app.solaris-shared: link_app.solaris
 symlink.solaris-shared: symlink.solaris
-link_o.svr3-shared: link_o.svr3
-link_a.svr3-shared: link_a.svr3
+link_dso.svr3-shared: link_dso.svr3
+link_shlib.svr3-shared: link_shlib.svr3
 link_app.svr3-shared: link_app.svr3
 symlink.svr3-shared: symlink.svr3
-link_o.svr5-shared: link_o.svr5
-link_a.svr5-shared: link_a.svr5
+link_dso.svr5-shared: link_dso.svr5
+link_shlib.svr5-shared: link_shlib.svr5
 link_app.svr5-shared: link_app.svr5
 symlink.svr5-shared: symlink.svr5
-link_o.irix-shared: link_o.irix
-link_a.irix-shared: link_a.irix
+link_dso.irix-shared: link_dso.irix
+link_shlib.irix-shared: link_shlib.irix
 link_app.irix-shared: link_app.irix
 symlink.irix-shared: symlink.irix
-link_o.hpux-shared: link_o.hpux
-link_a.hpux-shared: link_a.hpux
+link_dso.hpux-shared: link_dso.hpux
+link_shlib.hpux-shared: link_shlib.hpux
 link_app.hpux-shared: link_app.hpux
 symlink.hpux-shared: symlink.hpux
-link_o.aix-shared: link_o.aix
-link_a.aix-shared: link_a.aix
+link_dso.aix-shared: link_dso.aix
+link_shlib.aix-shared: link_shlib.aix
 link_app.aix-shared: link_app.aix
 symlink.aix-shared: symlink.aix
diff --git a/build.info b/build.info
index 9a3d9bd..f56b531 100644
--- a/build.info
+++ b/build.info
@@ -10,8 +10,8 @@ IF[{- $config{target} =~ /^Cygwin/ -}]
  SHARED_NAME[libcrypto]=cygcrypto-{- $config{shlib_major}.".".$config{shlib_minor} -}
  SHARED_NAME[libssl]=cygssl-{- $config{shlib_major}.".".$config{shlib_minor} -}
 ELSIF[{- $config{target} =~ /^mingw/ -}]
- SHARED_NAME[libcrypto]=libeay32
- SHARED_NAME[libssl]=ssleay32
+ SHARED_NAME[libcrypto]=libcrypto-{- $config{shlib_major}."_".$config{shlib_minor} -}{- $config{target} eq "mingw64" ? "-x64" : "" -}
+ SHARED_NAME[libssl]=libssl-{- $config{shlib_major}."_".$config{shlib_minor} -}{- $config{target} eq "mingw64" ? "-x64" : "" -}
 ENDIF
 
 # VMS has a cultural standard where all libraries are prefixed.
diff --git a/crypto/dso/dso_dl.c b/crypto/dso/dso_dl.c
index 6407bf7..73d7ca3 100644
--- a/crypto/dso/dso_dl.c
+++ b/crypto/dso/dso_dl.c
@@ -59,6 +59,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/dso.h>
+#include "internal/dso_conf.h"
 
 #ifndef DSO_DL
 DSO_METHOD *DSO_METHOD_dl(void)
@@ -288,11 +289,6 @@ static char *dl_merger(DSO *dso, const char *filespec1, const char *filespec2)
  * elegant way to share one copy of the code would be more difficult and
  * would not leave the implementations independent.
  */
-# if defined(__hpux)
-static const char extension[] = ".sl";
-# else
-static const char extension[] = ".so";
-# endif
 static char *dl_name_converter(DSO *dso, const char *filename)
 {
     char *translated;
@@ -303,7 +299,7 @@ static char *dl_name_converter(DSO *dso, const char *filename)
     transform = (strstr(filename, "/") == NULL);
     {
         /* We will convert this to "%s.s?" or "lib%s.s?" */
-        rsize += strlen(extension); /* The length of ".s?" */
+        rsize += strlen(DSO_EXTENSION); /* The length of ".s?" */
         if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
             rsize += 3;         /* The length of "lib" */
     }
@@ -314,9 +310,9 @@ static char *dl_name_converter(DSO *dso, const char *filename)
     }
     if (transform) {
         if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
-            sprintf(translated, "lib%s%s", filename, extension);
+            sprintf(translated, "lib%s%s", filename, DSO_EXTENSION);
         else
-            sprintf(translated, "%s%s", filename, extension);
+            sprintf(translated, "%s%s", filename, DSO_EXTENSION);
     } else
         sprintf(translated, "%s", filename);
     return (translated);
diff --git a/crypto/dso/dso_dlfcn.c b/crypto/dso/dso_dlfcn.c
index b6155b1..107abfd 100644
--- a/crypto/dso/dso_dlfcn.c
+++ b/crypto/dso/dso_dlfcn.c
@@ -68,6 +68,7 @@
 #include <stdio.h>
 #include "internal/cryptlib.h"
 #include <openssl/dso.h>
+#include "internal/dso_conf.h"
 
 #ifndef DSO_DLFCN
 DSO_METHOD *DSO_METHOD_dlfcn(void)
@@ -324,14 +325,6 @@ static char *dlfcn_merger(DSO *dso, const char *filespec1,
     return (merged);
 }
 
-# ifdef OPENSSL_SYS_MACOSX
-#  define DSO_ext ".dylib"
-#  define DSO_extlen 6
-# else
-#  define DSO_ext ".so"
-#  define DSO_extlen 3
-# endif
-
 static char *dlfcn_name_converter(DSO *dso, const char *filename)
 {
     char *translated;
@@ -342,7 +335,7 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename)
     transform = (strstr(filename, "/") == NULL);
     if (transform) {
         /* We will convert this to "%s.so" or "lib%s.so" etc */
-        rsize += DSO_extlen;    /* The length of ".so" */
+        rsize += strlen(DSO_EXTENSION);    /* The length of ".so" */
         if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
             rsize += 3;         /* The length of "lib" */
     }
@@ -353,9 +346,9 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename)
     }
     if (transform) {
         if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
-            sprintf(translated, "lib%s" DSO_ext, filename);
+            sprintf(translated, "lib%s" DSO_EXTENSION, filename);
         else
-            sprintf(translated, "%s" DSO_ext, filename);
+            sprintf(translated, "%s" DSO_EXTENSION, filename);
     } else
         sprintf(translated, "%s", filename);
     return (translated);
diff --git a/crypto/engine/eng_dyn.c b/crypto/engine/eng_dyn.c
index 3ca2480..648332a 100644
--- a/crypto/engine/eng_dyn.c
+++ b/crypto/engine/eng_dyn.c
@@ -447,6 +447,8 @@ static int dynamic_load(ENGINE *e, dynamic_data_ctx *ctx)
     if (!ctx->DYNAMIC_LIBNAME) {
         if (!ctx->engine_id)
             return 0;
+        DSO_ctrl(ctx->dynamic_dso, DSO_CTRL_SET_FLAGS,
+                 DSO_FLAG_NAME_TRANSLATION_EXT_ONLY, NULL);
         ctx->DYNAMIC_LIBNAME =
             DSO_convert_filename(ctx->dynamic_dso, ctx->engine_id);
     }
diff --git a/crypto/include/internal/err.h b/crypto/include/internal/dso_conf.h.in
similarity index 94%
copy from crypto/include/internal/err.h
copy to crypto/include/internal/dso_conf.h.in
index aa48019..e78e727 100644
--- a/crypto/include/internal/err.h
+++ b/crypto/include/internal/dso_conf.h.in
@@ -1,6 +1,4 @@
-/*
- * Written by Matt Caswell for the OpenSSL project.
- */
+{- join("\n",map { "/* $_ */" } @autowarntext) -}
 /* ====================================================================
  * Copyright (c) 2016 The OpenSSL Project.  All rights reserved.
  *
@@ -55,4 +53,8 @@
  *
  */
 
-void err_load_crypto_strings_intern(void);
+#ifndef HEADER_DSO_CONF_H
+# define HEADER_DSO_CONF_H
+
+# define DSO_EXTENSION "{- $target{dso_extension} -}"
+#endif
diff --git a/engines/Makefile.in b/engines/Makefile.in
index 047b6b4..99ba822 100644
--- a/engines/Makefile.in
+++ b/engines/Makefile.in
@@ -63,7 +63,7 @@ lib:	$(LIBOBJ) $(TESTLIBOBJ)
 			$(MAKE) -f ../Makefile.shared -e \
 				LIBNAME=$$l LIBEXTRAS="e_$$l*.o" \
 				LIBDEPS='$(PLIB_LDFLAG) -L.. -lcrypto $(EX_LIBS)' \
-				link_o.$(SHLIB_TARGET); \
+				link_dso.$(SHLIB_TARGET); \
 		done; \
 	else \
 		$(AR) $(LIB) $(LIBOBJ); \
@@ -79,33 +79,24 @@ e_padlock-x86_64.s:	asm/e_padlock-x86_64.pl
 files:
 	$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
 
-# XXXXX This currently only works on systems that use .so as suffix
-# for shared libraries as well as for Cygwin which uses the
-# dlfcn_name_converter and therefore stores the engines with .so suffix, too.
-# XXXXX This was extended to HP-UX dl targets, which use .sl suffix.
-# XXXXX This was extended to mingw targets, which use eay32.dll suffix without lib as prefix.
 install:
 	@[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
 	@if [ -n "$(SHARED_LIBS)" ]; then \
 		set -e; \
 		$(PERL) $(TOP)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines; \
 		for l in $(LIBNAMES); do \
-			( echo installing $$l; \
-			  pfx=lib; \
-			  if expr "$(PLATFORM)" : "Cygwin" >/dev/null; then \
-				sfx=".so"; \
-				cp cyg$$l.dll $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
-			  else \
-				case "$(CFLAGS)" in \
-				*DSO_DLFCN*)	sfx=`expr "$(SHLIB_EXT)" : '.*\(\.[a-z][a-z]*\)' \| ".so"`;;	\
-				*DSO_DL*)	sfx=".sl";;	\
-				*DSO_WIN32*)	sfx="eay32.dll"; pfx=;;	\
-				*)		sfx=".bad";;	\
-				esac; \
-				cp $$pfx$$l$$sfx $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
-			  fi; \
-			  chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new; \
-			  mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx ); \
+			cp $${l}$(DSO_EXT) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$${l}$(DSO_EXT).new; \
+			chmod 555 $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$${l}$(DSO_EXT).new; \
+			mv -f $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$${l}$(DSO_EXT).new $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$${l}$(DSO_EXT); \
+		done; \
+	fi
+
+uninstall:
+	@[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
+	@if [ -n "$(SHARED_LIBS)" ]; then \
+		set -e; \
+		for l in $(LIBNAMES); do \
+			$(RM) $(DESTDIR)$(INSTALLTOP)/$(LIBDIR)/engines/$${l}$(DSO_EXT); \
 		done; \
 	fi
 
diff --git a/engines/build.info b/engines/build.info
index e45650c..cae4986 100644
--- a/engines/build.info
+++ b/engines/build.info
@@ -6,19 +6,19 @@ IF[{- $config{no_shared} -}]
         e_capi.c \
         e_dasync.c
 ELSE
- ENGINES=libpadlock libcapi libdasync libossltest
- SOURCE[libpadlock]=e_padlock.c {- $target{padlock_asm_src} -}
- DEPEND[libpadlock]=../libcrypto
- INCLUDE[libpadlock]={- rel2abs(catdir($builddir,"../include")) -} ../include
- SOURCE[libcapi]=e_capi.c
- DEPEND[libcapi]=../libcrypto
- INCLUDE[libcapi]={- rel2abs(catdir($builddir,"../include")) -} ../include
- SOURCE[libdasync]=e_dasync.c
- DEPEND[libdasync]=../libcrypto
- INCLUDE[libdasync]={- rel2abs(catdir($builddir,"../include")) -} ../include
- SOURCE[libossltest]=e_ossltest.c
- DEPEND[libossltest]=../libcrypto
- INCLUDE[libossltest]={- rel2abs(catdir($builddir,"../include")) -} ../include
+ ENGINES=padlock capi dasync ossltest
+ SOURCE[padlock]=e_padlock.c {- $target{padlock_asm_src} -}
+ DEPEND[padlock]=../libcrypto
+ INCLUDE[padlock]={- rel2abs(catdir($builddir,"../include")) -} ../include
+ SOURCE[capi]=e_capi.c
+ DEPEND[capi]=../libcrypto
+ INCLUDE[capi]={- rel2abs(catdir($builddir,"../include")) -} ../include
+ SOURCE[dasync]=e_dasync.c
+ DEPEND[dasync]=../libcrypto
+ INCLUDE[dasync]={- rel2abs(catdir($builddir,"../include")) -} ../include
+ SOURCE[ossltest]=e_ossltest.c
+ DEPEND[ossltest]=../libcrypto
+ INCLUDE[ossltest]={- rel2abs(catdir($builddir,"../include")) -} ../include
 ENDIF
 
 BEGINRAW[Makefile]


More information about the openssl-commits mailing list