Redo and enhance the support for building shared libraries. Currently
authorRichard Levitte <levitte@openssl.org>
Fri, 21 Jul 2000 15:08:53 +0000 (15:08 +0000)
committerRichard Levitte <levitte@openssl.org>
Fri, 21 Jul 2000 15:08:53 +0000 (15:08 +0000)
there's support for building under Linux and True64 (using examples
from the programming manuals), including versioning that is currently
the same as OpenSSL versions but should really be a different series.

With this change, it's up to the users to decide if they want shared
libraries as well as the static ones.  This decision now has to be
done at configuration time (well, not really, those who know what they
do can still do it the same way as before).

The OpenSSL programs (openssl and the test programs) are currently
always linked statically, but this may change in the future in a
configurable manner.  The necessary makefile variables to enable this
are in place.

Also note that I have done absolutely nothing about the Windows target
to get something similar.  On the other hand, DLLs are already the
default there, but without versioning, and I've no idea what the
possibilities for such a thing are there...

.cvsignore
CHANGES
Configure
Makefile.org
crypto/opensslv.h

index ea182b942cdf346bfc30d6fea59fc8ed51264164..8ff9fdc9152bd5ee6181a344cc1ce705cfdf1d25 100644 (file)
@@ -11,3 +11,5 @@ maketest.log
 cctest
 cctest.c
 cctest.a
 cctest
 cctest.c
 cctest.a
+libcrypto.so.*
+libssl.so.*
diff --git a/CHANGES b/CHANGES
index 1524f4ec5eb365eb80f33a7e401b65f9b6715bc1..30ac5d764f36150d6aa1335d2058be34994f51b3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,14 @@
 
  Changes between 0.9.5a and 0.9.6  [xx XXX 2000]
 
 
  Changes between 0.9.5a and 0.9.6  [xx XXX 2000]
 
+  *) A first attempt at creating official support for shared
+     libraries through configuration.  I've kept it so the
+     default is static libraries only, and the OpenSSL programs
+     are always statically linked for now, but there are
+     preparations for dynamic linking in place.
+     This has been tested on Linux and True64.
+     [Richard Levitte]
+
   *) Randomness polling function for Win9x, as described in:
      Peter Gutmann, Software Generation of Practically Strong
      Random Numbers.
   *) Randomness polling function for Win9x, as described in:
      Peter Gutmann, Software Generation of Practically Strong
      Random Numbers.
index 94f4d6556d10878deaec347bfcb93ebd8870a8f4..cf5fe2007e1755402985fdae833bd905fd883f11 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -27,6 +27,8 @@ my $usage="Usage: Configure [no-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-
 # [no-]threads  [don't] try to create a library that is suitable for
 #               multithreaded applications (default is "threads" if we
 #               know how to do it)
 # [no-]threads  [don't] try to create a library that is suitable for
 #               multithreaded applications (default is "threads" if we
 #               know how to do it)
+# [no-]shared  [don't] try to create shared libraries instead of static
+#              ones when possible.
 # no-asm        do not use assembler
 # no-dso        do not compile in any native shared-library methods. This
 #               will ensure that all methods just return NULL.
 # no-asm        do not use assembler
 # no-dso        do not compile in any native shared-library methods. This
 #               will ensure that all methods just return NULL.
@@ -91,7 +93,7 @@ my $x86_bsdi_asm="asm/bn86bsdi.o asm/co86bsdi.o:asm/dx86bsdi.o asm/yx86bsdi.o:as
 # -DB_ENDIAN slows things down on a sparc for md5, but helps sha1.
 # So the md5_locl.h file has an undef B_ENDIAN if sun is defined
 
 # -DB_ENDIAN slows things down on a sparc for md5, but helps sha1.
 # So the md5_locl.h file has an undef B_ENDIAN if sun is defined
 
