New Configure option --openssldir to replace util/ssldir.pl.
authorUlf Möller <ulf@openssl.org>
Sat, 24 Apr 1999 22:59:36 +0000 (22:59 +0000)
committerUlf Möller <ulf@openssl.org>
Sat, 24 Apr 1999 22:59:36 +0000 (22:59 +0000)
Configure
INSTALL
Makefile.org
config

index 89f9f27b08a2ecb43c30ebde0f72a716da41864e..57b536c4169bdca46c4e8042122bb53d35ade77e 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -9,11 +9,14 @@ require 5.000;
 use strict;
 
 # see INSTALL for instructions.
 use strict;
 
 # see INSTALL for instructions.
-#
-# Usage: Configure [-Dxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-asm] [rsaref]
-#         [386] platform[:flags]
-#
+
+my $usage="Usage: Configure [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-asm] [rsaref] [--openssldir=OPENSSLDIR] [--prefix=DIR] os/compiler\n";
+
 # Options:
 # Options:
+# --openssldir  install OpenSSL in OPENSSLDIR (Default: DIR/ssl if the
+#               --prefix option is given; /usr/local/ssl otherwise)
+# --prefix      prefix for the OpenSSL include, lib and bin directories
+#               (Default: the OPENSSLDIR directory)
 # rsaref        use RSAref
 # no-asm        do not use assembler
 # 386           generate 80386 code
 # rsaref        use RSAref
 # no-asm        do not use assembler
 # 386           generate 80386 code
