Commit e987f9f2 authored by Richard Levitte's avatar Richard Levitte
Browse files

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: default avatarAndy Polyakov <appro@openssl.org>
parent a8a421b1
Loading
Loading
Loading
Loading
+10 −12
Original line number Diff line number Diff line
@@ -4,10 +4,6 @@
## {- 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 }
-}
PLATFORM={- $config{target} -}
OPTIONS={- $config{options} -}
@@ -26,14 +22,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}}) -}
ENGINES={- join(" ", map { $_."\$(DSO_EXT)" } @{$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}}) -}
@@ -739,7 +737,7 @@ configdata.pm: {- $config{build_file_template} -} $(SRCDIR)/Configure $(SRCDIR)/
      # 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"
                       "$_\$(SHLIB_EXT_IMPORT)"
		   } else {
		       my $libname =
		           $unified_info{sharednames}->{$_} || $_;
@@ -791,14 +789,14 @@ EOF
      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)";
	  "$lib\$(SHLIB_EXT_IMPORT)" : "$shlib\$(SHLIB_EXT_SIMPLE)";
      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
	\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
@@ -835,7 +833,7 @@ EOF
      my $shlib_target = $target{shared_target};
      my $objs = join(" ", map { $_."\$(OBJ_EXT)" } @{$args{objs}});
      return <<"EOF";
$lib\$(SHLIB_EXT_SIMPLE): $objs $deps
$lib\$(DSO_EXT): $objs $deps
	\$(MAKE) -f \$(SRCDIR)/Makefile.shared -e \\
		PLATFORM=\$(PLATFORM) \\
		PERL=\$(PERL) SRCDIR="\$(SRCDIR)" DSTDIR="$libd" \\
@@ -843,7 +841,7 @@ $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
EOF
+12 −1
Original line number Diff line number Diff line
@@ -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 = (
@@ -813,6 +814,13 @@ $target{exe_extension}=".exe" if ($config{target} eq "Cygwin" || $config{target}
$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 +2175,9 @@ sub print_table_entry
	"shared_ldflag",
	"shared_rcflag",
	"shared_extension",
	"shared_extension_simple",
	"shared_import_extension",
	"dso_extension",
	"obj_extension",
	"exe_extension",
	"ranlib",
+6 −2
Original line number Diff line number Diff line
@@ -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}})) -})
@@ -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)'				\
+4 −8
Original line number Diff line number Diff line
@@ -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);
+4 −11
Original line number Diff line number Diff line
@@ -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);
Loading