-#config-string $cc : $cflags : $unistd : $thread_cflag : $lflags : $bn_ops : $bn_obj : $des_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme
+#config-string $cc : $cflags : $unistd : $thread_cflag : $lflags : $bn_ops : $bn_obj : $des_obj : $bf_obj : $md5_obj : $sha1_obj : $cast_obj : $rc4_obj : $rmd160_obj : $rc5_obj : $dso_scheme : $shared_target : $shared_cflag
 
 my %table=(
 #"b",          "${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::",
 
 my %table=(
 #"b",          "${tcc}:${tflags}::${tlib}:${bits1}:${tbn_mul}::",
@@ -245,9 +247,9 @@ my %table=(
 # Dec Alpha, OSF/1 - the alpha164-cc is the flags for a 21164A with
 # the new compiler
 # For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
 # Dec Alpha, OSF/1 - the alpha164-cc is the flags for a 21164A with
 # the new compiler
 # For gcc, the following gave a %50 speedup on a 164 over the 'DES_INT' version
-"alpha-gcc","gcc:-O3::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:asm/alpha.o:::::::::dlfcn",
-"alpha-cc", "cc:-std1 -tune host -O4 -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/alpha.o:::::::::dlfcn",
-"alpha164-cc", "cc:-std1 -tune host -fast -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/alpha.o::",
+"alpha-gcc","gcc:-O3::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_UNROLL DES_RISC1:asm/alpha.o:::::::::dlfcn:true64-shared",
+"alpha-cc", "cc:-std1 -tune host -O4 -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/alpha.o:::::::::dlfcn:true64-shared",
+"alpha164-cc", "cc:-std1 -tune host -fast -readonly_strings::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK:asm/alpha.o:::::::::dlfcn:true64-shared",
 "FreeBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC2:::",
 
 #### Alpha Linux with GNU C and Compaq C setups
 "FreeBSD-alpha","gcc:-DTERMIOS -O3 -fomit-frame-pointer::(unknown)::SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC2:::",
 
 #### Alpha Linux with GNU C and Compaq C setups
@@ -273,7 +275,7 @@ my %table=(
 
 # The intel boxes :-), It would be worth seeing if bsdi-gcc can use the
 # bn86-elf.o file file since it is hand tweaked assembler.
 
 # The intel boxes :-), It would be worth seeing if bsdi-gcc can use the
 # bn86-elf.o file file since it is hand tweaked assembler.
-"linux-elf",   "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT:-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
+"linux-elf",   "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::-D_REENTRANT:-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
 "debug-linux-elf","gcc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT:-lefence:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
 "debug-linux-elf-noefence","gcc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
 "linux-aout",  "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
 "debug-linux-elf","gcc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT:-lefence:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
 "debug-linux-elf-noefence","gcc:-DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DL_ENDIAN -DTERMIO -g -m486 -Wall::-D_REENTRANT::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn",
 "linux-aout",  "gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -m486 -Wall::(unknown)::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_out_asm}",
@@ -294,7 +296,7 @@ my %table=(
 "ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown):-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:::",
 
 # Linux on ARM
 "ncr-scde","cc:-O6 -Xa -Hoff=BEHAVED -686 -Hwide -Hiw::(unknown):-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:::",
 
 # Linux on ARM
-"linux-elf-arm","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::BN_LLONG::::::::::dlfcn",
+"linux-elf-arm","gcc:-DL_ENDIAN -DTERMIO -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::BN_LLONG::::::::::dlfcn:linux-shared:-fPIC",
 
 # UnixWare 2.0
 "unixware-2.0","cc:-O -DFILIO_H::(unknown):-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:::",
 
 # UnixWare 2.0
 "unixware-2.0","cc:-O -DFILIO_H::(unknown):-lsocket -lnsl:${x86_gcc_des} ${x86_gcc_opts}:::",
@@ -394,6 +396,7 @@ my $prefix="";
 my $openssldir="";
 my $install_prefix="";
 my $no_threads=0;
 my $openssldir="";
 my $install_prefix="";
 my $no_threads=0;
+my $no_shared=1;
 my $threads=0;
 my $no_asm=0;
 my $no_dso=0;
 my $threads=0;
 my $no_asm=0;
 my $no_dso=0;
@@ -451,6 +454,10 @@ foreach (@ARGV)
                { $no_threads=1; }
        elsif (/^threads$/)
                { $threads=1; }
                { $no_threads=1; }
        elsif (/^threads$/)
                { $threads=1; }
+       elsif (/^no-shared$/)
+               { $no_shared=1; }
+       elsif (/^shared$/)
+               { $no_shared=0; }
        elsif (/^no-symlinks$/)
                { $symlink=0; }
        elsif (/^no-(.+)$/)
        elsif (/^no-symlinks$/)
                { $symlink=0; }
        elsif (/^no-(.+)$/)
@@ -557,8 +564,8 @@ $openssldir=$prefix . "/" . $openssldir if $openssldir !~ /^\//;
 print "IsWindows=$IsWindows\n";
 
 (my $cc,my $cflags,my $unistd,my $thread_cflag,my $lflags,my $bn_ops,my $bn_obj,my $des_obj,my $bf_obj,
 print "IsWindows=$IsWindows\n";
 
 (my $cc,my $cflags,my $unistd,my $thread_cflag,my $lflags,my $bn_ops,my $bn_obj,my $des_obj,my $bf_obj,
- $md5_obj,$sha1_obj,my $cast_obj,my $rc4_obj,$rmd160_obj,my $rc5_obj,my $dso_scheme)=
-       split(/\s*:\s*/,$table{$target} . ":" x 20 , -1);
+ $md5_obj,$sha1_obj,my $cast_obj,my $rc4_obj,$rmd160_obj,my $rc5_obj,my $dso_scheme,my $shared_target,my $shared_cflag)=
+       split(/\s*:\s*/,$table{$target} . ":" x 21 , -1);
 $cflags="$flags$cflags" if ($flags ne "");
 
 # The DSO code currently always implements all functions so that no
 $cflags="$flags$cflags" if ($flags ne "");
 
 # The DSO code currently always implements all functions so that no
@@ -632,6 +639,16 @@ if ($threads)
                $openssl_thread_defines .= $thread_defines;
        }
 
                $openssl_thread_defines .= $thread_defines;
        }
 
+if ($no_shared)
+       {
+       $shared_target = "";
+       $shared_cflag = "";
+       }
+else
+       {
+       $cflags = "$shared_cflag $cflags";
+       }
+
 #my ($bn1)=split(/\s+/,$bn_obj);
 #$bn1 = "" unless defined $bn1;
 #$bn1=$bn_asm unless ($bn1 =~ /\.o$/);
 #my ($bn1)=split(/\s+/,$bn_obj);
 #$bn1 = "" unless defined $bn1;
 #$bn1=$bn_asm unless ($bn1 =~ /\.o$/);
@@ -663,13 +680,20 @@ if ($rmd160_obj =~ /\.o$/)
 my $version = "unknown";
 my $major = "unknown";
 my $minor = "unknown";
 my $version = "unknown";
 my $major = "unknown";
 my $minor = "unknown";
+my $shlib_version_number = "unknown";
+my $shlib_version_history = "unknown";
+my $shlib_major = "unknown";
+my $shlib_minor = "unknown";
 
 open(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
 while (<IN>)
        {
        $version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
 
 open(IN,'<crypto/opensslv.h') || die "unable to read opensslv.h:$!\n";
 while (<IN>)
        {
        $version=$1 if /OPENSSL.VERSION.TEXT.*OpenSSL (\S+) /;
+       $shlib_version_number=$1 if /SHLIB_VERSION_NUMBER *"([^"]+)"/;
+       $shlib_version_history=$1 if /SHLIB_VERSION_HISTORY *"([^"]*)"/;
        }
 close(IN);
        }
 close(IN);