@@ -113,8 +116,8 @@ my %table=(
 "solaris-usparc-sc4","cc:-xtarget=ultra -xarch=v8plus -Xa -xO5 -DB_ENDIAN:\
        -lsocket -lnsl:\
        BN_LLONG RC4_CHAR DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8.o::",
 "solaris-usparc-sc4","cc:-xtarget=ultra -xarch=v8plus -Xa -xO5 -DB_ENDIAN:\
        -lsocket -lnsl:\
        BN_LLONG RC4_CHAR DES_PTR DES_RISC1 DES_UNROLL BF_PTR:asm/sparcv8.o::",
-"solaris-sparc-sc4-pic","cc:-xO5 -Xa -DB_ENDIAN -KPIC:-lsocket -lnsl:\
-       BN_LLONG RC4_CHAR DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::",
+#"solaris-sparc-sc4-pic","cc:-xO5 -Xa -DB_ENDIAN -KPIC:-lsocket -lnsl:\
+#      BN_LLONG RC4_CHAR DES_PTR DES_RISC1 DES_UNROLL BF_PTR:::",
 
 # Sunos configs, assuming sparc for the gcc one.
 ##"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::DES_UNROLL:::",
 
 # Sunos configs, assuming sparc for the gcc one.
 ##"sunos-cc", "cc:-O4 -DNOPROTO -DNOCONST::DES_UNROLL:::",
@@ -249,6 +252,8 @@ my %table=(
 my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
        BC-16 CygWin32);
 
 my @WinTargets=qw(VC-NT VC-WIN32 VC-WIN16 VC-W31-16 VC-W31-32 VC-MSDOS BC-32
        BC-16 CygWin32);
 
+my $installprefix="";
+my $openssldir="";
 my $no_asm=0;
 my $Makefile="Makefile.ssl";
 my $des_locl="crypto/des/des_locl.h";
 my $no_asm=0;
 my $Makefile="Makefile.ssl";
 my $des_locl="crypto/des/des_locl.h";
@@ -276,43 +281,43 @@ my $perl;
 $ranlib=&which("ranlib") or $ranlib="true";
 $perl=&which("perl5") or $perl=&which("perl");
 
 $ranlib=&which("ranlib") or $ranlib="true";
 $perl=&which("perl5") or $perl=&which("perl");
 
-if ($#ARGV < 0)
-       {
-       &bad_target;
-       exit(1);
-       }
+&usage if ($#ARGV < 0);
 
 my $flags="";
 my $libs="";
 my $target="";
 foreach (@ARGV)
        {
 
 my $flags="";
 my $libs="";
 my $target="";
 foreach (@ARGV)
        {
-       if ($_ =~ /^no-asm$/)
+       if (/^no-asm$/)
                { $no_asm=1; }
                { $no_asm=1; }
-       elsif ($_ =~ /^386$/)
+       elsif (/^386$/)
                { $processor=386; }
                { $processor=386; }
-       elsif ($_ =~ /^rsaref$/)
+       elsif (/^rsaref$/)
                {
                $libs.= "-lRSAglue -lrsaref ";
                $flags.= "-DRSAref ";
                }
                {
                $libs.= "-lRSAglue -lrsaref ";
                $flags.= "-DRSAref ";
                }
-       elsif ($_ =~ /^-/)
+       elsif (/^-/)
                {
                {
-               if ($_ =~ /^-[lL](.*)$/)
+               if (/^-[lL](.*)$/)
                        {
                        $libs.=$_." ";
                        }
                        {
                        $libs.=$_." ";
                        }
-               elsif ($_ =~ /^-D(.*)$/)
+               elsif (/^-[DfK](.*)$/)
                        {
                        $flags.=$_." ";
                        }
                        {
                        $flags.=$_." ";
                        }
-               elsif ($_ =~ /^-[fK](.*)$/)
+               elsif (/^--prefix=(.*)$/)
                        {
                        {
-                       $flags.=$_." ";
+                       $installprefix=$1;
+                       }
+               elsif (/^--openssldir=(.*)$/)
+                       {
+                       $openssldir=$1;
                        }
                else
                        {
                        }
                else
                        {
-                       die "unknown options, only -Dxxx, -Lxxx, -lxxx, -fxxx and -Kxxx are supported\n";
+                       print STDERR $usage;
                        }
                }
        elsif ($_ =~ /^([^:]+):(.+)$/) {
                        }
                }
        elsif ($_ =~ /^([^:]+):(.+)$/) {
@@ -323,19 +328,19 @@ foreach (@ARGV)
                {
                die "target already defined - $target\n" if ($target ne "");
                $target=$_;
                {
                die "target already defined - $target\n" if ($target ne "");
                $target=$_;
-               if (!defined($table{$target}))
-                       {
-                       &bad_target;
-                       exit(1);
-                       }
                }
                }
-       }
+}
 
 
-if (!defined($table{$target}))
-       {
-       &bad_target;
-       exit(1);
-       }
+&usage if (!defined($table{$target}));
+
+$openssldir="/usr/local/ssl" if ($openssldir eq "" and $installprefix eq "");
+$installprefix=$openssldir if $installprefix eq "";
+
+chop $openssldir if $openssldir =~ /\/$/;
+chop $installprefix if $installprefix =~ /\/$/;
+
+$openssldir=$installprefix . "/ssl" if $openssldir eq "";
+$openssldir=$installprefix . "/" . $openssldir if $openssldir !~ /^\//;
 
 my $IsWindows=scalar grep /^$target$/,@WinTargets;
 
 
 my $IsWindows=scalar grep /^$target$/,@WinTargets;
 
@@ -386,6 +391,8 @@ open(OUT,">$Makefile") || die "unable to create $Makefile:$!\n";
 while (<IN>)
        {
        chop;
 while (<IN>)
        {
        chop;
+       s/^INSTALLTOP=.*$/INSTALLTOP=$installprefix/;
+       s/^OPENSSLDIR=.*$/OPENSSLDIR=$openssldir/;
        s/^PLATFORM=.*$/PLATFORM=$target/;
        s/^CC=.*$/CC= $cc/;
        s/^CFLAG=.*$/CFLAG= $cflags/;
        s/^PLATFORM=.*$/PLATFORM=$target/;
        s/^CC=.*$/CC= $cc/;
        s/^CFLAG=.*$/CFLAG= $cflags/;
@@ -470,7 +477,9 @@ open(IN,'<crypto/opensslconf.h.in') || die "unable to read crypto/opensslconf.h.
 open(OUT,'>crypto/opensslconf.h') || die "unable to create crypto/opensslconf.h:$!\n";
 while (<IN>)
        {
 open(OUT,'>crypto/opensslconf.h') || die "unable to create crypto/opensslconf.h:$!\n";
 while (<IN>)
        {
-       if      (/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
+       if      (/^#defined\s+OPENSSLDIR/)
+               { print OUT "#define OPENSSLDIR $openssldir\n"; }
+       elsif   (/^#((define)|(undef))\s+SIXTY_FOUR_BIT_LONG/)
                { printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; }
        elsif   (/^#((define)|(undef))\s+SIXTY_FOUR_BIT/)
                { printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; }
                { printf OUT "#%s SIXTY_FOUR_BIT_LONG\n",($b64l)?"define":"undef"; }
        elsif   (/^#((define)|(undef))\s+SIXTY_FOUR_BIT/)
                { printf OUT "#%s SIXTY_FOUR_BIT\n",($b64)?"define":"undef"; }
@@ -540,7 +549,13 @@ if($IsWindows) {
        close(OUT);
 }
 
        close(OUT);
 }
 
-system 'make -f Makefile.ssl links' if !$IsWindows;
+if (!$IsWindows)
+       {
+       (system 'make -f Makefile.ssl links') == 0 or exit $?;
+       }
+
+&dofile("tools/c_rehash",$openssldir,'^DIR=',  'DIR=%s',);
+&dofile("util/mk1mf.pl",$openssldir,('^\$INSTALLTOP=','$INSTALLTOP="%s";',));
 
 my $pwd=`pwd`;
 chop($pwd);
 
 my $pwd=`pwd`;
 chop($pwd);
@@ -557,7 +572,7 @@ conflicts with other libraries.
 
 To compile programs that use the old form <foo.h>,
 usually an additional compiler option will suffice: E.g., add
 
 To compile programs that use the old form <foo.h>,
 usually an additional compiler option will suffice: E.g., add
-     -I/usr/local/ssl/include/openssl
+     -I$installprefix/include/openssl
 or
      -I$pwd/include/openssl
 to the CFLAGS in the Makefile of the program that you want to compile
 or
      -I$pwd/include/openssl
 to the CFLAGS in the Makefile of the program that you want to compile
@@ -570,18 +585,26 @@ EOF
 
 exit(0);
 
 
 exit(0);
 
-sub bad_target
+sub usage
        {
        {
-       print STDERR "Usage: Configure [-Dxxx] [-Lxxx] [-lxxx] [no-asm] [rsaref] os/compiler\n";
+       print STDERR $usage;
        print STDERR "pick os/compiler from:";
        my $j=0;
        my $i;
        foreach $i (sort keys %table)
                {
        print STDERR "pick os/compiler from:";
        my $j=0;
        my $i;
        foreach $i (sort keys %table)
                {
+               next if $i =~ /^debug/;
+               print STDERR "\n" if ($j++ % 4) == 0;
+               printf(STDERR "%-18s ",$i);
+               }
+       foreach $i (sort keys %table)
+               {
+               next if $i !~ /^debug/;
                print STDERR "\n" if ($j++ % 4) == 0;
                printf(STDERR "%-18s ",$i);
                }
        print STDERR "\n";
                print STDERR "\n" if ($j++ % 4) == 0;
                printf(STDERR "%-18s ",$i);
                }
        print STDERR "\n";
+       exit(1);
        }
 
 sub which
        }
 
 sub which
@@ -598,3 +621,22 @@ sub which
                }
        }
 
                }
        }
 
+sub dofile
+       {
+       my $f; my $p; my %m; my @a; my $k; my $ff;
+       ($f,$p,%m)=@_;
+
+       open(IN,"<$f") || die "unable to open $f:$!\n";
+       @a=<IN>;
+       close(IN);
+       foreach $k (keys %m)
+               {
+               grep(/$k/ && ($_=sprintf($m{$k}."\n",$p)),@a);
+               }
+       ($ff=$f) =~ s/\..*$//;
+       open(OUT,">$ff.new") || die "unable to open $f:$!\n";
+       print OUT @a;
+       close(OUT);
+       rename($f,"$ff.bak") || die "unable to rename $f\n";
+       rename("$ff.new",$f) || die "unable to rename $ff.new\n";
+       }
diff --git a/INSTALL b/INSTALL
index e5388b16cd97d2b9b2dd151b4fe0e81d2cc72b98..69599bc07a9ec904c9d84b99ac4850753e238ed6 100644 (file)
--- a/INSTALL
+++ b/INSTALL
 
  This will build and install OpenSSL in the default location, which is (for
  historical reasons) /usr/local/ssl. If you want to install it anywhere else,
 
  This will build and install OpenSSL in the default location, which is (for
  historical reasons) /usr/local/ssl. If you want to install it anywhere else,
do this after running `./config':
run config like this:
 
 
-  $ perl util/ssldir.pl /new/install/path
+  $ ./config --prefix=/usr/local --openssldir=/usr/local/openssl
 
  There are several options to ./config to customize the build:
 
 
  There are several options to ./config to customize the build:
 
-  rsaref    Build with RSADSI's RSAREF toolkit.
-  no-asm    Build with no assembler code.
-  386       Use the 80386 instruction set only (the default x86 code is
-            more efficient, but requires at least a 486).
+  --prefix=DIR  Install in DIR/bin, DIR/lib, DIR/include. Configuration
+                files used by OpenSSL will be in DIR/ssl or the directory
+                specified by --openssldir.
+
+  --openssldir=DIR Directory for OpenSSL files. If no prefix is specified,
+                the library files and binaries are also installed there.
+
+  rsaref        Build with RSADSI's RSAREF toolkit.
+
+  no-asm        Build with no assembler code.
+
+  386           Use the 80386 instruction set only (the default x86 code is
+                more efficient, but requires at least a 486).
 
  If anything goes wrong, follow the detailed instructions below. If your
  operating system is not (yet) supported by OpenSSL, see the section on
 
  If anything goes wrong, follow the detailed instructions below. If your
  operating system is not (yet) supported by OpenSSL, see the section on
@@ -46,8 +55,8 @@
        $ ./config
 
      This guesses at your operating system (and compiler, if necessary) and
        $ ./config
 
      This guesses at your operating system (and compiler, if necessary) and
-     configures OpenSSL based on this guess. Check the first line of output to
-     see if it guessed correctly. If it did not get it correct or you want to
+     configures OpenSSL based on this guess. Run ./config -t -v to see
+     if it guessed correctly. If it did not get it correct or you want to
      use a different compiler then go to step 1b. Otherwise go to step 2.
 
  1b. Configure OpenSSL for your operating system manually
      use a different compiler then go to step 1b. Otherwise go to step 2.
 
  1b. Configure OpenSSL for your operating system manually
@@ -63,7 +72,7 @@
      as the argument to ./Configure. For example, a "linux-elf" user would
      run:
 
      as the argument to ./Configure. For example, a "linux-elf" user would
      run:
 
-       $ ./Configure linux-elf
+       $ ./Configure linux-elf [--prefix=DIR] [--openssldir=OPENSSLDIR]
 
      If your system is not available, you will have to edit the Configure
      program and add the correct configuration for your system.
 
      If your system is not available, you will have to edit the Configure
      program and add the correct configuration for your system.
      various macros in crypto/opensslconf.h (generated from
      crypto/opensslconf.h.in).
 
      various macros in crypto/opensslconf.h (generated from
      crypto/opensslconf.h.in).
 
-  2. Set the install directory
-
-     If the install directory will be the default of /usr/local/ssl, skip to
-     the next stage. Otherwise, run
-
-        $ perl util/ssldir.pl /new/install/path
-
-     This configures the installation location into the "install" target of
-     the top-level Makefile, and also updates some defines in an include file
-     so that the default certificate directory is under the proper
-     installation directory. It also updates a few utility files used in the
-     build process.
-
-  3. Build OpenSSL by running:
+  2. Build OpenSSL by running:
 
        $ make
 
 
        $ make
 
@@ -93,7 +89,7 @@
      OpenSSL binary ("openssl"). The libraries will be built in the top-level
      directory, and the binary will be in the "apps" directory.
 
      OpenSSL binary ("openssl"). The libraries will be built in the top-level
      directory, and the binary will be in the "apps" directory.
 
-  4. After a successful build, the libraries should be tested. Run:
+  3. After a successful build, the libraries should be tested. Run:
 
        $ make rehash
        $ make test
 
        $ make rehash
        $ make test
      (The first line makes the test certificates in the "certs" directory
      accessable via an hash name, which is required for some of the tests).
 
      (The first line makes the test certificates in the "certs" directory
      accessable via an hash name, which is required for some of the tests).
 
-  5. If everything tests ok, install OpenSSL with
+  4. If everything tests ok, install OpenSSL with
 
        $ make install
 
      This will create the installation directory (if it does not exist) and
      then create the following subdirectories:
 
 
        $ make install
 
      This will create the installation directory (if it does not exist) and
      then create the following subdirectories:
 
-       bin            Contains the openssl binary and a few other 
-                      utility programs. 
-       include        Contains the header files needed if you want to
-                      compile programs with libcrypto or libssl.
-       lib            Contains the library files themselves and the
-                      OpenSSL configuration file "openssl.cnf".
-       certs          Initially empty, this is the default location
-                      for certificate files.
-       private        Initially empty, this is the default location
-                      for private key files.
+       certs           Initially empty, this is the default location
+                       for certificate files.
+       private         Initially empty, this is the default location
+                       for private key files.
+       lib             Contains the OpenSSL configuration file "openssl.cnf".
+
+     If you didn't chose a different installation prefix, lib also contains
+     the library files themselves, and the following additional subdirectories
+     will be created:
 
 
+       bin             Contains the openssl binary and a few other 
+                       utility programs. 
+       include/openssl Contains the header files needed if you want to
+                       compile programs with libcrypto or libssl.
 
   NOTE: The header files used to reside directly in the include
   directory, but have now been moved to include/openssl so that
 
   NOTE: The header files used to reside directly in the include
   directory, but have now been moved to include/openssl so that
index 0e9dfa35b5a4495515ff7b3fba8b2b23903551cd..869fe8cc5a387d780ef686ef085efd54c8741fed 100644 (file)
@@ -4,6 +4,10 @@
 
 VERSION = 0.9.2b
 PLATFORM=dist
 
 VERSION = 0.9.2b
 PLATFORM=dist
+INSTALLTOP=/usr/local/ssl
+
+# Do not edit this manually. Use Configure --openssldir=DIR do change this!
+OPENSSLDIR=/usr/local/ssl
 
 # RSAref  - Define if we are to link with RSAref.
 # NO_IDEA - Define to build without the IDEA algorithm
 
 # RSAref  - Define if we are to link with RSAref.
 # NO_IDEA - Define to build without the IDEA algorithm
@@ -139,9 +143,6 @@ SDIRS=  \
        buffer bio stack lhash rand err objects \
        evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp
 
        buffer bio stack lhash rand err objects \
        evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp
 
-# Do not edit this manually. Use util/ssldir.pl do change this!
-INSTALLTOP=/usr/local/ssl
-
 MAKEFILE= Makefile.ssl
 MAKE=     make -f Makefile.ssl
 
 MAKEFILE= Makefile.ssl
 MAKE=     make -f Makefile.ssl
 
@@ -286,14 +287,14 @@ dist_pem_h:
 install: all
        @-mkdir -p $(INSTALLTOP)/bin 2>/dev/null
        @-mkdir -p $(INSTALLTOP)/lib 2>/dev/null
 install: all
        @-mkdir -p $(INSTALLTOP)/bin 2>/dev/null
        @-mkdir -p $(INSTALLTOP)/lib 2>/dev/null
-       @-mkdir -p $(INSTALLTOP)/include 2>/dev/null
        @-mkdir -p $(INSTALLTOP)/include/openssl 2>/dev/null
        @-mkdir -p $(INSTALLTOP)/include/openssl 2>/dev/null
-       @-mkdir -p $(INSTALLTOP)/certs 2>/dev/null
-       @-mkdir -p $(INSTALLTOP)/private 2>/dev/null
+       @-mkdir -p $(OPENSSLDIR)/certs 2>/dev/null
+       @-mkdir -p $(OPENSSLDIR)/private 2>/dev/null
+       @-mkdir -p $(OPENSSLDIR)/lib 2>/dev/null
        @for i in $(DIRS) ;\
        do \
        (cd $$i; echo "installing $$i..."; \
        @for i in $(DIRS) ;\
        do \
        (cd $$i; echo "installing $$i..."; \
-       $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' install ); \
+       $(MAKE) CC='${CC}' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' OPENSSLDIR='${OPENSSLDIR}' EX_LIBS='${EX_LIBS}' SDIRS='${SDIRS}' install ); \
        done
        @for i in $(LIBS) ;\
        do \
        done
        @for i in $(LIBS) ;\
        do \
diff --git a/config b/config
index a6633a7055692910e2beb6468ecd352c9a3a2ed3..2d9da43ec3c5456cbb526010d85ce3a8ec53a568 100755 (executable)
--- a/config
+++ b/config
@@ -268,11 +268,7 @@ Usage: config [options]
  -h    This help.
 
 Any other text will be passed to the Configure perl script.
  -h    This help.
 
 Any other text will be passed to the Configure perl script.
-Useful options include
- no-asm Build with no assember code.
- -Dxxx Add xxx define to compilation.
- -Lxxx Add xxx library include path to build.
- -lxxx Add xxx library to build.
+See INSTALL for instructions.
 
 EOF
 ;;
 
 EOF
 ;;