+if ($shlib_version_history ne "") { $shlib_version_history .= ":"; }
 
 if ($version =~ /(^[0-9]*)\.([0-9\.]*)/)
        {
 
 if ($version =~ /(^[0-9]*)\.([0-9\.]*)/)
        {
@@ -677,6 +701,12 @@ if ($version =~ /(^[0-9]*)\.([0-9\.]*)/)
        $minor=$2;
        }
 
        $minor=$2;
        }
 
+if ($shlib_version_number =~ /(^[0-9]*)\.([0-9\.]*)/)
+       {
+       $shlib_major=$1;
+       $shlib_minor=$2;
+       }
+
 open(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
 open(OUT,">$Makefile") || die "unable to create $Makefile:$!\n";
 print OUT "### Generated automatically from Makefile.org by Configure.\n\n";
 open(IN,'<Makefile.org') || die "unable to read Makefile.org:$!\n";
 open(OUT,">$Makefile") || die "unable to create $Makefile:$!\n";
 print OUT "### Generated automatically from Makefile.org by Configure.\n\n";
@@ -695,6 +725,10 @@ while (<IN>)
        s/^VERSION=.*/VERSION=$version/;
        s/^MAJOR=.*/MAJOR=$major/;
        s/^MINOR=.*/MINOR=$minor/;
        s/^VERSION=.*/VERSION=$version/;
        s/^MAJOR=.*/MAJOR=$major/;
        s/^MINOR=.*/MINOR=$minor/;
+       s/^SHLIB_VERSION_NUMBER=.*/SHLIB_VERSION_NUMBER=$shlib_version_number/;
+       s/^SHLIB_VERSION_HISTORY=.*/SHLIB_VERSION_HISTORY=$shlib_version_history/;
+       s/^SHLIB_MAJOR=.*/SHLIB_MAJOR=$shlib_major/;
+       s/^SHLIB_MINOR=.*/SHLIB_MINOR=$shlib_minor/;
        s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
        s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
        s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
        s/^INSTALLTOP=.*$/INSTALLTOP=$prefix/;
        s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
        s/^INSTALL_PREFIX=.*$/INSTALL_PREFIX=$install_prefix/;
@@ -716,6 +750,8 @@ while (<IN>)
        s/^PROCESSOR=.*/PROCESSOR= $processor/;
        s/^RANLIB=.*/RANLIB= $ranlib/;
        s/^PERL=.*/PERL= $perl/;
        s/^PROCESSOR=.*/PROCESSOR= $processor/;
        s/^RANLIB=.*/RANLIB= $ranlib/;
        s/^PERL=.*/PERL= $perl/;
+       s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
+       s/^LIBS=.*/LIBS=libcrypto\.so\* libssl\.so\*/ if (!$no_shared);
        print OUT $_."\n";
        }
 close(IN);
        print OUT $_."\n";
        }
 close(IN);
@@ -1024,5 +1060,7 @@ sub print_table_entry
 \$rmd160_obj   = $rmd160_obj
 \$rc5_obj      = $rc5_obj
 \$dso_scheme   = $dso_scheme
 \$rmd160_obj   = $rmd160_obj
 \$rc5_obj      = $rc5_obj
 \$dso_scheme   = $dso_scheme
+\$shared_target= $shared_target
+\$shared_cflag = $shared_cflag
 EOF
        }
 EOF
        }
index b48000c37e7480d17f0f4dc3ac509a2e5a9928d9..3d718c0dbf05c7737c14e17f89a3f2994c7c59b5 100644 (file)
@@ -5,8 +5,14 @@
 VERSION=
 MAJOR=
 MINOR=
 VERSION=
 MAJOR=
 MINOR=
+SHLIB_VERSION_NUMBER=
+SHLIB_VERSION_HISTORY=
+SHLIB_MAJOR=
+SHLIB_MINOR=
 PLATFORM=dist
 OPTIONS=
 PLATFORM=dist
 OPTIONS=
+SHLIB_TARGET=
+
 # INSTALL_PREFIX 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.
 # INSTALL_PREFIX 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.
@@ -142,7 +148,14 @@ RMD160_ASM_OBJ= asm/rm86-out.o
 #RMD160_ASM_OBJ= asm/rm86-out.o       # a.out, FreeBSD
 #RMD160_ASM_OBJ= asm/rm86bsdi.o       # bsdi
 
 #RMD160_ASM_OBJ= asm/rm86-out.o       # a.out, FreeBSD
 #RMD160_ASM_OBJ= asm/rm86bsdi.o       # bsdi
 
-DIRS=   crypto ssl rsaref apps test tools
+# To do special treatment, use "directory names" starting with a period.
+# When we're prepared to use shared libraries in the programs we link here
+# we might have SHLIB_MARK1 get the value ".shlib." and SHLIB_MARK2 be empty,
+# or have that configurable.
+SHLIB_MARK1=.shlib-clean.
+SHLIB_MARK2=.shlib.
+
+DIRS=   crypto ssl rsaref $(SHLIB_MARK1) apps test tools $(SHLIB_MARK2)
 SHLIBDIRS= crypto ssl
 
 # dirs in crypto to build
 SHLIBDIRS= crypto ssl
 
 # dirs in crypto to build
@@ -165,7 +178,8 @@ TOP=    .
 ONEDIRS=out tmp
 EDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
 WDIRS=  windows
 ONEDIRS=out tmp
 EDIRS=  times doc bugs util include certs ms shlib mt demos perl sf dep VMS
 WDIRS=  windows
-LIBS=   libcrypto.a libssl.a 
+LIBS=   libcrypto.a libssl.a
+SHARED_LIBS=libcrypto.so libssl.so
 
 GENERAL=        Makefile
 BASENAME=       openssl
 
 GENERAL=        Makefile
 BASENAME=       openssl
@@ -176,36 +190,84 @@ EXHEADER=       e_os.h e_os2.h
 HEADER=         e_os.h
 
 all: Makefile.ssl
 HEADER=         e_os.h
 
 all: Makefile.ssl
-       @for i in $(DIRS) ;\
+       @need_shlib=true; \
+       for i in $(DIRS) ;\
        do \
        do \
-       (cd $$i && echo "making all in $$i..." && \
-       $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' SDIRS='${SDIRS}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' all ) || exit 1; \
-       done
-       -@# cd crypto; $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' SDIRS='${SDIRS}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' testapps
-       -@# cd perl; $(PERL) Makefile.PL; make
+       if [ "$$i" = ".shlib-clean." ]; then \
+               if [ "$(SHLIB_TARGET)" != "" ]; then \
+                       $(MAKE) clean-shared; \
+               fi; \
+       elif [ "$$i" = ".shlib." ]; then \
+               if [ "$(SHLIB_TARGET)" != "" ]; then \
+                       $(MAKE) $(SHARED_LIBS); \
+               fi; \
+               need_shlib=false; \
+       else \
+               (cd $$i && echo "making all in $$i..." && \
+               $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' SDIRS='${SDIRS}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' all ) || exit 1; \
+       fi; \
+       done; \
+       if $$need_shlib && [ "$(SHLIB_TARGET)" != "" ]; then :; else \
+               $(MAKE) $(SHARED_LIBS); \
+       fi
 
 sub_all:
 
 sub_all:
-       @for i in $(DIRS) ;\
+       @need_shlib=true; \
+       for i in $(DIRS) ;\
        do \
        do \
-       (cd $$i && echo "making all in $$i..." && \
-       $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' all ) || exit 1; \
-       done;
+       if [ "$$i" = ".shlib-clean." ]; then \
+               if [ "$(SHLIB_TARGET)" != "" ]; then \
+                       $(MAKE) clean-shared; \
+               fi; \
+       elif [ "$$i" = ".shlib." ]; then \
+               if [ "$(SHLIB_TARGET)" != "" ]; then \
+                       $(MAKE) $(SHARED_LIBS); \
+               fi; \
+               need_shlib=false; \
+       else \
+               (cd $$i && echo "making all in $$i..." && \
+               $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PROCESSOR='${PROCESSOR}' PERL='${PERL}' RANLIB='${RANLIB}' all ) || exit 1; \
+       fi; \
+       done; \
+       if $$need_shlib && [ "$(SHLIB_TARGET)" != "" ]; then :; else \
+               $(MAKE) $(SHARED_LIBS); \
+       fi
+
+libcrypto.so: libcrypto.a
+       $(MAKE) $(SHLIB_TARGET)
+libssl.so: libcrypto.so libssl.a
+       $(MAKE) $(SHLIB_TARGET)
+
+clean-shared:
+       for i in ${SHLIBDIRS}; do \
+       rm -f lib$$i.so \
+               lib$$i.so.${SHLIB_MAJOR} \
+               lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}; \
+       done
 
 linux-shared:
 
 linux-shared:
-       for i in ${SHLIBDIRS}; do \
-       rm -f lib$$i.a lib$$i.so \
-               lib$$i.so.${MAJOR} lib$$i.so.${MAJOR}.${MINOR}; \
-       ${MAKE} CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='-fPIC ${CFLAG}' SDIRS='${SDIRS}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' DIRS=$$i clean all || exit 1; \
-       ( set -x; ${CC}  -shared -o lib$$i.so.${MAJOR}.${MINOR} \
-               -Wl,-S,-soname=lib$$i.so.${MAJOR} \
+       libs=; for i in ${SHLIBDIRS}; do \
+       rm -f lib$$i.so \
+               lib$$i.so.${SHLIB_MAJOR} \
+               lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR}; \
+       ( set -x; ${CC}  -shared -o lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
+               -Wl,-S,-soname=lib$$i.so.${SHLIB_MAJOR} \
                -Wl,--whole-archive lib$$i.a \
                -Wl,--whole-archive lib$$i.a \
-               -Wl,--no-whole-archive -lc ) || exit 1; \
-       rm -f lib$$i.a; make -C $$i clean || exit 1 ;\
+               -Wl,--no-whole-archive -lc $$libs ) || exit 1; \
+       libs="$$libs -L. -l$$i"; \
+       ( set -x; \
+               ln -s lib$$i.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \
+                       lib$$i.so.${SHLIB_MAJOR}; \
+               ln -s lib$$i.so.${SHLIB_MAJOR} lib$$i.so ); \
        done;
        done;
-       @set -x; \
-       for i in ${SHLIBDIRS}; do \
-       ln -s lib$$i.so.${MAJOR}.${MINOR} lib$$i.so.${MAJOR}; \
-       ln -s lib$$i.so.${MAJOR} lib$$i.so; \
+
+# This assumes that GNU utilities are *not* used
+true64-shared:
+       libs=; for i in ${SHLIBDIRS}; do \
+       ( set -x; ${CC}  -shared -no_archive -o lib$$i.so \
+               -set_version "${SHLIB_VERSION_HISTORY}${SHLIB_VERSION_NUMBER}" \
+               -all lib$$i.a -none -lc $$libs ) || exit 1; \
+       libs="$$libs -L. -l$$i"; \
        done;
 
 Makefile.ssl: Makefile.org
        done;
 
 Makefile.ssl: Makefile.org
@@ -220,9 +282,11 @@ clean:
        rm -f shlib/*.o *.o core a.out fluff *.map rehash.time testlog make.log cctest cctest.c
        @for i in $(DIRS) ;\
        do \
        rm -f shlib/*.o *.o core a.out fluff *.map rehash.time testlog make.log cctest cctest.c
        @for i in $(DIRS) ;\
        do \
-       (cd $$i && echo "making clean in $$i..." && \
-       $(MAKE) SDIRS='${SDIRS}' clean ) || exit 1; \
-       rm -f $(LIBS); \
+       if echo "$$i" | grep -v '^\.'; then \
+               (cd $$i && echo "making clean in $$i..." && \
+               $(MAKE) SDIRS='${SDIRS}' clean ) || exit 1; \
+               rm -f $(LIBS); \
+       fi; \
        done;
        rm -f *.a *.o speed.* *.map *.so .pure core
        rm -f $(TARFILE)
        done;
        rm -f *.a *.o speed.* *.map *.so .pure core
        rm -f $(TARFILE)
@@ -239,8 +303,10 @@ files:
        $(PERL) $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO
        @for i in $(DIRS) ;\
        do \
        $(PERL) $(TOP)/util/files.pl Makefile.ssl > $(TOP)/MINFO
        @for i in $(DIRS) ;\
        do \
-       (cd $$i && echo "making 'files' in $$i..." && \
-       $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' files ) || exit 1; \
+       if echo "$$i" | grep -v '^\.'; then \
+               (cd $$i && echo "making 'files' in $$i..." && \
+               $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' files ) || exit 1; \
+       fi; \
        done;
 
 links:
        done;
 
 links:
@@ -248,16 +314,20 @@ links:
        @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
        @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
        @for i in $(DIRS); do \
        @$(PERL) $(TOP)/util/mkdir-p.pl include/openssl
        @$(PERL) $(TOP)/util/mklink.pl include/openssl $(EXHEADER)
        @for i in $(DIRS); do \
-       (cd $$i && echo "making links in $$i..." && \
-       $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PERL='${PERL}' links ) || exit 1; \
+       if echo "$$i" | grep -v '^\.'; then \
+               (cd $$i && echo "making links in $$i..." && \
+               $(MAKE) CC='${CC}' PLATFORM='${PLATFORM}' CFLAG='${CFLAG}' SDIRS='$(SDIRS)' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' BN_ASM='${BN_ASM}' DES_ENC='${DES_ENC}' BF_ENC='${BF_ENC}' CAST_ENC='${CAST_ENC}' RC4_ENC='${RC4_ENC}' RC5_ENC='${RC5_ENC}' SHA1_ASM_OBJ='${SHA1_ASM_OBJ}' MD5_ASM_OBJ='${MD5_ASM_OBJ}' RMD160_ASM_OBJ='${RMD160_ASM_OBJ}' AR='${AR}' PERL='${PERL}' links ) || exit 1; \
+       fi; \
        done;
 
 dclean:
        rm -f *.bak
        @for i in $(DIRS) ;\
        do \
        done;
 
 dclean:
        rm -f *.bak
        @for i in $(DIRS) ;\
        do \
-       (cd $$i && echo "making dclean in $$i..." && \
-       $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' dclean ) || exit 1; \
+       if echo "$$i" | grep -v '^\.'; then \
+               (cd $$i && echo "making dclean in $$i..." && \
+               $(MAKE) SDIRS='${SDIRS}' PERL='${PERL}' dclean ) || exit 1; \
+       fi; \
        done;
 
 rehash: rehash.time
        done;
 
 rehash: rehash.time
@@ -278,22 +348,28 @@ report:
 depend:
        @for i in $(DIRS) ;\
        do \
 depend:
        @for i in $(DIRS) ;\
        do \
-       (cd $$i && echo "making dependencies $$i..." && \
-       $(MAKE) SDIRS='${SDIRS}' DEPFLAG='${DEPFLAG}' depend ) || exit 1; \
+       if echo "$$i" | grep -v '^\.'; then \
+               (cd $$i && echo "making dependencies $$i..." && \
+               $(MAKE) SDIRS='${SDIRS}' DEPFLAG='${DEPFLAG}' depend ) || exit 1; \
+       fi; \
        done;
 
 lint:
        @for i in $(DIRS) ;\
        do \
        done;
 
 lint:
        @for i in $(DIRS) ;\
        do \
-       (cd $$i && echo "making lint $$i..." && \
-       $(MAKE) SDIRS='${SDIRS}' lint ) || exit 1; \
+       if echo "$$i" | grep -v '^\.'; then \
+               (cd $$i && echo "making lint $$i..." && \
+               $(MAKE) SDIRS='${SDIRS}' lint ) || exit 1; \
+       fi; \
        done;
 
 tags:
        @for i in $(DIRS) ;\
        do \
        done;
 
 tags:
        @for i in $(DIRS) ;\
        do \
-       (cd $$i && echo "making tags $$i..." && \
-       $(MAKE) SDIRS='${SDIRS}' tags ) || exit 1; \
+       if echo "$$i" | grep -v '^\.'; then \
+               (cd $$i && echo "making tags $$i..." && \
+               $(MAKE) SDIRS='${SDIRS}' tags ) || exit 1; \
+       fi; \
        done;
 
 errors:
        done;
 
 errors:
@@ -352,15 +428,19 @@ install: all install_docs
        done;
        @for i in $(DIRS) ;\
        do \
        done;
        @for i in $(DIRS) ;\
        do \
-       (cd $$i; echo "installing $$i..."; \
-       $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' RANLIB='${RANLIB}' install ); \
+       if echo "$$i" | grep -v '^\.'; then \
+               (cd $$i; echo "installing $$i..."; \
+               $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALL_PREFIX='${INSTALL_PREFIX}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' RANLIB='${RANLIB}' install ); \
+       fi; \
        done
        @for i in $(LIBS) ;\
        do \
        done
        @for i in $(LIBS) ;\
        do \
-       (       echo installing $$i; \
-               cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
-               $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
-               chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
+               if [ -f "$$i" ]; then \
+               (       echo installing $$i; \
+                       cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
+                       $(RANLIB) $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
+                       chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
+               fi \
        done
 
 install_docs:
        done
 
 install_docs:
index 7fcc1ad417be9da901e23c134e445b1def3387cb..90b0fe2c02b7300128f7a2998897a03308191031 100644 (file)
 #define OPENSSL_VERSION_TEXT   "OpenSSL 0.9.5b-dev 1 Apr 2000"
 #define OPENSSL_VERSION_PTEXT  " part of " OPENSSL_VERSION_TEXT
 
 #define OPENSSL_VERSION_TEXT   "OpenSSL 0.9.5b-dev 1 Apr 2000"
 #define OPENSSL_VERSION_PTEXT  " part of " OPENSSL_VERSION_TEXT
 
+
+/* The macros below are to be used for shared library (.so, .dll, ...)
+ * versioning.  That kind of versioning works a bit differently between
+ * operating systems.  The most usual scheme is to set a major and a minor
+ * number, and have the runtime loader check that the major number is equal
+ * to what it was at application link time, while the minor number has to
+ * be greater or equal to what it was at application link time.  With this
+ * scheme, the version number is usually part of the file name, like this:
+ *
+ *     libcrypto.so.0.9
+ *
+ * Some unixen also make a softlink with the major verson number only:
+ *
+ *     libcrypto.so.0
+ *
+ * On True64 it works a little bit differently.  There, the shared library
+ * version is stored in the file, and is actually a series of versions,
+ * separated by colons.  The rightmost version present in the library when
+ * linking an application is stored in the application to be matched at
+ * run time.  When the application is run, a check is done to see if the
+ * library version stored in the application matches any of the versions
+ * in the version string of the library itself.
+ * This version string can be constructed in any way, depending on what
+ * kind of matching is desired.  However, to implement the same scheme as
+ * the one used in the other unixen, all compatible versions, from lowest
+ * to highest, should be part of the string.  Consecutive builds would
+ * give the following versions strings:
+ *
+ *     3.0
+ *     3.0:3.1
+ *     3.0:3.1:3.2
+ *     4.0
+ *     4.0:4.1
+ *
+ * Notice how version 4 is completely incompatible with version, and
+ * therefore give the breach you can see.
+ *
+ * There may be other schemes as well that I haven't yet discovered.
+ *
+ * So, here's the way it works here: first of all, the library version
+ * number doesn't need at all to match the overall OpenSSL version.
+ * However, it's nice and more understandable if it actually does.
+ * The current library version is stored in the macro SHLIB_VERSION_NUMBER,
+ * which is just a piece of text in the format "M.m.e" (Major, minor, edit).
+ * For the sake of True64 and any other OS that behaves in similar ways,
+ * we need to keep a history of version numbers, which is done in the
+ * macro SHLIB_VERSION_HISTORY.  The numbers are separated by colons and
+ * should only keep the versions that are binary compatible with the current.
+ */
+#define SHLIB_VERSION_HISTORY ""
+#define SHLIB_VERSION_NUMBER "0.9.5b"
+
+
 #endif /* HEADER_OPENSSLV_H */
 #endif /* HEADER_OPENSSLV_H */