ui_compat.h was forgotten in the "symlinking" routine.

$!
$! MAKEVMS.COM
$! Original Author:  UNKNOWN
$! Rewritten By:  Robert Byer
$!                Vice-President
$!                A-Com Computing, Inc.
$!                byer@mail.all-net.net
$!
$! Changes by Richard Levitte <richard@levitte.org>
$!
$! This procedure creates the SSL libraries of "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB"
$! "[.xxx.EXE.SSL]LIBSSL.OLB" and if specified "[.xxx.EXE.RSAREF]LIBRSAGLUE.OLB".
$! The "xxx" denotes the machine architecture of AXP or VAX.
$!
$! This procedures accepts two command line options listed below.
$!
$! Specify one of the following build options for P1.
$!
$!      ALL       Just build "everything".
$!      CONFIG    Just build the "[.CRYPTO]OPENSSLCONF.H" file.
$!      BUILDINF  Just build the "[.CRYPTO]BUILDINF.H" file.
$!      SOFTLINKS Just fix the Unix soft links.
$!      BUILDALL  Same as ALL, except CONFIG, BUILDINF and SOFTILNKS aren't done.
$!      RSAREF    Just build the "[.xxx.EXE.RSAREF]LIBRSAGLUE.OLB" library.
$!      CRYPTO    Just build the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" library.
$!      CRYPTO/x  Just build the x part of the
$!                "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" library.
$!      SSL       Just build the "[.xxx.EXE.SSL]LIBSSL.OLB" library.
$!      SSL_TASK  Just build the "[.xxx.EXE.SSL]SSL_TASK.EXE" program.
$!      TEST      Just build the "[.xxx.EXE.TEST]" test programs for OpenSSL.
$!      APPS      Just build the "[.xxx.EXE.APPS]" application programs for OpenSSL.
$!
$!
$! Specify RSAREF as P2 to compile using the RSAREF Library.
$! If you specify NORSAREF, it will compile without using RSAREF.
$! (If in the United States, You Must Compile Using RSAREF).
$!
$! Note: The RSAREF libraries are NOT INCLUDED and you have to
$!       download it from "ftp://ftp.rsa.com/rsaref".  You have to
$!       get the ".tar-Z" file as the ".zip" file dosen't have the
$!       directory structure stored.  You have to extract the file
$!       into the [.RSAREF] directory as that is where the scripts
$!       will look for the files.
$!
$! Speficy DEBUG or NODEBUG as P3 to compile with or without debugging
$! information.
$!
$! Specify which compiler at P4 to try to compile under.
$!
$!	  VAXC	 For VAX C.
$!	  DECC	 For DEC C.
$!	  GNUC	 For GNU C.
$!	  LINK   To only link the programs from existing object files.
$!               (not yet implemented)
$!
$! If you don't speficy a compiler, it will try to determine which
$! "C" compiler to use.
$!
$!  P5, if defined, sets a TCP/IP library to use, through one of the following
$!  keywords:
$!
$!	UCX		for UCX or UCX emulation
$!	SOCKETSHR	for SOCKETSHR+NETLIB
$!
$! P6, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
$!
$!
$! Check if we're in a batch job, and make sure we get to
$! the directory this script is in
$!
$ IF F$MODE() .EQS. "BATCH"
$ THEN
$   COMNAME=F$ENVIRONMENT("PROCEDURE")
$   COMPATH=F$PARSE("A.;",COMNAME) - "A.;"
$   SET DEF 'COMPATH'
$ ENDIF
$!
$! Check Which Architecture We Are Using.
$!
$ IF (F$GETSYI("CPU").GE.128)
$ THEN
$!
$!  The Architecture Is AXP.
$!
$   ARCH := AXP
$!
$! Else...
$!
$ ELSE
$!
$!  The Architecture Is VAX.
$!
$   ARCH := VAX
$!
$! End The Architecture Check.
$!
$ ENDIF
$!
$! Check To Make Sure We Have Valid Command Line Parameters.
$!
$ GOSUB CHECK_OPTIONS
$!
$! Check To See What We Are To Do.
$!
$ IF (BUILDCOMMAND.EQS."ALL")
$ THEN
$!
$!  Start with building the OpenSSL configuration file.
$!
$   GOSUB CONFIG
$!
$!  Create The "BUILDINF.H" Include File.
$!
$   GOSUB BUILDINF
$!
$!  Fix The Unix Softlinks.
$!
$   GOSUB SOFTLINKS
$!
$ ENDIF
$!
$ IF (BUILDCOMMAND.EQS."ALL".OR.BUILDCOMMAND.EQS."BUILDALL")
$ THEN
$!
$!  Check To See If We Are Going To Be Building The
$!  [.xxx.EXE.RSAREF]LIBRSAGLUE.OLB Library.
$!
$   IF (RSAREF.EQS."RSAREF")
$   THEN
$!
$!    Build The [.xxx.EXE.RSAREF]LIBRSAGLUE.OLB Library.
$!
$     GOSUB RSAREF
$!
$!  End The RSAREF Check.
$!
$   ENDIF
$!
$!  Build The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library.
$!
$   GOSUB CRYPTO
$!
$!  Build The [.xxx.EXE.SSL]LIBSSL.OLB Library.
$!
$   GOSUB SSL
$!
$!  Build The [.xxx.EXE.SSL]SSL_TASK.EXE DECNet SSL Engine.
$!
$   GOSUB SSL_TASK
$!
$!  Build The [.xxx.EXE.TEST] OpenSSL Test Utilities.
$!
$   GOSUB TEST
$!
$!  Build The [.xxx.EXE.APPS] OpenSSL Application Utilities.
$!
$   GOSUB APPS
$!
$! Else...
$!
$ ELSE
$!
$!    Build Just What The User Wants Us To Build.
$!
$     GOSUB 'BUILDCOMMAND'
$!
$ ENDIF
$!
$! Time To EXIT.
$!
$ EXIT
$!
$! Rebuild The "[.CRYPTO]OPENSSLCONF.H" file.
$!
$ CONFIG:
$!
$! Tell The User We Are Creating The [.CRYPTO]OPENSSLCONF.H File.
$!
$ WRITE SYS$OUTPUT "Creating [.CRYPTO]OPENSSLCONF.H Include File."
$!
$! Create The [.CRYPTO]OPENSSLCONF.H File.
$!
$ OPEN/WRITE H_FILE SYS$DISK:[.CRYPTO]OPENSSLCONF.H
$!
$! Write The [.CRYPTO]OPENSSLCONF.H File.
$!
$ WRITE H_FILE "/* This file was automatically built using makevms.com */"
$ WRITE H_FILE "/* and [.CRYPTO]OPENSSLCONF.H_IN */"
$
$!
$! Write a few macros that indicate how this system was built.
$!
$ WRITE H_FILE ""
$ WRITE H_FILE "#ifndef OPENSSL_SYS_VMS"
$ WRITE H_FILE "# define OPENSSL_SYS_VMS"
$ WRITE H_FILE "#endif"
$ CONFIG_LOGICALS := NO_ASM,NO_RSA,NO_DSA,NO_DH,NO_MD2,NO_MD5,NO_RIPEMD,-
	NO_SHA,NO_SHA0,NO_SHA1,NO_DES/NO_MDC2;NO_MDC2,NO_RC2,NO_RC4,NO_RC5,-
	NO_IDEA,NO_BF,NO_CAST,NO_HMAC,NO_SSL2
$ CONFIG_LOG_I = 0
$ CONFIG_LOG_LOOP:
$   CONFIG_LOG_E1 = F$ELEMENT(CONFIG_LOG_I,",",CONFIG_LOGICALS)
$   CONFIG_LOG_I = CONFIG_LOG_I + 1
$   IF CONFIG_LOG_E1 .EQS. "" THEN GOTO CONFIG_LOG_LOOP
$   IF CONFIG_LOG_E1 .EQS. "," THEN GOTO CONFIG_LOG_LOOP_END
$   CONFIG_LOG_E2 = F$EDIT(CONFIG_LOG_E1,"TRIM")
$   CONFIG_LOG_E1 = F$ELEMENT(0,";",CONFIG_LOG_E2)
$   CONFIG_LOG_E2 = F$ELEMENT(1,";",CONFIG_LOG_E2)
$   CONFIG_LOG_E0 = F$ELEMENT(0,"/",CONFIG_LOG_E1)
$   CONFIG_LOG_E1 = F$ELEMENT(1,"/",CONFIG_LOG_E1)
$   IF F$TRNLNM("OPENSSL_"+CONFIG_LOG_E0)
$   THEN
$     WRITE H_FILE "#ifndef OPENSSL_",CONFIG_LOG_E0
$     WRITE H_FILE "# define OPENSSL_",CONFIG_LOG_E0
$     WRITE H_FILE "#endif"
$     IF CONFIG_LOG_E1 .NES. "/"
$     THEN
$       WRITE H_FILE "#ifndef OPENSSL_",CONFIG_LOG_E1
$       WRITE H_FILE "# define OPENSSL_",CONFIG_LOG_E1
$       WRITE H_FILE "#endif"
$     ENDIF
$   ELSE
$     IF CONFIG_LOG_E2 .NES. ";"
$     THEN
$       IF F$TRNLNM("OPENSSL_"+CONFIG_LOG_E2)
$       THEN
$         WRITE H_FILE "#ifndef OPENSSL_",CONFIG_LOG_E2
$         WRITE H_FILE "# define OPENSSL_",CONFIG_LOG_E2
$         WRITE H_FILE "#endif"
$       ENDIF
$     ENDIF
$   ENDIF
$   GOTO CONFIG_LOG_LOOP
$ CONFIG_LOG_LOOP_END:
$ WRITE H_FILE "#ifndef OPENSSL_THREADS"
$ WRITE H_FILE "# define OPENSSL_THREADS"
$ WRITE H_FILE "#endif"
$ WRITE H_FILE "#ifndef OPENSSL_NO_KRB5"
$ WRITE H_FILE "# define OPENSSL_NO_KRB5"
$ WRITE H_FILE "#endif"
$ WRITE H_FILE ""
$!
$! Different tar version may have named the file differently
$ IF F$SEARCH("[.CRYPTO]OPENSSLCONF.H_IN") .NES. ""
$ THEN
$   TYPE [.CRYPTO]OPENSSLCONF.H_IN /OUTPUT=H_FILE:
$ ELSE
$   IF F$SEARCH("[.CRYPTO]OPENSSLCONF_H.IN") .NES. ""
$   THEN
$     TYPE [.CRYPTO]OPENSSLCONF_H.IN /OUTPUT=H_FILE:
$   ELSE
$     WRITE SYS$ERROR "Couldn't find a [.CRYPTO]OPENSSLCONF.H_IN.  Exiting!"
$     EXIT 0
$   ENDIF
$ ENDIF
$ IF ARCH .EQS. "AXP"
$ THEN
$!
$!  Write the Alpha specific data
$!
$   WRITE H_FILE "#if defined(HEADER_RC4_H)"
$   WRITE H_FILE "#undef RC4_INT"
$   WRITE H_FILE "#define RC4_INT unsigned int"
$   WRITE H_FILE "#undef RC4_CHUNK"
$   WRITE H_FILE "#define RC4_CHUNK unsigned long long"
$   WRITE H_FILE "#endif"
$!
$   WRITE H_FILE "#if defined(HEADER_DES_LOCL_H)"
$   WRITE H_FILE "#undef DES_LONG"
$   WRITE H_FILE "#define DES_LONG unsigned int"
$   WRITE H_FILE "#undef DES_PTR"
$   WRITE H_FILE "#define DES_PTR"
$   WRITE H_FILE "#undef DES_RISC1"
$   WRITE H_FILE "#undef DES_RISC2"
$   WRITE H_FILE "#define DES_RISC1"
$   WRITE H_FILE "#undef DES_UNROLL"
$   WRITE H_FILE "#define DES_UNROLL"
$   WRITE H_FILE "#endif"
$!
$   WRITE H_FILE "#if defined(HEADER_BN_H)"
$   WRITE H_FILE "#undef SIXTY_FOUR_BIT_LONG"
$   WRITE H_FILE "#undef SIXTY_FOUR_BIT"
$   WRITE H_FILE "#define SIXTY_FOUR_BIT"
$   WRITE H_FILE "#undef THIRTY_TWO_BIT"
$   WRITE H_FILE "#undef SIXTEEN_BIT"
$   WRITE H_FILE "#undef EIGHT_BIT"
$   WRITE H_FILE "#endif"
$
$   WRITE H_FILE "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION"
$!
$!  Else...
$!
$ ELSE
$!
$!  Write the VAX specific data
$!
$   WRITE H_FILE "#if defined(HEADER_RC4_H)"
$   WRITE H_FILE "#undef RC4_INT"
$   WRITE H_FILE "#define RC4_INT unsigned char"
$   WRITE H_FILE "#undef RC4_CHUNK"
$   WRITE H_FILE "#define RC4_CHUNK unsigned long"
$   WRITE H_FILE "#endif"
$!
$   WRITE H_FILE "#if defined(HEADER_DES_LOCL_H)"
$   WRITE H_FILE "#undef DES_LONG"
$   WRITE H_FILE "#define DES_LONG unsigned long"
$   WRITE H_FILE "#undef DES_PTR"
$   WRITE H_FILE "#define DES_PTR"
$   WRITE H_FILE "#undef DES_RISC1"
$   WRITE H_FILE "#undef DES_RISC2"
$   WRITE H_FILE "#undef DES_UNROLL"
$   WRITE H_FILE "#endif"
$!
$   WRITE H_FILE "#if defined(HEADER_BN_H)"
$   WRITE H_FILE "#undef SIXTY_FOUR_BIT_LONG"
$   WRITE H_FILE "#undef SIXTY_FOUR_BIT"
$   WRITE H_FILE "#undef THIRTY_TWO_BIT"
$   WRITE H_FILE "#define THIRTY_TWO_BIT"
$   WRITE H_FILE "#undef SIXTEEN_BIT"
$   WRITE H_FILE "#undef EIGHT_BIT"
$   WRITE H_FILE "#endif"
$
$   WRITE H_FILE "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION"
$   WRITE H_FILE "#define OPENSSL_EXPORT_VAR_AS_FUNCTION"
$!
$!  End
$!
$ ENDIF
$!
$! Close the [.CRYPTO]OPENSSLCONF.H file
$!
$ CLOSE H_FILE
$!
$! That's All, Time To RETURN.
$!
$ RETURN
$!
$! Rebuild The "[.CRYPTO]BUILDINF.H" file.
$!
$ BUILDINF:
$!
$! Tell The User We Are Creating The [.CRYPTO]BUILDINF.H File.
$!
$ WRITE SYS$OUTPUT "Creating [.CRYPTO]BUILDINF.H Include File."
$!
$! Create The [.CRYPTO]BUILDINF.H File.
$!
$ OPEN/WRITE H_FILE SYS$DISK:[.CRYPTO]BUILDINF.H
$!
$! Get The Current Date & Time.
$!
$ TIME = F$TIME()
$!
$! Write The [.CRYPTO]BUILDINF.H File.
$!
$ WRITE H_FILE "#define CFLAGS """" /* Not filled in for now */"
$ WRITE H_FILE "#define PLATFORM ""VMS"""
$ WRITE H_FILE "#define DATE ""''TIME'"" "
$!
$! Close The [.CRYPTO]BUILDINF.H File.
$!
$ CLOSE H_FILE
$!
$! That's All, Time To RETURN.
$!
$ RETURN
$!
$! Copy a lot of files around.
$!
$ SOFTLINKS:
$!
$! Tell The User We Are Partly Rebuilding The [.TEST] Directory.
$!
$ WRITE SYS$OUTPUT "Rebuilding The '[.APPS]MD5.C' And '[.APPS]RMD160.C' Files."
$!
$ DELETE SYS$DISK:[.APPS]MD4.C;*,MD5.C;*,RMD160.C;*
$!
$! Copy MD4.C from [.CRYPTO.MD4] into [.APPS]
$!
$ COPY SYS$DISK:[.CRYPTO.MD4]MD4.C SYS$DISK:[.APPS]
$!
$! Copy MD5.C from [.CRYPTO.MD5] into [.APPS]
$!
$ COPY SYS$DISK:[.CRYPTO.MD5]MD5.C SYS$DISK:[.APPS]
$!
$! Copy RMD160.C from [.CRYPTO.RIPEMD] into [.APPS]
$!
$ COPY SYS$DISK:[.CRYPTO.RIPEMD]RMD160.C SYS$DISK:[.APPS]
$!
$! Tell The User We Are Partly Rebuilding The [.TEST] Directory.
$!
$ WRITE SYS$OUTPUT "Rebuilding The '[.TEST]*.C' Files."
$!
$! First, We Have To "Rebuild" The "[.TEST]" Directory, So Delete
$! All The "C" Files That Are Currently There Now.
$!
$ DELETE SYS$DISK:[.TEST]*.C;*
$!
$! Copy all the *TEST.C files from [.CRYPTO...] into [.TEST]
$!
$ COPY SYS$DISK:[.CRYPTO.*]%*TEST.C SYS$DISK:[.TEST]
$!
$! Copy all the *TEST.C files from [.SSL...] into [.TEST]
$!
$ COPY SYS$DISK:[.SSL]%*TEST.C SYS$DISK:[.TEST]
$!
$! Tell The User We Are Rebuilding The [.INCLUDE.OPENSSL] Directory.
$!
$ WRITE SYS$OUTPUT "Rebuilding The '[.INCLUDE.OPENSSL]' Directory."
$!
$! First, make sure the directory exists
$!
$ IF F$PARSE("SYS$DISK:[.INCLUDE.OPENSSL]") .EQS. "" THEN -
     CREATE/DIRECTORY SYS$DISK:[.INCLUDE.OPENSSL]
$!
$! Copy All The ".H" Files From The Main Directory.
$!
$ EXHEADER := e_os2.h
$ COPY 'EXHEADER' SYS$DISK:[.INCLUDE.OPENSSL]
$!
$! Copy All The ".H" Files From The [.CRYPTO] Directory Tree.
$!
$ SDIRS := ,MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,-
   DES,RC2,RC4,RC5,IDEA,BF,CAST,-
   BN,EC,RSA,DSA,DH,DSO,ENGINE,RIJNDAEL,-
   BUFFER,BIO,STACK,LHASH,RAND,ERR,OBJECTS,-
   EVP,ASN1,PEM,X509,X509V3,CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,UI
$ EXHEADER_ := crypto.h,tmdiff.h,opensslv.h,opensslconf.h,ebcdic.h,symhacks.h
$ EXHEADER_MD2 := md2.h
$ EXHEADER_MD4 := md4.h
$ EXHEADER_MD5 := md5.h
$ EXHEADER_SHA := sha.h
$ EXHEADER_MDC2 := mdc2.h
$ EXHEADER_HMAC := hmac.h
$ EXHEADER_RIPEMD := ripemd.h
$ EXHEADER_DES := des.h
$ EXHEADER_RC2 := rc2.h
$ EXHEADER_RC4 := rc4.h
$ EXHEADER_RC5 := rc5.h
$ EXHEADER_IDEA := idea.h
$ EXHEADER_BF := blowfish.h
$ EXHEADER_CAST := cast.h
$ EXHEADER_BN := bn.h
$ EXHEADER_EC := ec.h
$ EXHEADER_RSA := rsa.h
$ EXHEADER_DSA := dsa.h
$ EXHEADER_DH := dh.h
$ EXHEADER_DSO := dso.h
$ EXHEADER_ENGINE := engine.h
$ EXHEADER_RIJNDAEL := rd_fst.h,rijndael.h
$ EXHEADER_BUFFER := buffer.h
$ EXHEADER_BIO := bio.h
$ EXHEADER_STACK := stack.h,safestack.h
$ EXHEADER_LHASH := lhash.h
$ EXHEADER_RAND := rand.h
$ EXHEADER_ERR := err.h
$ EXHEADER_OBJECTS := objects.h,obj_mac.h
$ EXHEADER_EVP := evp.h
$ EXHEADER_ASN1 := asn1.h,asn1_mac.h,asn1t.h
$ EXHEADER_PEM := pem.h,pem2.h
$ EXHEADER_X509 := x509.h,x509_vfy.h
$ EXHEADER_X509V3 := x509v3.h
$ EXHEADER_CONF := conf.h,conf_api.h
$ EXHEADER_TXT_DB := txt_db.h
$ EXHEADER_PKCS7 := pkcs7.h
$ EXHEADER_PKCS12 := pkcs12.h
$ EXHEADER_COMP := comp.h
$ EXHEADER_OCSP := ocsp.h
$ EXHEADER_UI := ui.h,ui_compat.h
$
$ I = 0
$ LOOP_SDIRS:
$ D = F$EDIT(F$ELEMENT(I, ",", SDIRS),"TRIM")
$ I = I + 1
$ IF D .EQS. "," THEN GOTO LOOP_SDIRS_END
$ tmp = EXHEADER_'D'
$ IF D .EQS. ""
$ THEN
$   COPY [.CRYPTO]'tmp' SYS$DISK:[.INCLUDE.OPENSSL] !/LOG
$ ELSE
$   COPY [.CRYPTO.'D']'tmp' SYS$DISK:[.INCLUDE.OPENSSL] !/LOG
$ ENDIF
$ GOTO LOOP_SDIRS
$ LOOP_SDIRS_END:
$!
$! Copy All The ".H" Files From The [.RSAREF] Directory.
$!
$! EXHEADER := rsaref.h
$! COPY SYS$DISK:[.RSAREF]'EXHEADER' SYS$DISK:[.INCLUDE.OPENSSL]
$!
$! Copy All The ".H" Files From The [.SSL] Directory.
$!
$ EXHEADER := ssl.h,ssl2.h,ssl3.h,ssl23.h,tls1.h,kssl.h
$ COPY SYS$DISK:[.SSL]'EXHEADER' SYS$DISK:[.INCLUDE.OPENSSL]
$!
$! Purge all doubles
$!
$ PURGE SYS$DISK:[.INCLUDE.OPENSSL]*.H
$!
$! That's All, Time To RETURN.
$!
$ RETURN
$!
$! Build The "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" Library.
$!
$ CRYPTO:
$!
$! Tell The User What We Are Doing.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Building The [.",ARCH,".EXE.CRYPTO]LIBCRYPTO.OLB Library."
$!
$! Go To The [.CRYPTO] Directory.
$!
$ SET DEFAULT SYS$DISK:[.CRYPTO]
$!
$! Build The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library.
$!
$ @CRYPTO-LIB LIBRARY 'RSAREF' 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "''BUILDPART'"
$!
$! Build The [.xxx.EXE.CRYPTO]*.EXE Test Applications.
$!
$ @CRYPTO-LIB APPS 'RSAREF' 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
$!
$! Go Back To The Main Directory.
$!
$ SET DEFAULT [-]
$!
$! Time To RETURN.
$!
$ RETURN
$!
$! Build The [.xxx.EXE.RSAREF]LIBRSAGLUE Library.
$!
$ RSAREF:
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "RSAref glue library not built, since it's no longer needed"
$ RETURN
$!
$! Tell The User What We Are Doing.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Building The [.",ARCH,".EXE.RSAREF]LIBRSAGLUE.OLB Library."
$!
$! Go To The [.RSAREF] Directory.
$!
$ SET DEFAULT SYS$DISK:[.RSAREF]
$!
$! Build The [.xxx.EXE.RSAREF]LIBRSAGLUE.OLB Library.
$!
$ @RSAREF-LIB LIBRARY 'DEBUGGER' "''COMPILER'" 'ISSEVEN'
$!
$! Go Back To The Main Directory.
$!
$ SET DEFAULT [-]
$!
$! Time To Return.
$!
$ RETURN
$!
$! Build The "[.xxx.EXE.SSL]LIBSSL.OLB" Library.
$!
$ SSL:
$!
$! Tell The User What We Are Doing.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Building The [.",ARCH,".EXE.SSL]LIBSSL.OLB Library."
$!
$! Go To The [.SSL] Directory.
$!
$ SET DEFAULT SYS$DISK:[.SSL]
$!
$! Build The [.xxx.EXE.SSL]LIBSSL.OLB Library.
$!
$ @SSL-LIB LIBRARY 'RSAREF' 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
$!
$! Go Back To The Main Directory.
$!
$ SET DEFAULT [-]
$!
$! Time To Return.
$!
$ RETURN
$!
$! Build The "[.xxx.EXE.SSL]SSL_TASK.EXE" Program.
$!
$ SSL_TASK:
$!
$! Tell The User What We Are Doing.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Building DECNet Based SSL Engine, [.",ARCH,".EXE.SSL]SSL_TASK.EXE"
$!
$! Go To The [.SSL] Directory.
$!
$ SET DEFAULT SYS$DISK:[.SSL]
$!
$! Build The [.xxx.EXE.SSL]SSL_TASK.EXE
$!
$ @SSL-LIB SSL_TASK 'RSAREF' 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
$!
$! Go Back To The Main Directory.
$!
$ SET DEFAULT [-]
$!
$! That's All, Time To RETURN.
$!
$ RETURN
$!
$! Build The OpenSSL Test Programs.
$!
$ TEST:
$!
$! Tell The User What We Are Doing.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Building The OpenSSL [.",ARCH,".EXE.TEST] Test Utilities."
$!
$! Go To The [.TEST] Directory.
$!
$ SET DEFAULT SYS$DISK:[.TEST]
$!
$! Build The Test Programs.
$!
$ @MAKETESTS 'RSAREF' 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
$!
$! Go Back To The Main Directory.
$!
$ SET DEFAULT [-]
$!
$! That's All, Time To RETURN.
$!
$ RETURN
$!
$! Build The OpenSSL Application Programs.
$!
$ APPS:
$!
$! Tell The User What We Are Doing.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Building OpenSSL [.",ARCH,".EXE.APPS] Applications."
$!
$! Go To The [.APPS] Directory.
$!
$ SET DEFAULT SYS$DISK:[.APPS]
$!
$! Build The Application Programs.
$!
$ @MAKEAPPS 'RSAREF' 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
$!
$! Go Back To The Main Directory.
$!
$ SET DEFAULT [-]
$!
$! That's All, Time To RETURN.
$!
$ RETURN
$!
$! Check The User's Options.
$!
$ CHECK_OPTIONS:
$!
$! Check if there's a "part", and separate it out
$!
$ BUILDPART = F$ELEMENT(1,"/",P1)
$ IF BUILDPART .EQS. "/"
$ THEN
$   BUILDPART = ""
$ ELSE
$   P1 = F$EXTRACT(0,F$LENGTH(P1) - F$LENGTH(BUILDPART) - 1, P1)
$ ENDIF
$!
$! Check To See If P1 Is Blank.
$!
$ IF (P1.EQS."ALL")
$ THEN
$!
$!   P1 Is ALL, So Build Everything.
$!
$    BUILDCOMMAND = "ALL"
$!
$! Else...
$!
$ ELSE
$!
$!  Else, Check To See If P1 Has A Valid Arguement.
$!
$   IF (P1.EQS."CONFIG").OR.(P1.EQS."BUILDINF").OR.(P1.EQS."SOFTLINKS") -
       .OR.(P1.EQS."BUILDALL") -
       .OR.(P1.EQS."CRYPTO").OR.(P1.EQS."SSL").OR.(P1.EQS."RSAREF") -
       .OR.(P1.EQS."SSL_TASK").OR.(P1.EQS."TEST").OR.(P1.EQS."APPS")
$   THEN
$!
$!    A Valid Arguement.
$!
$     BUILDCOMMAND = P1
$!
$!  Else...
$!
$   ELSE
$!
$!    Tell The User We Don't Know What They Want.
$!
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "The Option ",P1," Is Invalid.  The Valid Options Are:"
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "    ALL      :  Just Build Everything."
$     WRITE SYS$OUTPUT "    CONFIG   :  Just build the [.CRYPTO]OPENSSLCONF.H file."
$     WRITE SYS$OUTPUT "    BUILDINF :  Just build the [.CRYPTO]BUILDINF.H file."
$     WRITE SYS$OUTPUT "    SOFTLINKS:  Just Fix The Unix soft links."
$     WRITE SYS$OUTPUT "    BUILDALL :  Same as ALL, except CONFIG, BUILDINF and SOFTILNKS aren't done."
$     WRITE SYS$OUTPUT "    CRYPTO   :  To Build Just The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library."
$     WRITE SYS$OUTPUT "    CRYPTO/x :  To Build Just The x Part Of The"
$     WRITE SYS$OUTPUT "                [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library."
$     WRITE SYS$OUTPUT "    SSL      :  To Build Just The [.xxx.EXE.SSL]LIBSSL.OLB Library."
$     WRITE SYS$OUTPUT "    SSL_TASK :  To Build Just The [.xxx.EXE.SSL]SSL_TASK.EXE Program."
$     WRITE SYS$OUTPUT "    TEST     :  To Build Just The OpenSSL Test Programs."
$     WRITE SYS$OUTPUT "    APPS     :  To Build Just The OpenSSL Application Programs."
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT " Where 'xxx' Stands For:"
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "        AXP  :  Alpha Architecture."
$     WRITE SYS$OUTPUT "        VAX  :  VAX Architecture."
$     WRITE SYS$OUTPUT ""
$!
$!    Time To EXIT.
$!
$     EXIT
$!
$!  End The Valid Argument Check.
$!
$   ENDIF
$!
$! End The P1 Check.
$!
$ ENDIF
$!
$! Check To See If P2 Is Blank.
$!
$ P2 = "NORSAREF"
$ IF (P2.EQS."NORSAREF")
$ THEN
$!
$!   P2 Is NORSAREF, So Compile Without RSAREF.
$!
$    RSAREF = "NORSAREF"
$!
$! Else...
$!
$ ELSE
$!
$!  Check To See If We Are To Compile Using The RSAREF Library.
$!
$   IF (P2.EQS."RSAREF")
$   THEN
$!
$!    Compile With RSAREF Library.
$!
$     RSAREF = "RSAREF"
$!
$!  Else...
$!
$   ELSE
$!
$!    Tell The User Entered An Invalid Option..
$!
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "The Option ",P2," Is Invalid.  The Valid Options Are:"
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "    RSAREF   :  To Compile With The RSAREF Library."
$     WRITE SYS$OUTPUT "    NORSAREF :  To Compile With The Regular RSA Library."
$     WRITE SYS$OUTPUT ""
$!
$!    Time To EXIT.
$!
$     EXIT
$!
$!  End The Valid Arguemnt Check.
$!
$   ENDIF
$!
$! End The P2 Check.
$!
$ ENDIF
$!
$! Check To See If P3 Is Blank.
$!
$ IF (P3.EQS."NODEBUG")
$ THEN
$!
$!   P3 Is NODEBUG, So Compile Without Debugger Information.
$!
$    DEBUGGER = "NODEBUG"
$!
$! Else...
$!
$ ELSE
$!
$!  Check To See If We Are To Compile With Debugger Information.
$!
$   IF (P3.EQS."DEBUG")
$   THEN
$!
$!    Compile With Debugger Information.
$!
$     DEBUGGER = "DEBUG"
$!
$!  Else...
$!
$   ELSE
$!
$!    Tell The User Entered An Invalid Option..
$!
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "The Option ",P3," Is Invalid.  The Valid Options Are:"
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "    DEBUG    :  Compile With The Debugger Information."
$     WRITE SYS$OUTPUT "    NODEBUG  :  Compile Without The Debugger Information."
$     WRITE SYS$OUTPUT ""
$!
$!    Time To EXIT.
$!
$     EXIT
$!
$!  End The Valid Arguement Check.
$!
$   ENDIF
$!
$! End The P3 Check.
$!
$ ENDIF
$!
$! Check To See If P4 Is Blank.
$!
$ IF (P4.EQS."")
$ THEN
$!
$!  O.K., The User Didn't Specify A Compiler, Let's Try To
$!  Find Out Which One To Use.
$!
$!  Check To See If We Have GNU C.
$!
$   IF (F$TRNLNM("GNU_CC").NES."")
$   THEN
$!
$!    Looks Like GNUC, Set To Use GNUC.
$!
$     COMPILER = "GNUC"
$!
$!    Tell The User We Are Using GNUC.
$!
$     WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
$!
$!  End The GNU C Compiler Check.
$!
$   ENDIF
$!
$!  Check To See If We Have VAXC Or DECC.
$!
$   IF (F$GETSYI("CPU").GE.128).OR.(F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC")
$   THEN
$!
$!    Looks Like DECC, Set To Use DECC.
$!
$     COMPILER = "DECC"
$!
$!    Tell The User We Are Using DECC.
$!
$     WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
$!
$!  Else...
$!
$   ELSE
$!
$!    Looks Like VAXC, Set To Use VAXC.
$!
$     COMPILER = "VAXC"
$!
$!    Tell The User We Are Using VAX C.
$!
$     WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
$!
$!  End The DECC & VAXC Compiler Check.
$!
$   ENDIF
$!
$! Else...
$!
$ ELSE
$!
$!  Check To See If The User Entered A Valid Paramter.
$!
$   IF (P4.EQS."VAXC").OR.(P4.EQS."DECC").OR.(P4.EQS."GNUC")!.OR.(P4.EQS."LINK")
$   THEN
$!
$!    Check To See If The User Wanted To Just LINK.
$!
$     IF (P4.EQS."LINK")
$     THEN
$!
$!      Looks Like LINK-only
$!
$       COMPILER = "LINK"
$!
$!      Tell The User We Are Only Linking.
$!
$       WRITE SYS$OUTPUT "LINK Only.  This actually NOT YET SUPPORTED!"
$!
$!    End LINK Check.
$!
$     ENDIF
$!
$!    Check To See If The User Wanted DECC.
$!
$     IF (P4.EQS."DECC")
$     THEN
$!
$!      Looks Like DECC, Set To Use DECC.
$!
$       COMPILER = "DECC"
$!
$!      Tell The User We Are Using DECC.
$!
$       WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
$!
$!    End DECC Check.
$!
$     ENDIF
$!
$!    Check To See If We Are To Use VAXC.
$!
$     IF (P4.EQS."VAXC")
$     THEN
$!
$!      Looks Like VAXC, Set To Use VAXC.
$!
$       COMPILER = "VAXC"
$!
$!      Tell The User We Are Using VAX C.
$!
$       WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
$!
$!    End VAXC Check
$!
$     ENDIF
$!
$!    Check To See If We Are To Use GNU C.
$!
$     IF (P4.EQS."GNUC")
$     THEN
$!
$!      Looks Like GNUC, Set To Use GNUC.
$!
$       COMPILER = "GNUC"
$!
$!      Tell The User We Are Using GNUC.
$!
$       WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
$!
$!    End The GNU C Check.
$!
$     ENDIF
$!
$!  Else The User Entered An Invalid Arguement.
$!
$   ELSE
$!
$!    Tell The User We Don't Know What They Want.
$!
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "The Option ",P4," Is Invalid.  The Valid Options Are:"
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "    VAXC  :  To Compile With VAX C."
$     WRITE SYS$OUTPUT "    DECC  :  To Compile With DEC C."
$     WRITE SYS$OUTPUT "    GNUC  :  To Compile With GNU C."
$     WRITE SYS$OUTPUT ""
$!
$!    Time To EXIT.
$!
$     EXIT
$!
$!  End The Valid Arguement Check.
$!
$   ENDIF
$!
$! End The P4 Check.
$!
$ ENDIF
$!
$! Time to check the contents of P5, and to make sure we get the correct library.
$!
$ IF P5.EQS."SOCKETSHR" .OR. P5.EQS."MULTINET" .OR. P5.EQS."UCX"
$ THEN
$!
$!  Check to see if SOCKETSHR was chosen
$!
$   IF P5.EQS."SOCKETSHR"
$   THEN
$!
$!    Set the library to use SOCKETSHR
$!
$     TCPIP_LIB = "[-.VMS]SOCKETSHR_SHR.OPT/OPT"
$!
$!    Tell the user
$!
$     WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP"
$!
$!    Done with SOCKETSHR
$!
$   ENDIF
$!
$!  Check to see if MULTINET was chosen
$!
$   IF P5.EQS."MULTINET"
$   THEN
$!
$!    Set the library to use UCX emulation.
$!
$     P5 = "UCX"
$!
$!    Tell the user
$!
$     WRITE SYS$OUTPUT "Using MultiNet via UCX emulation for TCP/IP"
$!
$!    Done with MULTINET
$!
$   ENDIF
$!
$!  Check to see if UCX was chosen
$!
$   IF P5.EQS."UCX"
$   THEN
$!
$!    Set the library to use UCX.
$!
$     TCPIP_LIB = "[-.VMS]UCX_SHR_DECC.OPT/OPT"
$!
$!    Tell the user
$!
$     WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP"
$!
$!    Done with UCX
$!
$   ENDIF
$!
$!  Set the TCPIP_TYPE symbol
$!
$   TCPIP_TYPE = P5
$!
$!  Print info
$!
$   WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB
$!
$!  Else The User Entered An Invalid Arguement.
$!
$ ELSE
$   IF P5 .NES. ""
$   THEN
$!
$!    Tell The User We Don't Know What They Want.
$!
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "The Option ",P5," Is Invalid.  The Valid Options Are:"
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "    SOCKETSHR  :  To link with SOCKETSHR TCP/IP library."
$     WRITE SYS$OUTPUT "    UCX        :  To link with UCX TCP/IP library."
$     WRITE SYS$OUTPUT ""
$!
$!    Time To EXIT.
$!
$     EXIT
$   ELSE
$!
$!    Set the TCPIP_TYPE symbol
$!
$     TCPIP_TYPE = P5
$   ENDIF
$!
$!  Done with TCP/IP libraries
$!
$ ENDIF
$!
$! Special Threads For OpenVMS v7.1 Or Later
$!
$! Written By:  Richard Levitte
$!              richard@levitte.org
$!
$!
$! Check To See If We Have A Option For P6.
$!
$ IF (P6.EQS."")
$ THEN
$!
$!  Get The Version Of VMS We Are Using.
$!
$   ISSEVEN :=
$   TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
$   TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
$!
$!  Check To See If The VMS Version Is v7.1 Or Later.
$!
$   IF (TMP.GE.71)
$   THEN
$!
$!    We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
$!
$     ISSEVEN := ,PTHREAD_USE_D4
$!
$!  End The VMS Version Check.
$!
$   ENDIF
$!
$! End The P6 Check.
$!
$ ENDIF
$!
$!  Time To RETURN...
$!
$ RETURN

$!
$! MAKEVMS.COM
$! Original Author:  UNKNOWN
$! Rewritten By:  Robert Byer
$!                Vice-President
$!                A-Com Computing, Inc.
$!                byer@mail.all-net.net
$!
$! Changes by Richard Levitte <richard@levitte.org>
$!
$! This procedure creates the SSL libraries of "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB"
$! "[.xxx.EXE.SSL]LIBSSL.OLB" and if specified "[.xxx.EXE.RSAREF]LIBRSAGLUE.OLB".
$! The "xxx" denotes the machine architecture of AXP or VAX.
$!
$! This procedures accepts two command line options listed below.
$!
$! Specify one of the following build options for P1.
$!
$!      ALL       Just build "everything".
$!      CONFIG    Just build the "[.CRYPTO]OPENSSLCONF.H" file.
$!      BUILDINF  Just build the "[.CRYPTO]BUILDINF.H" file.
$!      SOFTLINKS Just fix the Unix soft links.
$!      BUILDALL  Same as ALL, except CONFIG, BUILDINF and SOFTILNKS aren't done.
$!      RSAREF    Just build the "[.xxx.EXE.RSAREF]LIBRSAGLUE.OLB" library.
$!      CRYPTO    Just build the "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" library.
$!      CRYPTO/x  Just build the x part of the
$!                "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" library.
$!      SSL       Just build the "[.xxx.EXE.SSL]LIBSSL.OLB" library.
$!      SSL_TASK  Just build the "[.xxx.EXE.SSL]SSL_TASK.EXE" program.
$!      TEST      Just build the "[.xxx.EXE.TEST]" test programs for OpenSSL.
$!      APPS      Just build the "[.xxx.EXE.APPS]" application programs for OpenSSL.
$!
$!
$! Specify RSAREF as P2 to compile using the RSAREF Library.
$! If you specify NORSAREF, it will compile without using RSAREF.
$! (If in the United States, You Must Compile Using RSAREF).
$!
$! Note: The RSAREF libraries are NOT INCLUDED and you have to
$!       download it from "ftp://ftp.rsa.com/rsaref".  You have to
$!       get the ".tar-Z" file as the ".zip" file dosen't have the
$!       directory structure stored.  You have to extract the file
$!       into the [.RSAREF] directory as that is where the scripts
$!       will look for the files.
$!
$! Speficy DEBUG or NODEBUG as P3 to compile with or without debugging
$! information.
$!
$! Specify which compiler at P4 to try to compile under.
$!
$!	  VAXC	 For VAX C.
$!	  DECC	 For DEC C.
$!	  GNUC	 For GNU C.
$!	  LINK   To only link the programs from existing object files.
$!               (not yet implemented)
$!
$! If you don't speficy a compiler, it will try to determine which
$! "C" compiler to use.
$!
$!  P5, if defined, sets a TCP/IP library to use, through one of the following
$!  keywords:
$!
$!	UCX		for UCX or UCX emulation
$!	SOCKETSHR	for SOCKETSHR+NETLIB
$!
$! P6, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
$!
$!
$! Check if we're in a batch job, and make sure we get to
$! the directory this script is in
$!
$ IF F$MODE() .EQS. "BATCH"
$ THEN
$   COMNAME=F$ENVIRONMENT("PROCEDURE")
$   COMPATH=F$PARSE("A.;",COMNAME) - "A.;"
$   SET DEF 'COMPATH'
$ ENDIF
$!
$! Check Which Architecture We Are Using.
$!
$ IF (F$GETSYI("CPU").GE.128)
$ THEN
$!
$!  The Architecture Is AXP.
$!
$   ARCH := AXP
$!
$! Else...
$!
$ ELSE
$!
$!  The Architecture Is VAX.
$!
$   ARCH := VAX
$!
$! End The Architecture Check.
$!
$ ENDIF
$!
$! Check To Make Sure We Have Valid Command Line Parameters.
$!
$ GOSUB CHECK_OPTIONS
$!
$! Check To See What We Are To Do.
$!
$ IF (BUILDCOMMAND.EQS."ALL")
$ THEN
$!
$!  Start with building the OpenSSL configuration file.
$!
$   GOSUB CONFIG
$!
$!  Create The "BUILDINF.H" Include File.
$!
$   GOSUB BUILDINF
$!
$!  Fix The Unix Softlinks.
$!
$   GOSUB SOFTLINKS
$!
$ ENDIF
$!
$ IF (BUILDCOMMAND.EQS."ALL".OR.BUILDCOMMAND.EQS."BUILDALL")
$ THEN
$!
$!  Check To See If We Are Going To Be Building The
$!  [.xxx.EXE.RSAREF]LIBRSAGLUE.OLB Library.
$!
$   IF (RSAREF.EQS."RSAREF")
$   THEN
$!
$!    Build The [.xxx.EXE.RSAREF]LIBRSAGLUE.OLB Library.
$!
$     GOSUB RSAREF
$!
$!  End The RSAREF Check.
$!
$   ENDIF
$!
$!  Build The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library.
$!
$   GOSUB CRYPTO
$!
$!  Build The [.xxx.EXE.SSL]LIBSSL.OLB Library.
$!
$   GOSUB SSL
$!
$!  Build The [.xxx.EXE.SSL]SSL_TASK.EXE DECNet SSL Engine.
$!
$   GOSUB SSL_TASK
$!
$!  Build The [.xxx.EXE.TEST] OpenSSL Test Utilities.
$!
$   GOSUB TEST
$!
$!  Build The [.xxx.EXE.APPS] OpenSSL Application Utilities.
$!
$   GOSUB APPS
$!
$! Else...
$!
$ ELSE
$!
$!    Build Just What The User Wants Us To Build.
$!
$     GOSUB 'BUILDCOMMAND'
$!
$ ENDIF
$!
$! Time To EXIT.
$!
$ EXIT
$!
$! Rebuild The "[.CRYPTO]OPENSSLCONF.H" file.
$!
$ CONFIG:
$!
$! Tell The User We Are Creating The [.CRYPTO]OPENSSLCONF.H File.
$!
$ WRITE SYS$OUTPUT "Creating [.CRYPTO]OPENSSLCONF.H Include File."
$!
$! Create The [.CRYPTO]OPENSSLCONF.H File.
$!
$ OPEN/WRITE H_FILE SYS$DISK:[.CRYPTO]OPENSSLCONF.H
$!
$! Write The [.CRYPTO]OPENSSLCONF.H File.
$!
$ WRITE H_FILE "/* This file was automatically built using makevms.com */"
$ WRITE H_FILE "/* and [.CRYPTO]OPENSSLCONF.H_IN */"
$
$!
$! Write a few macros that indicate how this system was built.
$!
$ WRITE H_FILE ""
$ WRITE H_FILE "#ifndef OPENSSL_SYS_VMS"
$ WRITE H_FILE "# define OPENSSL_SYS_VMS"
$ WRITE H_FILE "#endif"
$ CONFIG_LOGICALS := NO_ASM,NO_RSA,NO_DSA,NO_DH,NO_MD2,NO_MD5,NO_RIPEMD,-
	NO_SHA,NO_SHA0,NO_SHA1,NO_DES/NO_MDC2;NO_MDC2,NO_RC2,NO_RC4,NO_RC5,-
	NO_IDEA,NO_BF,NO_CAST,NO_HMAC,NO_SSL2
$ CONFIG_LOG_I = 0
$ CONFIG_LOG_LOOP:
$   CONFIG_LOG_E1 = F$ELEMENT(CONFIG_LOG_I,",",CONFIG_LOGICALS)
$   CONFIG_LOG_I = CONFIG_LOG_I + 1
$   IF CONFIG_LOG_E1 .EQS. "" THEN GOTO CONFIG_LOG_LOOP
$   IF CONFIG_LOG_E1 .EQS. "," THEN GOTO CONFIG_LOG_LOOP_END
$   CONFIG_LOG_E2 = F$EDIT(CONFIG_LOG_E1,"TRIM")
$   CONFIG_LOG_E1 = F$ELEMENT(0,";",CONFIG_LOG_E2)
$   CONFIG_LOG_E2 = F$ELEMENT(1,";",CONFIG_LOG_E2)
$   CONFIG_LOG_E0 = F$ELEMENT(0,"/",CONFIG_LOG_E1)
$   CONFIG_LOG_E1 = F$ELEMENT(1,"/",CONFIG_LOG_E1)
$   IF F$TRNLNM("OPENSSL_"+CONFIG_LOG_E0)
$   THEN
$     WRITE H_FILE "#ifndef OPENSSL_",CONFIG_LOG_E0
$     WRITE H_FILE "# define OPENSSL_",CONFIG_LOG_E0
$     WRITE H_FILE "#endif"
$     IF CONFIG_LOG_E1 .NES. "/"
$     THEN
$       WRITE H_FILE "#ifndef OPENSSL_",CONFIG_LOG_E1
$       WRITE H_FILE "# define OPENSSL_",CONFIG_LOG_E1
$       WRITE H_FILE "#endif"
$     ENDIF
$   ELSE
$     IF CONFIG_LOG_E2 .NES. ";"
$     THEN
$       IF F$TRNLNM("OPENSSL_"+CONFIG_LOG_E2)
$       THEN
$         WRITE H_FILE "#ifndef OPENSSL_",CONFIG_LOG_E2
$         WRITE H_FILE "# define OPENSSL_",CONFIG_LOG_E2
$         WRITE H_FILE "#endif"
$       ENDIF
$     ENDIF
$   ENDIF
$   GOTO CONFIG_LOG_LOOP
$ CONFIG_LOG_LOOP_END:
$ WRITE H_FILE "#ifndef OPENSSL_THREADS"
$ WRITE H_FILE "# define OPENSSL_THREADS"
$ WRITE H_FILE "#endif"
$ WRITE H_FILE "#ifndef OPENSSL_NO_KRB5"
$ WRITE H_FILE "# define OPENSSL_NO_KRB5"
$ WRITE H_FILE "#endif"
$ WRITE H_FILE ""
$!
$! Different tar version may have named the file differently
$ IF F$SEARCH("[.CRYPTO]OPENSSLCONF.H_IN") .NES. ""
$ THEN
$   TYPE [.CRYPTO]OPENSSLCONF.H_IN /OUTPUT=H_FILE:
$ ELSE
$   IF F$SEARCH("[.CRYPTO]OPENSSLCONF_H.IN") .NES. ""
$   THEN
$     TYPE [.CRYPTO]OPENSSLCONF_H.IN /OUTPUT=H_FILE:
$   ELSE
$     WRITE SYS$ERROR "Couldn't find a [.CRYPTO]OPENSSLCONF.H_IN.  Exiting!"
$     EXIT 0
$   ENDIF
$ ENDIF
$ IF ARCH .EQS. "AXP"
$ THEN
$!
$!  Write the Alpha specific data
$!
$   WRITE H_FILE "#if defined(HEADER_RC4_H)"
$   WRITE H_FILE "#undef RC4_INT"
$   WRITE H_FILE "#define RC4_INT unsigned int"
$   WRITE H_FILE "#undef RC4_CHUNK"
$   WRITE H_FILE "#define RC4_CHUNK unsigned long long"
$   WRITE H_FILE "#endif"
$!
$   WRITE H_FILE "#if defined(HEADER_DES_LOCL_H)"
$   WRITE H_FILE "#undef DES_LONG"
$   WRITE H_FILE "#define DES_LONG unsigned int"
$   WRITE H_FILE "#undef DES_PTR"
$   WRITE H_FILE "#define DES_PTR"
$   WRITE H_FILE "#undef DES_RISC1"
$   WRITE H_FILE "#undef DES_RISC2"
$   WRITE H_FILE "#define DES_RISC1"
$   WRITE H_FILE "#undef DES_UNROLL"
$   WRITE H_FILE "#define DES_UNROLL"
$   WRITE H_FILE "#endif"
$!
$   WRITE H_FILE "#if defined(HEADER_BN_H)"
$   WRITE H_FILE "#undef SIXTY_FOUR_BIT_LONG"
$   WRITE H_FILE "#undef SIXTY_FOUR_BIT"
$   WRITE H_FILE "#define SIXTY_FOUR_BIT"
$   WRITE H_FILE "#undef THIRTY_TWO_BIT"
$   WRITE H_FILE "#undef SIXTEEN_BIT"
$   WRITE H_FILE "#undef EIGHT_BIT"
$   WRITE H_FILE "#endif"
$
$   WRITE H_FILE "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION"
$!
$!  Else...
$!
$ ELSE
$!
$!  Write the VAX specific data
$!
$   WRITE H_FILE "#if defined(HEADER_RC4_H)"
$   WRITE H_FILE "#undef RC4_INT"
$   WRITE H_FILE "#define RC4_INT unsigned char"
$   WRITE H_FILE "#undef RC4_CHUNK"
$   WRITE H_FILE "#define RC4_CHUNK unsigned long"
$   WRITE H_FILE "#endif"
$!
$   WRITE H_FILE "#if defined(HEADER_DES_LOCL_H)"
$   WRITE H_FILE "#undef DES_LONG"
$   WRITE H_FILE "#define DES_LONG unsigned long"
$   WRITE H_FILE "#undef DES_PTR"
$   WRITE H_FILE "#define DES_PTR"
$   WRITE H_FILE "#undef DES_RISC1"
$   WRITE H_FILE "#undef DES_RISC2"
$   WRITE H_FILE "#undef DES_UNROLL"
$   WRITE H_FILE "#endif"
$!
$   WRITE H_FILE "#if defined(HEADER_BN_H)"
$   WRITE H_FILE "#undef SIXTY_FOUR_BIT_LONG"
$   WRITE H_FILE "#undef SIXTY_FOUR_BIT"
$   WRITE H_FILE "#undef THIRTY_TWO_BIT"
$   WRITE H_FILE "#define THIRTY_TWO_BIT"
$   WRITE H_FILE "#undef SIXTEEN_BIT"
$   WRITE H_FILE "#undef EIGHT_BIT"
$   WRITE H_FILE "#endif"
$
$   WRITE H_FILE "#undef OPENSSL_EXPORT_VAR_AS_FUNCTION"
$   WRITE H_FILE "#define OPENSSL_EXPORT_VAR_AS_FUNCTION"
$!
$!  End
$!
$ ENDIF
$!
$! Close the [.CRYPTO]OPENSSLCONF.H file
$!
$ CLOSE H_FILE
$!
$! That's All, Time To RETURN.
$!
$ RETURN
$!
$! Rebuild The "[.CRYPTO]BUILDINF.H" file.
$!
$ BUILDINF:
$!
$! Tell The User We Are Creating The [.CRYPTO]BUILDINF.H File.
$!
$ WRITE SYS$OUTPUT "Creating [.CRYPTO]BUILDINF.H Include File."
$!
$! Create The [.CRYPTO]BUILDINF.H File.
$!
$ OPEN/WRITE H_FILE SYS$DISK:[.CRYPTO]BUILDINF.H
$!
$! Get The Current Date & Time.
$!
$ TIME = F$TIME()
$!
$! Write The [.CRYPTO]BUILDINF.H File.
$!
$ WRITE H_FILE "#define CFLAGS """" /* Not filled in for now */"
$ WRITE H_FILE "#define PLATFORM ""VMS"""
$ WRITE H_FILE "#define DATE ""''TIME'"" "
$!
$! Close The [.CRYPTO]BUILDINF.H File.
$!
$ CLOSE H_FILE
$!
$! That's All, Time To RETURN.
$!
$ RETURN
$!
$! Copy a lot of files around.
$!
$ SOFTLINKS:
$!
$! Tell The User We Are Partly Rebuilding The [.TEST] Directory.
$!
$ WRITE SYS$OUTPUT "Rebuilding The '[.APPS]MD5.C' And '[.APPS]RMD160.C' Files."
$!
$ DELETE SYS$DISK:[.APPS]MD4.C;*,MD5.C;*,RMD160.C;*
$!
$! Copy MD4.C from [.CRYPTO.MD4] into [.APPS]
$!
$ COPY SYS$DISK:[.CRYPTO.MD4]MD4.C SYS$DISK:[.APPS]
$!
$! Copy MD5.C from [.CRYPTO.MD5] into [.APPS]
$!
$ COPY SYS$DISK:[.CRYPTO.MD5]MD5.C SYS$DISK:[.APPS]
$!
$! Copy RMD160.C from [.CRYPTO.RIPEMD] into [.APPS]
$!
$ COPY SYS$DISK:[.CRYPTO.RIPEMD]RMD160.C SYS$DISK:[.APPS]
$!
$! Tell The User We Are Partly Rebuilding The [.TEST] Directory.
$!
$ WRITE SYS$OUTPUT "Rebuilding The '[.TEST]*.C' Files."
$!
$! First, We Have To "Rebuild" The "[.TEST]" Directory, So Delete
$! All The "C" Files That Are Currently There Now.
$!
$ DELETE SYS$DISK:[.TEST]*.C;*
$!
$! Copy all the *TEST.C files from [.CRYPTO...] into [.TEST]
$!
$ COPY SYS$DISK:[.CRYPTO.*]%*TEST.C SYS$DISK:[.TEST]
$!
$! Copy all the *TEST.C files from [.SSL...] into [.TEST]
$!
$ COPY SYS$DISK:[.SSL]%*TEST.C SYS$DISK:[.TEST]
$!
$! Tell The User We Are Rebuilding The [.INCLUDE.OPENSSL] Directory.
$!
$ WRITE SYS$OUTPUT "Rebuilding The '[.INCLUDE.OPENSSL]' Directory."
$!
$! First, make sure the directory exists
$!
$ IF F$PARSE("SYS$DISK:[.INCLUDE.OPENSSL]") .EQS. "" THEN -
     CREATE/DIRECTORY SYS$DISK:[.INCLUDE.OPENSSL]
$!
$! Copy All The ".H" Files From The Main Directory.
$!
$ EXHEADER := e_os2.h
$ COPY 'EXHEADER' SYS$DISK:[.INCLUDE.OPENSSL]
$!
$! Copy All The ".H" Files From The [.CRYPTO] Directory Tree.
$!
$ SDIRS := ,MD2,MD4,MD5,SHA,MDC2,HMAC,RIPEMD,-
   DES,RC2,RC4,RC5,IDEA,BF,CAST,-
   BN,EC,RSA,DSA,DH,DSO,ENGINE,RIJNDAEL,-
   BUFFER,BIO,STACK,LHASH,RAND,ERR,OBJECTS,-
   EVP,ASN1,PEM,X509,X509V3,CONF,TXT_DB,PKCS7,PKCS12,COMP,OCSP,UI
$ EXHEADER_ := crypto.h,tmdiff.h,opensslv.h,opensslconf.h,ebcdic.h,symhacks.h
$ EXHEADER_MD2 := md2.h
$ EXHEADER_MD4 := md4.h
$ EXHEADER_MD5 := md5.h
$ EXHEADER_SHA := sha.h
$ EXHEADER_MDC2 := mdc2.h
$ EXHEADER_HMAC := hmac.h
$ EXHEADER_RIPEMD := ripemd.h
$ EXHEADER_DES := des.h
$ EXHEADER_RC2 := rc2.h
$ EXHEADER_RC4 := rc4.h
$ EXHEADER_RC5 := rc5.h
$ EXHEADER_IDEA := idea.h
$ EXHEADER_BF := blowfish.h
$ EXHEADER_CAST := cast.h
$ EXHEADER_BN := bn.h
$ EXHEADER_EC := ec.h
$ EXHEADER_RSA := rsa.h
$ EXHEADER_DSA := dsa.h
$ EXHEADER_DH := dh.h
$ EXHEADER_DSO := dso.h
$ EXHEADER_ENGINE := engine.h
$ EXHEADER_RIJNDAEL := rd_fst.h,rijndael.h
$ EXHEADER_BUFFER := buffer.h
$ EXHEADER_BIO := bio.h
$ EXHEADER_STACK := stack.h,safestack.h
$ EXHEADER_LHASH := lhash.h
$ EXHEADER_RAND := rand.h
$ EXHEADER_ERR := err.h
$ EXHEADER_OBJECTS := objects.h,obj_mac.h
$ EXHEADER_EVP := evp.h
$ EXHEADER_ASN1 := asn1.h,asn1_mac.h,asn1t.h
$ EXHEADER_PEM := pem.h,pem2.h
$ EXHEADER_X509 := x509.h,x509_vfy.h
$ EXHEADER_X509V3 := x509v3.h
$ EXHEADER_CONF := conf.h,conf_api.h
$ EXHEADER_TXT_DB := txt_db.h
$ EXHEADER_PKCS7 := pkcs7.h
$ EXHEADER_PKCS12 := pkcs12.h
$ EXHEADER_COMP := comp.h
$ EXHEADER_OCSP := ocsp.h
$ EXHEADER_UI := ui.h
$
$ I = 0
$ LOOP_SDIRS:
$ D = F$EDIT(F$ELEMENT(I, ",", SDIRS),"TRIM")
$ I = I + 1
$ IF D .EQS. "," THEN GOTO LOOP_SDIRS_END
$ tmp = EXHEADER_'D'
$ IF D .EQS. ""
$ THEN
$   COPY [.CRYPTO]'tmp' SYS$DISK:[.INCLUDE.OPENSSL] !/LOG
$ ELSE
$   COPY [.CRYPTO.'D']'tmp' SYS$DISK:[.INCLUDE.OPENSSL] !/LOG
$ ENDIF
$ GOTO LOOP_SDIRS
$ LOOP_SDIRS_END:
$!
$! Copy All The ".H" Files From The [.RSAREF] Directory.
$!
$! EXHEADER := rsaref.h
$! COPY SYS$DISK:[.RSAREF]'EXHEADER' SYS$DISK:[.INCLUDE.OPENSSL]
$!
$! Copy All The ".H" Files From The [.SSL] Directory.
$!
$ EXHEADER := ssl.h,ssl2.h,ssl3.h,ssl23.h,tls1.h,kssl.h
$ COPY SYS$DISK:[.SSL]'EXHEADER' SYS$DISK:[.INCLUDE.OPENSSL]
$!
$! Purge all doubles
$!
$ PURGE SYS$DISK:[.INCLUDE.OPENSSL]*.H
$!
$! That's All, Time To RETURN.
$!
$ RETURN
$!
$! Build The "[.xxx.EXE.CRYPTO]LIBCRYPTO.OLB" Library.
$!
$ CRYPTO:
$!
$! Tell The User What We Are Doing.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Building The [.",ARCH,".EXE.CRYPTO]LIBCRYPTO.OLB Library."
$!
$! Go To The [.CRYPTO] Directory.
$!
$ SET DEFAULT SYS$DISK:[.CRYPTO]
$!
$! Build The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library.
$!
$ @CRYPTO-LIB LIBRARY 'RSAREF' 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" "''ISSEVEN'" "''BUILDPART'"
$!
$! Build The [.xxx.EXE.CRYPTO]*.EXE Test Applications.
$!
$ @CRYPTO-LIB APPS 'RSAREF' 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
$!
$! Go Back To The Main Directory.
$!
$ SET DEFAULT [-]
$!
$! Time To RETURN.
$!
$ RETURN
$!
$! Build The [.xxx.EXE.RSAREF]LIBRSAGLUE Library.
$!
$ RSAREF:
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "RSAref glue library not built, since it's no longer needed"
$ RETURN
$!
$! Tell The User What We Are Doing.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Building The [.",ARCH,".EXE.RSAREF]LIBRSAGLUE.OLB Library."
$!
$! Go To The [.RSAREF] Directory.
$!
$ SET DEFAULT SYS$DISK:[.RSAREF]
$!
$! Build The [.xxx.EXE.RSAREF]LIBRSAGLUE.OLB Library.
$!
$ @RSAREF-LIB LIBRARY 'DEBUGGER' "''COMPILER'" 'ISSEVEN'
$!
$! Go Back To The Main Directory.
$!
$ SET DEFAULT [-]
$!
$! Time To Return.
$!
$ RETURN
$!
$! Build The "[.xxx.EXE.SSL]LIBSSL.OLB" Library.
$!
$ SSL:
$!
$! Tell The User What We Are Doing.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Building The [.",ARCH,".EXE.SSL]LIBSSL.OLB Library."
$!
$! Go To The [.SSL] Directory.
$!
$ SET DEFAULT SYS$DISK:[.SSL]
$!
$! Build The [.xxx.EXE.SSL]LIBSSL.OLB Library.
$!
$ @SSL-LIB LIBRARY 'RSAREF' 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
$!
$! Go Back To The Main Directory.
$!
$ SET DEFAULT [-]
$!
$! Time To Return.
$!
$ RETURN
$!
$! Build The "[.xxx.EXE.SSL]SSL_TASK.EXE" Program.
$!
$ SSL_TASK:
$!
$! Tell The User What We Are Doing.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Building DECNet Based SSL Engine, [.",ARCH,".EXE.SSL]SSL_TASK.EXE"
$!
$! Go To The [.SSL] Directory.
$!
$ SET DEFAULT SYS$DISK:[.SSL]
$!
$! Build The [.xxx.EXE.SSL]SSL_TASK.EXE
$!
$ @SSL-LIB SSL_TASK 'RSAREF' 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
$!
$! Go Back To The Main Directory.
$!
$ SET DEFAULT [-]
$!
$! That's All, Time To RETURN.
$!
$ RETURN
$!
$! Build The OpenSSL Test Programs.
$!
$ TEST:
$!
$! Tell The User What We Are Doing.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Building The OpenSSL [.",ARCH,".EXE.TEST] Test Utilities."
$!
$! Go To The [.TEST] Directory.
$!
$ SET DEFAULT SYS$DISK:[.TEST]
$!
$! Build The Test Programs.
$!
$ @MAKETESTS 'RSAREF' 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
$!
$! Go Back To The Main Directory.
$!
$ SET DEFAULT [-]
$!
$! That's All, Time To RETURN.
$!
$ RETURN
$!
$! Build The OpenSSL Application Programs.
$!
$ APPS:
$!
$! Tell The User What We Are Doing.
$!
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "Building OpenSSL [.",ARCH,".EXE.APPS] Applications."
$!
$! Go To The [.APPS] Directory.
$!
$ SET DEFAULT SYS$DISK:[.APPS]
$!
$! Build The Application Programs.
$!
$ @MAKEAPPS 'RSAREF' 'DEBUGGER' "''COMPILER'" "''TCPIP_TYPE'" 'ISSEVEN'
$!
$! Go Back To The Main Directory.
$!
$ SET DEFAULT [-]
$!
$! That's All, Time To RETURN.
$!
$ RETURN
$!
$! Check The User's Options.
$!
$ CHECK_OPTIONS:
$!
$! Check if there's a "part", and separate it out
$!
$ BUILDPART = F$ELEMENT(1,"/",P1)
$ IF BUILDPART .EQS. "/"
$ THEN
$   BUILDPART = ""
$ ELSE
$   P1 = F$EXTRACT(0,F$LENGTH(P1) - F$LENGTH(BUILDPART) - 1, P1)
$ ENDIF
$!
$! Check To See If P1 Is Blank.
$!
$ IF (P1.EQS."ALL")
$ THEN
$!
$!   P1 Is ALL, So Build Everything.
$!
$    BUILDCOMMAND = "ALL"
$!
$! Else...
$!
$ ELSE
$!
$!  Else, Check To See If P1 Has A Valid Arguement.
$!
$   IF (P1.EQS."CONFIG").OR.(P1.EQS."BUILDINF").OR.(P1.EQS."SOFTLINKS") -
       .OR.(P1.EQS."BUILDALL") -
       .OR.(P1.EQS."CRYPTO").OR.(P1.EQS."SSL").OR.(P1.EQS."RSAREF") -
       .OR.(P1.EQS."SSL_TASK").OR.(P1.EQS."TEST").OR.(P1.EQS."APPS")
$   THEN
$!
$!    A Valid Arguement.
$!
$     BUILDCOMMAND = P1
$!
$!  Else...
$!
$   ELSE
$!
$!    Tell The User We Don't Know What They Want.
$!
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "The Option ",P1," Is Invalid.  The Valid Options Are:"
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "    ALL      :  Just Build Everything."
$     WRITE SYS$OUTPUT "    CONFIG   :  Just build the [.CRYPTO]OPENSSLCONF.H file."
$     WRITE SYS$OUTPUT "    BUILDINF :  Just build the [.CRYPTO]BUILDINF.H file."
$     WRITE SYS$OUTPUT "    SOFTLINKS:  Just Fix The Unix soft links."
$     WRITE SYS$OUTPUT "    BUILDALL :  Same as ALL, except CONFIG, BUILDINF and SOFTILNKS aren't done."
$     WRITE SYS$OUTPUT "    CRYPTO   :  To Build Just The [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library."
$     WRITE SYS$OUTPUT "    CRYPTO/x :  To Build Just The x Part Of The"
$     WRITE SYS$OUTPUT "                [.xxx.EXE.CRYPTO]LIBCRYPTO.OLB Library."
$     WRITE SYS$OUTPUT "    SSL      :  To Build Just The [.xxx.EXE.SSL]LIBSSL.OLB Library."
$     WRITE SYS$OUTPUT "    SSL_TASK :  To Build Just The [.xxx.EXE.SSL]SSL_TASK.EXE Program."
$     WRITE SYS$OUTPUT "    TEST     :  To Build Just The OpenSSL Test Programs."
$     WRITE SYS$OUTPUT "    APPS     :  To Build Just The OpenSSL Application Programs."
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT " Where 'xxx' Stands For:"
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "        AXP  :  Alpha Architecture."
$     WRITE SYS$OUTPUT "        VAX  :  VAX Architecture."
$     WRITE SYS$OUTPUT ""
$!
$!    Time To EXIT.
$!
$     EXIT
$!
$!  End The Valid Argument Check.
$!
$   ENDIF
$!
$! End The P1 Check.
$!
$ ENDIF
$!
$! Check To See If P2 Is Blank.
$!
$ P2 = "NORSAREF"
$ IF (P2.EQS."NORSAREF")
$ THEN
$!
$!   P2 Is NORSAREF, So Compile Without RSAREF.
$!
$    RSAREF = "NORSAREF"
$!
$! Else...
$!
$ ELSE
$!
$!  Check To See If We Are To Compile Using The RSAREF Library.
$!
$   IF (P2.EQS."RSAREF")
$   THEN
$!
$!    Compile With RSAREF Library.
$!
$     RSAREF = "RSAREF"
$!
$!  Else...
$!
$   ELSE
$!
$!    Tell The User Entered An Invalid Option..
$!
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "The Option ",P2," Is Invalid.  The Valid Options Are:"
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "    RSAREF   :  To Compile With The RSAREF Library."
$     WRITE SYS$OUTPUT "    NORSAREF :  To Compile With The Regular RSA Library."
$     WRITE SYS$OUTPUT ""
$!
$!    Time To EXIT.
$!
$     EXIT
$!
$!  End The Valid Arguemnt Check.
$!
$   ENDIF
$!
$! End The P2 Check.
$!
$ ENDIF
$!
$! Check To See If P3 Is Blank.
$!
$ IF (P3.EQS."NODEBUG")
$ THEN
$!
$!   P3 Is NODEBUG, So Compile Without Debugger Information.
$!
$    DEBUGGER = "NODEBUG"
$!
$! Else...
$!
$ ELSE
$!
$!  Check To See If We Are To Compile With Debugger Information.
$!
$   IF (P3.EQS."DEBUG")
$   THEN
$!
$!    Compile With Debugger Information.
$!
$     DEBUGGER = "DEBUG"
$!
$!  Else...
$!
$   ELSE
$!
$!    Tell The User Entered An Invalid Option..
$!
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "The Option ",P3," Is Invalid.  The Valid Options Are:"
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "    DEBUG    :  Compile With The Debugger Information."
$     WRITE SYS$OUTPUT "    NODEBUG  :  Compile Without The Debugger Information."
$     WRITE SYS$OUTPUT ""
$!
$!    Time To EXIT.
$!
$     EXIT
$!
$!  End The Valid Arguement Check.
$!
$   ENDIF
$!
$! End The P3 Check.
$!
$ ENDIF
$!
$! Check To See If P4 Is Blank.
$!
$ IF (P4.EQS."")
$ THEN
$!
$!  O.K., The User Didn't Specify A Compiler, Let's Try To
$!  Find Out Which One To Use.
$!
$!  Check To See If We Have GNU C.
$!
$   IF (F$TRNLNM("GNU_CC").NES."")
$   THEN
$!
$!    Looks Like GNUC, Set To Use GNUC.
$!
$     COMPILER = "GNUC"
$!
$!    Tell The User We Are Using GNUC.
$!
$     WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
$!
$!  End The GNU C Compiler Check.
$!
$   ENDIF
$!
$!  Check To See If We Have VAXC Or DECC.
$!
$   IF (F$GETSYI("CPU").GE.128).OR.(F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC")
$   THEN
$!
$!    Looks Like DECC, Set To Use DECC.
$!
$     COMPILER = "DECC"
$!
$!    Tell The User We Are Using DECC.
$!
$     WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
$!
$!  Else...
$!
$   ELSE
$!
$!    Looks Like VAXC, Set To Use VAXC.
$!
$     COMPILER = "VAXC"
$!
$!    Tell The User We Are Using VAX C.
$!
$     WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
$!
$!  End The DECC & VAXC Compiler Check.
$!
$   ENDIF
$!
$! Else...
$!
$ ELSE
$!
$!  Check To See If The User Entered A Valid Paramter.
$!
$   IF (P4.EQS."VAXC").OR.(P4.EQS."DECC").OR.(P4.EQS."GNUC")!.OR.(P4.EQS."LINK")
$   THEN
$!
$!    Check To See If The User Wanted To Just LINK.
$!
$     IF (P4.EQS."LINK")
$     THEN
$!
$!      Looks Like LINK-only
$!
$       COMPILER = "LINK"
$!
$!      Tell The User We Are Only Linking.
$!
$       WRITE SYS$OUTPUT "LINK Only.  This actually NOT YET SUPPORTED!"
$!
$!    End LINK Check.
$!
$     ENDIF
$!
$!    Check To See If The User Wanted DECC.
$!
$     IF (P4.EQS."DECC")
$     THEN
$!
$!      Looks Like DECC, Set To Use DECC.
$!
$       COMPILER = "DECC"
$!
$!      Tell The User We Are Using DECC.
$!
$       WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
$!
$!    End DECC Check.
$!
$     ENDIF
$!
$!    Check To See If We Are To Use VAXC.
$!
$     IF (P4.EQS."VAXC")
$     THEN
$!
$!      Looks Like VAXC, Set To Use VAXC.
$!
$       COMPILER = "VAXC"
$!
$!      Tell The User We Are Using VAX C.
$!
$       WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
$!
$!    End VAXC Check
$!
$     ENDIF
$!
$!    Check To See If We Are To Use GNU C.
$!
$     IF (P4.EQS."GNUC")
$     THEN
$!
$!      Looks Like GNUC, Set To Use GNUC.
$!
$       COMPILER = "GNUC"
$!
$!      Tell The User We Are Using GNUC.
$!
$       WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
$!
$!    End The GNU C Check.
$!
$     ENDIF
$!
$!  Else The User Entered An Invalid Arguement.
$!
$   ELSE
$!
$!    Tell The User We Don't Know What They Want.
$!
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "The Option ",P4," Is Invalid.  The Valid Options Are:"
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "    VAXC  :  To Compile With VAX C."
$     WRITE SYS$OUTPUT "    DECC  :  To Compile With DEC C."
$     WRITE SYS$OUTPUT "    GNUC  :  To Compile With GNU C."
$     WRITE SYS$OUTPUT ""
$!
$!    Time To EXIT.
$!
$     EXIT
$!
$!  End The Valid Arguement Check.
$!
$   ENDIF
$!
$! End The P4 Check.
$!
$ ENDIF
$!
$! Time to check the contents of P5, and to make sure we get the correct library.
$!
$ IF P5.EQS."SOCKETSHR" .OR. P5.EQS."MULTINET" .OR. P5.EQS."UCX"
$ THEN
$!
$!  Check to see if SOCKETSHR was chosen
$!
$   IF P5.EQS."SOCKETSHR"
$   THEN
$!
$!    Set the library to use SOCKETSHR
$!
$     TCPIP_LIB = "[-.VMS]SOCKETSHR_SHR.OPT/OPT"
$!
$!    Tell the user
$!
$     WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP"
$!
$!    Done with SOCKETSHR
$!
$   ENDIF
$!
$!  Check to see if MULTINET was chosen
$!
$   IF P5.EQS."MULTINET"
$   THEN
$!
$!    Set the library to use UCX emulation.
$!
$     P5 = "UCX"
$!
$!    Tell the user
$!
$     WRITE SYS$OUTPUT "Using MultiNet via UCX emulation for TCP/IP"
$!
$!    Done with MULTINET
$!
$   ENDIF
$!
$!  Check to see if UCX was chosen
$!
$   IF P5.EQS."UCX"
$   THEN
$!
$!    Set the library to use UCX.
$!
$     TCPIP_LIB = "[-.VMS]UCX_SHR_DECC.OPT/OPT"
$!
$!    Tell the user
$!
$     WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP"
$!
$!    Done with UCX
$!
$   ENDIF
$!
$!  Set the TCPIP_TYPE symbol
$!
$   TCPIP_TYPE = P5
$!
$!  Print info
$!
$   WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB
$!
$!  Else The User Entered An Invalid Arguement.
$!
$ ELSE
$   IF P5 .NES. ""
$   THEN
$!
$!    Tell The User We Don't Know What They Want.
$!
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "The Option ",P5," Is Invalid.  The Valid Options Are:"
$     WRITE SYS$OUTPUT ""
$     WRITE SYS$OUTPUT "    SOCKETSHR  :  To link with SOCKETSHR TCP/IP library."
$     WRITE SYS$OUTPUT "    UCX        :  To link with UCX TCP/IP library."
$     WRITE SYS$OUTPUT ""
$!
$!    Time To EXIT.
$!
$     EXIT
$   ELSE
$!
$!    Set the TCPIP_TYPE symbol
$!
$     TCPIP_TYPE = P5
$   ENDIF
$!
$!  Done with TCP/IP libraries
$!
$ ENDIF
$!
$! Special Threads For OpenVMS v7.1 Or Later
$!
$! Written By:  Richard Levitte
$!              richard@levitte.org
$!
$!
$! Check To See If We Have A Option For P6.
$!
$ IF (P6.EQS."")
$ THEN
$!
$!  Get The Version Of VMS We Are Using.
$!
$   ISSEVEN :=
$   TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
$   TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
$!
$!  Check To See If The VMS Version Is v7.1 Or Later.
$!
$   IF (TMP.GE.71)
$   THEN
$!
$!    We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
$!
$     ISSEVEN := ,PTHREAD_USE_D4
$!
$!  End The VMS Version Check.
$!
$   ENDIF
$!
$! End The P6 Check.
$!
$ ENDIF
$!
$!  Time To RETURN...
$!
$ RETURN


Update submodule

Update submodule


Repoint jeaye.com

Repoint jeaye.com


snoyman.com update

snoyman.com update


remove default server

remove default server

# Redirect all HTTP trafic to HTTPS

server {
    listen 80;
    listen [::]:80;

    server_name tapcrate.com www.tapcrate.com api.tapcrate.com www.api.tapcrate.com static.tapcrate.com www.static.tapcrate.com;

    location ^~ /.well-known/acme-challenge/ {
        default_type "text/plain";
        root /tmp/letsencrypt-auto/;
    }

    location = /.well-known/acme-challenge/ {
        return 404;
    }

    location / {
        return 301 https://$server_name$request_uri;
    }
}

server {

    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;

    server_name tapcrate.com www.tapcrate.com;

    include snippets/ssl-tapcrate.com.conf;
    include snippets/ssl-params.conf;

    root /home/jasper/tapcrate;
    index index.php;

    location / {
        add_header location 3;
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        add_header location 4;
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    include snippets/ssl-api.tapcrate.com.conf;
    include snippets/ssl-params.conf;

    root /home/hakon/tapcrate/tapcrate-api;

    server_name api.tapcrate.com www.api.tapcrate.com;

    location / {
        include proxy_params;
        proxy_pass http://127.0.0.1:8080;
    }
}

proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=static:10m inactive=60m use_temp_path=off max_size=4g;

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    include snippets/ssl-api.tapcrate.com.conf;
    include snippets/ssl-params.conf;

    root /home/hakon/tapcrate/tapcrate-api/Public;

    server_name static.tapcrate.com www.static.tapcrate.com;

    location / {
        include h5bp/basic.conf;

        tcp_nodelay on;
        keepalive_timeout 65;
        sendfile on;
        tcp_nopush on;
        sendfile_max_chunk 1m;

        proxy_cache static;
        try_files $uri =404;
    }
}

# Redirect all HTTP trafic to HTTPS

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    server_name tapcrate.com www.tapcrate.com api.tapcrate.com www.api.tapcrate.com static.tapcrate.com www.static.tapcrate.com;

    location ^~ /.well-known/acme-challenge/ {
        default_type "text/plain";
        root /tmp/letsencrypt-auto/;
    }

    location = /.well-known/acme-challenge/ {
        return 404;
    }

    location / {
        return 301 https://$server_name$request_uri;
    }
}

server {

    listen 443 ssl http2 default_server;
    listen [::]:443 ssl http2 default_server;

    server_name tapcrate.com www.tapcrate.com;

    include snippets/ssl-tapcrate.com.conf;
    include snippets/ssl-params.conf;

    root /home/jasper/tapcrate;
    index index.php;

    location / {
        add_header location 3;
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        add_header location 4;
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

server {

    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    include snippets/ssl-api.tapcrate.com.conf;
    include snippets/ssl-params.conf;

    root /home/hakon/tapcrate/tapcrate-api;

    server_name api.tapcrate.com www.api.tapcrate.com;

    location / {
        include proxy_params;
        proxy_pass http://127.0.0.1:8080;
    }
}

proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=static:10m inactive=60m use_temp_path=off max_size=4g;

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    include snippets/ssl-api.tapcrate.com.conf;
    include snippets/ssl-params.conf;

    root /home/hakon/tapcrate/tapcrate-api/Public;

    server_name static.tapcrate.com www.static.tapcrate.com;

    location / {
        include h5bp/basic.conf;

        tcp_nodelay on;
        keepalive_timeout 65;
        sendfile on;
        tcp_nopush on;
        sendfile_max_chunk 1m;

        proxy_cache static;
        try_files $uri =404;
    }
}


Newer yesodweb.com

Newer yesodweb.com


Update submodules

Update submodules


sub module -> @f651a66

sub module -> @f651a66


updated formatting in nginx config

updated formatting in nginx config

#mran.revolutionanalytics.com
#Chris Mosetick 2014-06-12
#last update    2014-07-24

server {
        #listen on IPv4 and IPv6 addresses at the same time
        listen 80;
        listen [::]:80;

        #directory in the file system to serve web pages and packages from
        #this is a detachable block disk formatted with ZFS that can be easily moved to another server
	      #www dir is for landing page stuff
        root /MRAN/www;
        index index.html index.htm;

        # public facing domain name for this vhost
        server_name marmoset.revolutionanalytics.com;

        location /snapshots {
                try_files $uri $uri/ =404;
                #autoindex is needed since we are not serving up any html or php pages
                autoindex  on;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
                #snapshots is directory containing symlinks to various .zfs/snapshot dirs
        }

        location /metadata {
                try_files $uri $uri/ =404;
                autoindex on;
		            # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules

        }

        location /diffs {
                try_files $uri $uri/ =404;
                autoindex on;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /accounting {
                try_files $uri $uri/ =404;
                autoindex on;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /history {
		            try_files $uri $uri/ =404;
                autoindex on;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
                #history is symlink pointing to snapshots of the /MRAN/www FS itself
                #this URL is hidden right now, not on index.html
        }

        location /exports {
		            try_files $uri $uri/ =404;
        	      autoindex on;
        	      # Uncomment to enable naxsi on this location
        	      # include /etc/nginx/naxsi.rules
		            #exports is symlink to zpool named exports
	      }

}
#this last bracket is needed to close this vhost


Submodule update

Submodule update


openvms: Report explicitly about missing test file

$!
$! Copyright 2014, John Malmberg
$! Copyright 2016, Alexander Saprykin
$!
$! Permission to use, copy, modify, and/or distribute this software for any
$! purpose with or without fee is hereby granted, provided that the above
$! copyright notice and this permission notice appear in all copies.
$!
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$!
$!===========================================================================
$! Command-line options:
$!
$!    32            Compile with 32-bit pointers.
$!    BIGENDIAN     Compile for a big endian host.
$!    CCQUAL=x      Add "x" to the C compiler qualifiers.
$!    DEBUG         Build in debug mode.
$!    CLEAN         Only perform clean after the previous build.
$!    TESTS=(x)     Build library tests. Comma separated test names or leave
$!                  empty to build all the tests.
$!                  Example 1 (curtain tests): TESTS=(pmem,puthread)
$!                  Example 2 (all tests): TESTS
$!    RUN_TESTS     Runs all tests.
$!    BOOST_ROOT=x  Boost root directory.
$!                  Example: BOOST_ROOT=/SYS$COMMON/boost_1_43_1
$!    NOLIB         Skip library buidling. Useful when you want to rebuild
$!                  particular tests.
$!===========================================================================
$!
$!
$! Save the original default dev:[dir], and arrange for its restoration
$! at exit.
$!---------------------------------------------------------------------
$ orig_def = f$environment("DEFAULT")
$ on error then goto common_exit
$ on control_y then goto common_exit
$!
$ ctrl_y       = 1556
$ proc         = f$environment("PROCEDURE")
$ proc_fid     = f$file_attributes(proc, "FID")
$ proc_dev     = f$parse(proc, , , "DEVICE")
$ proc_dir     = f$parse(proc, , , "DIRECTORY")
$ proc_name    = f$parse(proc, , , "NAME")
$ proc_type    = f$parse(proc, , , "TYPE")
$ proc_dev_dir = proc_dev + proc_dir
$!
$! Have to manually parse the device for a search list.
$! Can not use the f$parse() as it will return the first name
$! in the search list.
$!
$ orig_def_dev = f$element(0, ":", orig_def) + ":"
$ if orig_def_dev .eqs. "::" then orig_def_dev = "sys$disk:"
$ test_proc = orig_def_dev + proc_dir + proc_name + proc_type
$!
$! If we can find this file using the default directory
$! then we know that we should use the original device from the
$! default directory which could be a search list.
$!
$ test_proc_fid = f$file_attributes(test_proc, "FID")
$!
$ if (test_proc_fid .eq. proc_fid)
$ then
$     proc_dev_dir = orig_def_dev + proc_dir
$ endif
$!
$! Verbose output message stuff. Define symbol to "write sys$output".
$! vo_c - verbose output for compile
$!
$ vo_c := "write sys$output"
$!
$! Determine the main distribution directory ("[--]") in an
$! ODS5-tolerant (case-insensitive) way.  (We do assume that the only
$! "]" or ">" is the one at the end.)
$!
$! Some non-US VMS installations report ">" for the directory delimiter
$! so do not assume that it is "]".
$!
$ orig_def_len = f$length(orig_def)
$ delim = f$extract(orig_def_len - 1, 1, orig_def)
$!
$ set default 'proc_dev_dir'
$ set default [--.src]
$ base_src_dir = f$environment("default")
$ set default 'proc_dev_dir'
$!
$! Define the architecture-specific destination directory name
$! -----------------------------------------------------------
$!
$ if (f$getsyi("HW_MODEL") .lt. 1024)
$ then
$      'vo_c' "%PLIBSYS-F-NOTSUP, VAX platform is not supported, sorry :("
$      goto common_exit
$ else
$      arch_name = ""
$      arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
$!
$      if (arch_name .eqs. "") then arch_name = "UNK"
$!
$      node_swvers   = f$getsyi("node_swvers")
$      version_patch = f$extract(1, f$length(node_swvers), node_swvers)
$      maj_ver       = f$element(0, ".", version_patch)
$      min_ver_patch = f$element(1, ".", version_patch)
$      min_ver       = f$element(0, "-", min_ver_patch)
$      patch         = f$element(1, "-", min_ver_patch)
$!
$      if maj_ver .lts. "8" .or. min_ver .lts. "4"
$      then
$          'vo_c' "%PLIBSYS-F-NOTSUP, only OpenVMS 8.4 and above are supported, sorry :("
$          goto common_exit
$      endif
$ endif
$!
$ objdir = proc_dev_dir - delim + ".''arch_name'" + delim
$!
$! Parse input arguments
$! ---------------------
$! Allow arguments to be grouped together with comma or separated by spaces
$! Do no know if we will need more than 8.
$ args = "," + p1 + "," + p2 + "," + p3 + "," + p4 + ","
$ args = args + p5 + "," + p6 + "," + p7 + "," + p8 + ","
$!
$! Provide lower case version to simplify parsing.
$ args_lower = f$edit(args, "LOWERCASE,COLLAPSE")
$!
$ args_len = f$length(args)
$ args_lower_len = f$length(args_lower)
$!
$ if f$locate(",clean,", args_lower) .lt. args_lower_len
$ then
$     'vo_c' "Cleaning up previous build..."
$     set default 'proc_dev_dir'
$     @deltree.com 'arch_name'
$     goto common_exit
$ endif
$!
$ build_64 = 1
$ if f$locate(",32,", args_lower) .lt. args_lower_len
$ then
$     build_64 = 0
$ endif
$!
$ big_endian = 0
$ if f$locate(",bigendian,", args_lower) .lt. args_lower_len
$ then
$     big_endian = 1
$ endif
$!
$ cc_extra = ""
$ args_loc = f$locate(",ccqual=", args_lower)
$ if args_loc .lt. args_lower_len
$ then
$     arg = f$extract(args_loc + 1, args_lower_len, args_lower)
$     arg_val = f$element(0, ",", arg)
$     cc_extra = f$element(1, "=", arg_val)
$ endif
$!
$ is_debug = 0
$ if f$locate(",debug,", args_lower) .lt. args_lower_len
$ then
$     is_debug = 1
$ endif
$!
$ is_tests = 0
$ test_list = ""
$ if f$locate(",tests,", args_lower) .lt. args_lower_len
$ then
$     is_tests = 1
$ else
$     args_loc = f$locate(",tests=(", args_lower)
$     if args_loc .lt. args_lower_len
$     then
$         is_tests          = 1
$         arg               = f$extract(args_loc + 1, args_lower_len, args_lower)
$         arg_val           = f$element(0, ")", arg)
$         test_list_val     = f$element(1, "=", arg_val) - "(" - ")"
$         test_list_val     = f$edit(test_list_val, "COLLAPSE")
$         test_list_counter = 0
$
$ test_list_loop:
$         next_test_val = f$element (test_list_counter, ",", test_list_val)
$         if next_test_val .nes. "" .and. next_test_val .nes. ","
$         then
$             test_list         = test_list + next_test_val + " "
$             test_list_counter = test_list_counter + 1
$             goto test_list_loop
$         endif
$     endif
$ endif
$!
$ run_tests = 0
$ if f$locate(",run_tests,", args_lower) .lt. args_lower_len
$ then
$     run_tests = 1
$ endif
$!
$ boost_root = ""
$ args_loc = f$locate(",boost_root=", args_lower)
$ if args_loc .lt. args_lower_len
$ then
$     arg = f$extract(args_loc + 1, args_lower_len, args_lower)
$     arg_val = f$element(0, ",", arg)
$     boost_root = f$element(1, "=", arg_val)
$ endif
$!
$ if is_tests .eqs. "1" .and. boost_root .eqs. ""
$ then
$     'vo_c' "%PLIBSYS-I-NOTESTS, tests couldn't be built without BOOST_ROOT parameter, disabling."
$     is_tests = 0
$ endif
$!
$ if is_tests .eqs. "0" .and. boost_root .nes. ""
$ then
$     'vo_c' "%PLIBSYS-I-BOOSTIGN, BOOST_ROOT parameter will be ignored without tests enabled."
$ endif
$!
$! Prepare build directory
$! -----------------------
$!
$! When building on a search list, need to do a create to make sure that
$! the output directory exists, since the clean procedure tries to delete
$! it.
$!
$ if f$search("''proc_dev_dir'''arch_name'.DIR") .eqs. ""
$ then
$     create/dir 'objdir'/prot=o:rwed
$ endif
$!
$ set default 'objdir'
$ @[-]deltree CXX_REPOSITORY
$!
$ if f$locate(",nolib,", args_lower) .lt. args_lower_len
$ then
$     goto build_tests
$ endif
$!
$! Generate platform-specific config file
$! --------------------------------------
$!
$ if f$search("plibsysconfig.h") .nes. "" then delete plibsysconfig.h;*
$!
$! Get the version number
$! ----------------------
$!
$ i = 0
$ open/read/error=version_loop_end vhf [---]CMakeLists.txt
$ version_loop:
$     read/end=version_loop_end vhf line_in
$!
$     if line_in .eqs. "" then goto version_loop
$!
$     if f$locate("set (PLIBSYS_VERSION_MAJOR ", line_in) .eq. 0
$     then
$         plibsys_vmajor = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if f$locate("set (PLIBSYS_VERSION_MINOR ", line_in) .eq. 0
$     then
$         plibsys_vminor = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if f$locate("set (PLIBSYS_VERSION_PATCH ", line_in) .eq. 0
$     then
$         plibsys_vpatch = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if f$locate("set (PLIBSYS_VERSION_NUM ", line_in) .eq. 0
$     then
$         plibsys_vnum = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if i .lt 4 then goto version_loop
$ version_loop_end:
$ close vhf
$!
$! Write config file
$! -----------------
$!
$ open/write/error=config_write_end chf plibsysconfig.h
$ write chf "#ifndef PLIBSYS_HEADER_PLIBSYSCONFIG_H"
$ write chf "#define PLIBSYS_HEADER_PLIBSYSCONFIG_H"
$ write chf ""
$ write chf "#define PLIBSYS_VERSION_MAJOR ''plibsys_vmajor'"
$ write chf "#define PLIBSYS_VERSION_MINOR ''plibsys_vminor'"
$ write chf "#define PLIBSYS_VERSION_PATCH ''plibsys_vpatch'"
$ write chf "#define PLIBSYS_VERSION_STR ""''plibsys_vmajor'.''plibsys_vminor'.''plibsys_vpatch'"""
$ write chf "#define PLIBSYS_VERSION ''plibsys_vnum'"
$ write chf ""
$ write chf "#define PLIBSYS_SIZEOF_SAFAMILY_T 1"
$ write chf ""
$ write chf "#include <pmacros.h>"
$ write chf ""
$ write chf "#include <float.h>"
$ write chf "#include <limits.h>"
$ write chf ""
$ write chf "P_BEGIN_DECLS"
$ write chf ""
$ write chf "#define P_MINFLOAT    FLT_MIN"
$ write chf "#define P_MAXFLOAT    FLT_MAX"
$ write chf "#define P_MINDOUBLE   DBL_MIN"
$ write chf "#define P_MAXDOUBLE   DBL_MAX"
$ write chf "#define P_MINSHORT    SHRT_MIN"
$ write chf "#define P_MAXSHORT    SHRT_MAX"
$ write chf "#define P_MAXUSHORT   USHRT_MAX"
$ write chf "#define P_MININT      INT_MIN"
$ write chf "#define P_MAXINT      INT_MAX"
$ write chf "#define P_MAXUINT     UINT_MAX"
$ write chf "#define P_MINLONG     LONG_MIN"
$ write chf "#define P_MAXLONG     LONG_MAX"
$ write chf "#define P_MAXULONG    ULONG_MAX"
$ write chf ""
$ write chf "#define PLIBSYS_MMAP_HAS_MAP_ANONYMOUS"
$ write chf "#define PLIBSYS_HAS_NANOSLEEP"
$ write chf "#define PLIBSYS_HAS_GETADDRINFO"
$ write chf "#define PLIBSYS_HAS_POSIX_SCHEDULING"
$ write chf "#define PLIBSYS_HAS_POSIX_STACKSIZE"
$ write chf "#define PLIBSYS_HAS_SOCKADDR_STORAGE"
$ write chf "#define PLIBSYS_SOCKADDR_HAS_SA_LEN"
$ write chf "#define PLIBSYS_SOCKADDR_IN6_HAS_SCOPEID"
$ write chf "#define PLIBSYS_SOCKADDR_IN6_HAS_FLOWINFO"
$ write chf ""
$!
$ if build_64 .eqs. "1"
$ then
$     write chf "#define PLIBSYS_SIZEOF_VOID_P 8"
$     write chf "#define PLIBSYS_SIZEOF_SIZE_T 8"
$ else
$     write chf "#define PLIBSYS_SIZEOF_VOID_P 4"
$     write chf "#define PLIBSYS_SIZEOF_SIZE_T 4"
$ endif
$!
$ write chf "#define PLIBSYS_SIZEOF_LONG 4"
$ write chf ""
$!
$ if big_endian .eqs. "1"
$ then
$     write chf "#define P_BYTE_ORDER P_BIG_ENDIAN"
$ else
$     write chf "#define P_BYTE_ORDER P_LITTLE_ENDIAN"
$ endif
$!
$ write chf ""
$ write chf "P_END_DECLS"
$ write chf ""
$ write chf "#endif /* PLIBSYS_HEADER_PLIBSYSCONFIG_H */"
$ config_write_end:
$     close chf
$!
$! Prepare sources for compilation
$! -------------------------------
$!
$ cc_link_params = ""
$ cc_params = "/NAMES=(AS_IS,SHORTENED)"
$ cc_params = cc_params + "/DEFINE=(PLIBSYS_COMPILATION,_REENTRANT,_POSIX_EXIT)"
$ cc_params = cc_params + "/INCLUDE_DIRECTORY=(''objdir',''base_src_dir')"
$ cc_params = cc_params + "/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS"
$!
$ if build_64 .eqs. "1"
$ then
$     cc_params = cc_params + "/POINTER_SIZE=64"
$ else
$     cc_params = cc_params + "/POINTER_SIZE=32"
$ endif
$!
$ if cc_extra .nes. ""
$ then
$     cc_params = cc_params + " " + cc_extra
$ endif
$!
$ if is_debug .eqs. "1"
$ then
$     cc_params = cc_params + "/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL"
$     cc_link_params = "/DEBUG/TRACEBACK"
$ else
$     cc_link_params = "/NODEBUG/NOTRACEBACK"
$ endif
$!
$ plibsys_src = "patomic-sim.c pcondvariable-posix.c pcryptohash-gost3411.c pcryptohash-md5.c"
$ plibsys_src = plibsys_src + " pcryptohash-sha1.c pcryptohash-sha2-256.c pcryptohash-sha2-512.c"
$ plibsys_src = plibsys_src + " pcryptohash-sha3.c pcryptohash.c pdir-posix.c pdir.c"
$ plibsys_src = plibsys_src + " perror.c pfile.c phashtable.c pinifile.c pipc.c plibraryloader.c"
$ plibsys_src = plibsys_src + " plist.c pmain.c pmem.c pmutex-posix.c pprocess.c prwlock-posix.c"
$ plibsys_src = plibsys_src + " psemaphore-posix.c pshm-posix.c pshmbuffer.c psocket.c"
$ plibsys_src = plibsys_src + " psocketaddress.c pspinlock-sim.c pstring.c psysclose-unix.c"
$ plibsys_src = plibsys_src + " ptimeprofiler-posix.c ptimeprofiler.c ptree-avl.c ptree-bst.c"
$ plibsys_src = plibsys_src + " ptree-rb.c ptree.c puthread-posix.c puthread.c"
$!
$! Inform about building
$! ---------------------
$!
$ if build_64 .eqs. "1"
$ then
$     'vo_c' "Building for ''arch_name' (64-bit)"
$ else
$     'vo_c' "Building for ''arch_name' (32-bit)"
$ endif
$!
$! Compile library modules
$! -----------------------
$!
$ 'vo_c' "Compiling object modules..."
$ src_counter = 0
$ plibsys_src = f$edit(plibsys_src, "COMPRESS")
$ plibsys_objs = ""
$!
$ src_loop:
$     next_src = f$element (src_counter, " ", plibsys_src)
$     if next_src .nes. "" .and. next_src .nes. " "
$     then
$         'vo_c' "[CC] ''next_src'"
$         cc [---.src]'next_src' 'cc_params'
$!
$         src_counter = src_counter + 1
$!
$         obj_file = f$extract (0, f$length (next_src) - 1, next_src) + "obj"
$         plibsys_objs = plibsys_objs + "''obj_file',"
$         purge 'obj_file'
$!
$         goto src_loop
$     endif
$!
$ plibsys_objs = f$extract (0, f$length (plibsys_objs) - 1, plibsys_objs)
$!
$! Create library
$! --------------
$!
$ 'vo_c' "Creating object library..."
$ library/CREATE/INSERT/REPLACE /LIST=PLIBSYS.LIS PLIBSYS.OLB 'plibsys_objs'
$ library/COMPRESS PLIBSYS.OLB
$ purge PLIBSYS.OLB
$ purge PLIBSYS.LIS
$!
$ 'vo_c' "Creating shared library..."
$ link/SHAREABLE=PLIBSYS.EXE /MAP=PLIBSYS.MAP 'cc_link_params' 'plibsys_objs', [-]plibsys.opt/OPTION
$ purge PLIBSYS.EXE
$ purge PLIBSYS.MAP
$!
$! Testing area
$! ------------
$!
$ build_tests:
$ test_list_full = "patomic pcondvariable pcryptohash pdir"
$ test_list_full = test_list_full + " perror pfile phashtable pinifile plibraryloader plist"
$ test_list_full = test_list_full + " pmacros pmain pmem pmutex pprocess prwlock psemaphore"
$ test_list_full = test_list_full + " pshm pshmbuffer psocket psocketaddress pspinlock pstring"
$ test_list_full = test_list_full + " ptimeprofiler ptree ptypes puthread"
$!
$ if is_tests .eqs. "0"
$ then
$     goto build_done
$ endif
$!
$! Write link options file
$! -----------------------
$!
$ if f$search("plibsys_link.opt") .nes. "" then delete plibsys_link.opt;*
$!
$ open/write/error=link_write_end lhf plibsys_link.opt
$ write lhf "''objdir'PLIBSYS.EXE/SHARE"
$ write lhf ""
$ link_write_end:
$     close lhf
$!
$! Compile tests
$! -------------------------
$!
$ if test_list .nes. ""
$ then
$     plibsys_tests = f$edit(test_list, "TRIM")
$ else
$     plibsys_tests = test_list_full
$ endif
$!
$ 'vo_c' "Compiling test executables..."
$ test_counter = 0
$ plibsys_tests = f$edit(plibsys_tests, "COMPRESS")
$!
$ cxx_params = "/INCLUDE=(''objdir',''base_src_dir',""''boost_root'"")"
$ cxx_params = cxx_params + "/DEFINE=(__USE_STD_IOSTREAM,PLIBSYS_TESTS_STATIC)/NAMES=(AS_IS, SHORTENED)"
$ cxx_params = cxx_params + "/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS"
$!
$ if build_64 .eqs. "1"
$ then
$     cxx_params = cxx_params + "/POINTER_SIZE=64"
$ else
$     cxx_params = cxx_params + "/POINTER_SIZE=32"
$ endif
$!
$ if is_debug .eqs. "1"
$ then
$     cxx_params = cxx_params + "/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL"
$ endif
$!
$ test_loop:
$     next_test = f$element (test_counter, " ", plibsys_tests)
$     if next_test .nes. "" .and. next_test .nes. " "
$     then
$         next_test = next_test + "_test"
$         'vo_c' "[CXX    ] ''next_test'.cpp"
$         cxx [---.tests]'next_test'.cpp 'cxx_params'
$!
$         'vo_c' "[CXXLINK] ''next_test'.obj"
$          cxxlink 'next_test'.obj,'objdir'plibsys_link.opt/OPTION /THREADS_ENABLE
$!
$         @[-]deltree CXX_REPOSITORY
$         purge 'next_test'.obj
$         purge 'next_test'.exe
$!
$         test_counter = test_counter + 1
$         goto test_loop
$     endif
$!
$ build_done:
$     'vo_c' "Build done."
$!
$! Run unit tests
$! --------------
$!
$ if run_tests .eqs. "0"
$ then
$     goto common_exit
$ endif
$!
$ 'vo_c' "Running tests..."
$ test_counter = 0
$ tests_passed = 0
$!
$ run_loop:
$     next_test = f$element (test_counter, " ", test_list_full)
$     if next_test .nes. "" .and. next_test .nes. " "
$     then
$         if f$search("''next_test'_test.exe") .eqs. ""
$         then
$             'vo_c' "[SKIP] Test not found: ''next_test'"
$             goto run_loop_next
$         endif
$!
$         'vo_c' "[RUN ] ''next_test'"
$!
$         define/user sys$error NL:
$         define/user sys$output NL:
$         define/user plibsys 'objdir'PLIBSYS.EXE
$         define/user test_imgdir 'objdir'
$!
$         xrun := $test_imgdir:'next_test'_test.exe
$         if next_test .eqs. "plibraryloader"
$         then
$             xrun 'objdir'PLIBSYS.EXE
$         else
$             xrun
$         endif
$!
$         if $STATUS .eqs. "%X00000001"
$         then
$             'vo_c' "[PASS] Test passed: ''next_test'"
$             tests_passed = tests_passed + 1
$         else
$             'vo_c' "[FAIL] *** Test failed: ''next_test'"
$         endif
$!
$ run_loop_next:
$         test_counter = test_counter + 1
$         goto run_loop
$     endif
$!
$ 'vo_c' "Tests passed: ''tests_passed'/''test_counter'"
$!
$ common_exit:
$     set default 'orig_def'
$     exit

$!
$! Copyright 2014, John Malmberg
$! Copyright 2016, Alexander Saprykin
$!
$! Permission to use, copy, modify, and/or distribute this software for any
$! purpose with or without fee is hereby granted, provided that the above
$! copyright notice and this permission notice appear in all copies.
$!
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
$!
$!===========================================================================
$! Command-line options:
$!
$!    32            Compile with 32-bit pointers.
$!    BIGENDIAN     Compile for a big endian host.
$!    CCQUAL=x      Add "x" to the C compiler qualifiers.
$!    DEBUG         Build in debug mode.
$!    CLEAN         Only perform clean after the previous build.
$!    TESTS=(x)     Build library tests. Comma separated test names or leave
$!                  empty to build all the tests.
$!                  Example 1 (curtain tests): TESTS=(pmem,puthread)
$!                  Example 2 (all tests): TESTS
$!    RUN_TESTS     Runs all tests.
$!    BOOST_ROOT=x  Boost root directory.
$!                  Example: BOOST_ROOT=/SYS$COMMON/boost_1_43_1
$!    NOLIB         Skip library buidling. Useful when you want to rebuild
$!                  particular tests.
$!===========================================================================
$!
$!
$! Save the original default dev:[dir], and arrange for its restoration
$! at exit.
$!---------------------------------------------------------------------
$ orig_def = f$environment("DEFAULT")
$ on error then goto common_exit
$ on control_y then goto common_exit
$!
$ ctrl_y       = 1556
$ proc         = f$environment("PROCEDURE")
$ proc_fid     = f$file_attributes(proc, "FID")
$ proc_dev     = f$parse(proc, , , "DEVICE")
$ proc_dir     = f$parse(proc, , , "DIRECTORY")
$ proc_name    = f$parse(proc, , , "NAME")
$ proc_type    = f$parse(proc, , , "TYPE")
$ proc_dev_dir = proc_dev + proc_dir
$!
$! Have to manually parse the device for a search list.
$! Can not use the f$parse() as it will return the first name
$! in the search list.
$!
$ orig_def_dev = f$element(0, ":", orig_def) + ":"
$ if orig_def_dev .eqs. "::" then orig_def_dev = "sys$disk:"
$ test_proc = orig_def_dev + proc_dir + proc_name + proc_type
$!
$! If we can find this file using the default directory
$! then we know that we should use the original device from the
$! default directory which could be a search list.
$!
$ test_proc_fid = f$file_attributes(test_proc, "FID")
$!
$ if (test_proc_fid .eq. proc_fid)
$ then
$     proc_dev_dir = orig_def_dev + proc_dir
$ endif
$!
$! Verbose output message stuff. Define symbol to "write sys$output".
$! vo_c - verbose output for compile
$!
$ vo_c := "write sys$output"
$!
$! Determine the main distribution directory ("[--]") in an
$! ODS5-tolerant (case-insensitive) way.  (We do assume that the only
$! "]" or ">" is the one at the end.)
$!
$! Some non-US VMS installations report ">" for the directory delimiter
$! so do not assume that it is "]".
$!
$ orig_def_len = f$length(orig_def)
$ delim = f$extract(orig_def_len - 1, 1, orig_def)
$!
$ set default 'proc_dev_dir'
$ set default [--.src]
$ base_src_dir = f$environment("default")
$ set default 'proc_dev_dir'
$!
$! Define the architecture-specific destination directory name
$! -----------------------------------------------------------
$!
$ if (f$getsyi("HW_MODEL") .lt. 1024)
$ then
$      'vo_c' "%PLIBSYS-F-NOTSUP, VAX platform is not supported, sorry :("
$      goto common_exit
$ else
$      arch_name = ""
$      arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
$!
$      if (arch_name .eqs. "") then arch_name = "UNK"
$!
$      node_swvers   = f$getsyi("node_swvers")
$      version_patch = f$extract(1, f$length(node_swvers), node_swvers)
$      maj_ver       = f$element(0, ".", version_patch)
$      min_ver_patch = f$element(1, ".", version_patch)
$      min_ver       = f$element(0, "-", min_ver_patch)
$      patch         = f$element(1, "-", min_ver_patch)
$!
$      if maj_ver .lts. "8" .or. min_ver .lts. "4"
$      then
$          'vo_c' "%PLIBSYS-F-NOTSUP, only OpenVMS 8.4 and above are supported, sorry :("
$          goto common_exit
$      endif
$ endif
$!
$ objdir = proc_dev_dir - delim + ".''arch_name'" + delim
$!
$! Parse input arguments
$! ---------------------
$! Allow arguments to be grouped together with comma or separated by spaces
$! Do no know if we will need more than 8.
$ args = "," + p1 + "," + p2 + "," + p3 + "," + p4 + ","
$ args = args + p5 + "," + p6 + "," + p7 + "," + p8 + ","
$!
$! Provide lower case version to simplify parsing.
$ args_lower = f$edit(args, "LOWERCASE,COLLAPSE")
$!
$ args_len = f$length(args)
$ args_lower_len = f$length(args_lower)
$!
$ if f$locate(",clean,", args_lower) .lt. args_lower_len
$ then
$     'vo_c' "Cleaning up previous build..."
$     set default 'proc_dev_dir'
$     @deltree.com 'arch_name'
$     goto common_exit
$ endif
$!
$ build_64 = 1
$ if f$locate(",32,", args_lower) .lt. args_lower_len
$ then
$     build_64 = 0
$ endif
$!
$ big_endian = 0
$ if f$locate(",bigendian,", args_lower) .lt. args_lower_len
$ then
$     big_endian = 1
$ endif
$!
$ cc_extra = ""
$ args_loc = f$locate(",ccqual=", args_lower)
$ if args_loc .lt. args_lower_len
$ then
$     arg = f$extract(args_loc + 1, args_lower_len, args_lower)
$     arg_val = f$element(0, ",", arg)
$     cc_extra = f$element(1, "=", arg_val)
$ endif
$!
$ is_debug = 0
$ if f$locate(",debug,", args_lower) .lt. args_lower_len
$ then
$     is_debug = 1
$ endif
$!
$ is_tests = 0
$ test_list = ""
$ if f$locate(",tests,", args_lower) .lt. args_lower_len
$ then
$     is_tests = 1
$ else
$     args_loc = f$locate(",tests=(", args_lower)
$     if args_loc .lt. args_lower_len
$     then
$         is_tests          = 1
$         arg               = f$extract(args_loc + 1, args_lower_len, args_lower)
$         arg_val           = f$element(0, ")", arg)
$         test_list_val     = f$element(1, "=", arg_val) - "(" - ")"
$         test_list_val     = f$edit(test_list_val, "COLLAPSE")
$         test_list_counter = 0
$
$ test_list_loop:
$         next_test_val = f$element (test_list_counter, ",", test_list_val)
$         if next_test_val .nes. "" .and. next_test_val .nes. ","
$         then
$             test_list         = test_list + next_test_val + " "
$             test_list_counter = test_list_counter + 1
$             goto test_list_loop
$         endif
$     endif
$ endif
$!
$ run_tests = 0
$ if f$locate(",run_tests,", args_lower) .lt. args_lower_len
$ then
$     run_tests = 1
$ endif
$!
$ boost_root = ""
$ args_loc = f$locate(",boost_root=", args_lower)
$ if args_loc .lt. args_lower_len
$ then
$     arg = f$extract(args_loc + 1, args_lower_len, args_lower)
$     arg_val = f$element(0, ",", arg)
$     boost_root = f$element(1, "=", arg_val)
$ endif
$!
$ if is_tests .eqs. "1" .and. boost_root .eqs. ""
$ then
$     'vo_c' "%PLIBSYS-I-NOTESTS, tests couldn't be built without BOOST_ROOT parameter, disabling."
$     is_tests = 0
$ endif
$!
$ if is_tests .eqs. "0" .and. boost_root .nes. ""
$ then
$     'vo_c' "%PLIBSYS-I-BOOSTIGN, BOOST_ROOT parameter will be ignored without tests enabled."
$ endif
$!
$! Prepare build directory
$! -----------------------
$!
$! When building on a search list, need to do a create to make sure that
$! the output directory exists, since the clean procedure tries to delete
$! it.
$!
$ if f$search("''proc_dev_dir'''arch_name'.DIR") .eqs. ""
$ then
$     create/dir 'objdir'/prot=o:rwed
$ endif
$!
$ set default 'objdir'
$ @[-]deltree CXX_REPOSITORY
$!
$ if f$locate(",nolib,", args_lower) .lt. args_lower_len
$ then
$     goto build_tests
$ endif
$!
$! Generate platform-specific config file
$! --------------------------------------
$!
$ if f$search("plibsysconfig.h") .nes. "" then delete plibsysconfig.h;*
$!
$! Get the version number
$! ----------------------
$!
$ i = 0
$ open/read/error=version_loop_end vhf [---]CMakeLists.txt
$ version_loop:
$     read/end=version_loop_end vhf line_in
$!
$     if line_in .eqs. "" then goto version_loop
$!
$     if f$locate("set (PLIBSYS_VERSION_MAJOR ", line_in) .eq. 0
$     then
$         plibsys_vmajor = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if f$locate("set (PLIBSYS_VERSION_MINOR ", line_in) .eq. 0
$     then
$         plibsys_vminor = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if f$locate("set (PLIBSYS_VERSION_PATCH ", line_in) .eq. 0
$     then
$         plibsys_vpatch = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if f$locate("set (PLIBSYS_VERSION_NUM ", line_in) .eq. 0
$     then
$         plibsys_vnum = f$element(2, " ", line_in) - ")"
$         i = i + 1
$     endif
$!
$     if i .lt 4 then goto version_loop
$ version_loop_end:
$ close vhf
$!
$! Write config file
$! -----------------
$!
$ open/write/error=config_write_end chf plibsysconfig.h
$ write chf "#ifndef PLIBSYS_HEADER_PLIBSYSCONFIG_H"
$ write chf "#define PLIBSYS_HEADER_PLIBSYSCONFIG_H"
$ write chf ""
$ write chf "#define PLIBSYS_VERSION_MAJOR ''plibsys_vmajor'"
$ write chf "#define PLIBSYS_VERSION_MINOR ''plibsys_vminor'"
$ write chf "#define PLIBSYS_VERSION_PATCH ''plibsys_vpatch'"
$ write chf "#define PLIBSYS_VERSION_STR ""''plibsys_vmajor'.''plibsys_vminor'.''plibsys_vpatch'"""
$ write chf "#define PLIBSYS_VERSION ''plibsys_vnum'"
$ write chf ""
$ write chf "#define PLIBSYS_SIZEOF_SAFAMILY_T 1"
$ write chf ""
$ write chf "#include <pmacros.h>"
$ write chf ""
$ write chf "#include <float.h>"
$ write chf "#include <limits.h>"
$ write chf ""
$ write chf "P_BEGIN_DECLS"
$ write chf ""
$ write chf "#define P_MINFLOAT    FLT_MIN"
$ write chf "#define P_MAXFLOAT    FLT_MAX"
$ write chf "#define P_MINDOUBLE   DBL_MIN"
$ write chf "#define P_MAXDOUBLE   DBL_MAX"
$ write chf "#define P_MINSHORT    SHRT_MIN"
$ write chf "#define P_MAXSHORT    SHRT_MAX"
$ write chf "#define P_MAXUSHORT   USHRT_MAX"
$ write chf "#define P_MININT      INT_MIN"
$ write chf "#define P_MAXINT      INT_MAX"
$ write chf "#define P_MAXUINT     UINT_MAX"
$ write chf "#define P_MINLONG     LONG_MIN"
$ write chf "#define P_MAXLONG     LONG_MAX"
$ write chf "#define P_MAXULONG    ULONG_MAX"
$ write chf ""
$ write chf "#define PLIBSYS_MMAP_HAS_MAP_ANONYMOUS"
$ write chf "#define PLIBSYS_HAS_NANOSLEEP"
$ write chf "#define PLIBSYS_HAS_GETADDRINFO"
$ write chf "#define PLIBSYS_HAS_POSIX_SCHEDULING"
$ write chf "#define PLIBSYS_HAS_POSIX_STACKSIZE"
$ write chf "#define PLIBSYS_HAS_SOCKADDR_STORAGE"
$ write chf "#define PLIBSYS_SOCKADDR_HAS_SA_LEN"
$ write chf "#define PLIBSYS_SOCKADDR_IN6_HAS_SCOPEID"
$ write chf "#define PLIBSYS_SOCKADDR_IN6_HAS_FLOWINFO"
$ write chf ""
$!
$ if build_64 .eqs. "1"
$ then
$     write chf "#define PLIBSYS_SIZEOF_VOID_P 8"
$     write chf "#define PLIBSYS_SIZEOF_SIZE_T 8"
$ else
$     write chf "#define PLIBSYS_SIZEOF_VOID_P 4"
$     write chf "#define PLIBSYS_SIZEOF_SIZE_T 4"
$ endif
$!
$ write chf "#define PLIBSYS_SIZEOF_LONG 4"
$ write chf ""
$!
$ if big_endian .eqs. "1"
$ then
$     write chf "#define P_BYTE_ORDER P_BIG_ENDIAN"
$ else
$     write chf "#define P_BYTE_ORDER P_LITTLE_ENDIAN"
$ endif
$!
$ write chf ""
$ write chf "P_END_DECLS"
$ write chf ""
$ write chf "#endif /* PLIBSYS_HEADER_PLIBSYSCONFIG_H */"
$ config_write_end:
$     close chf
$!
$! Prepare sources for compilation
$! -------------------------------
$!
$ cc_link_params = ""
$ cc_params = "/NAMES=(AS_IS,SHORTENED)"
$ cc_params = cc_params + "/DEFINE=(PLIBSYS_COMPILATION,_REENTRANT,_POSIX_EXIT)"
$ cc_params = cc_params + "/INCLUDE_DIRECTORY=(''objdir',''base_src_dir')"
$ cc_params = cc_params + "/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS"
$!
$ if build_64 .eqs. "1"
$ then
$     cc_params = cc_params + "/POINTER_SIZE=64"
$ else
$     cc_params = cc_params + "/POINTER_SIZE=32"
$ endif
$!
$ if cc_extra .nes. ""
$ then
$     cc_params = cc_params + " " + cc_extra
$ endif
$!
$ if is_debug .eqs. "1"
$ then
$     cc_params = cc_params + "/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL"
$     cc_link_params = "/DEBUG/TRACEBACK"
$ else
$     cc_link_params = "/NODEBUG/NOTRACEBACK"
$ endif
$!
$ plibsys_src = "patomic-sim.c pcondvariable-posix.c pcryptohash-gost3411.c pcryptohash-md5.c"
$ plibsys_src = plibsys_src + " pcryptohash-sha1.c pcryptohash-sha2-256.c pcryptohash-sha2-512.c"
$ plibsys_src = plibsys_src + " pcryptohash-sha3.c pcryptohash.c pdir-posix.c pdir.c"
$ plibsys_src = plibsys_src + " perror.c pfile.c phashtable.c pinifile.c pipc.c plibraryloader.c"
$ plibsys_src = plibsys_src + " plist.c pmain.c pmem.c pmutex-posix.c pprocess.c prwlock-posix.c"
$ plibsys_src = plibsys_src + " psemaphore-posix.c pshm-posix.c pshmbuffer.c psocket.c"
$ plibsys_src = plibsys_src + " psocketaddress.c pspinlock-sim.c pstring.c psysclose-unix.c"
$ plibsys_src = plibsys_src + " ptimeprofiler-posix.c ptimeprofiler.c ptree-avl.c ptree-bst.c"
$ plibsys_src = plibsys_src + " ptree-rb.c ptree.c puthread-posix.c puthread.c"
$!
$! Inform about building
$! ---------------------
$!
$ if build_64 .eqs. "1"
$ then
$     'vo_c' "Building for ''arch_name' (64-bit)"
$ else
$     'vo_c' "Building for ''arch_name' (32-bit)"
$ endif
$!
$! Compile library modules
$! -----------------------
$!
$ 'vo_c' "Compiling object modules..."
$ src_counter = 0
$ plibsys_src = f$edit(plibsys_src, "COMPRESS")
$ plibsys_objs = ""
$!
$ src_loop:
$     next_src = f$element (src_counter, " ", plibsys_src)
$     if next_src .nes. "" .and. next_src .nes. " "
$     then
$         'vo_c' "[CC] ''next_src'"
$         cc [---.src]'next_src' 'cc_params'
$!
$         src_counter = src_counter + 1
$!
$         obj_file = f$extract (0, f$length (next_src) - 1, next_src) + "obj"
$         plibsys_objs = plibsys_objs + "''obj_file',"
$         purge 'obj_file'
$!
$         goto src_loop
$     endif
$!
$ plibsys_objs = f$extract (0, f$length (plibsys_objs) - 1, plibsys_objs)
$!
$! Create library
$! --------------
$!
$ 'vo_c' "Creating object library..."
$ library/CREATE/INSERT/REPLACE /LIST=PLIBSYS.LIS PLIBSYS.OLB 'plibsys_objs'
$ library/COMPRESS PLIBSYS.OLB
$ purge PLIBSYS.OLB
$ purge PLIBSYS.LIS
$!
$ 'vo_c' "Creating shared library..."
$ link/SHAREABLE=PLIBSYS.EXE /MAP=PLIBSYS.MAP 'cc_link_params' 'plibsys_objs', [-]plibsys.opt/OPTION
$ purge PLIBSYS.EXE
$ purge PLIBSYS.MAP
$!
$! Testing area
$! ------------
$!
$ build_tests:
$ test_list_full = "patomic pcondvariable pcryptohash pdir"
$ test_list_full = test_list_full + " perror pfile phashtable pinifile plibraryloader plist"
$ test_list_full = test_list_full + " pmacros pmain pmem pmutex pprocess prwlock psemaphore"
$ test_list_full = test_list_full + " pshm pshmbuffer psocket psocketaddress pspinlock pstring"
$ test_list_full = test_list_full + " ptimeprofiler ptree ptypes puthread"
$!
$ if is_tests .eqs. "0"
$ then
$     goto build_done
$ endif
$!
$! Write link options file
$! -----------------------
$!
$ if f$search("plibsys_link.opt") .nes. "" then delete plibsys_link.opt;*
$!
$ open/write/error=link_write_end lhf plibsys_link.opt
$ write lhf "''objdir'PLIBSYS.EXE/SHARE"
$ write lhf ""
$ link_write_end:
$     close lhf
$!
$! Compile tests
$! -------------------------
$!
$ if test_list .nes. ""
$ then
$     plibsys_tests = f$edit(test_list, "TRIM")
$ else
$     plibsys_tests = test_list_full
$ endif
$!
$ 'vo_c' "Compiling test executables..."
$ test_counter = 0
$ plibsys_tests = f$edit(plibsys_tests, "COMPRESS")
$!
$ cxx_params = "/INCLUDE=(''objdir',''base_src_dir',""''boost_root'"")"
$ cxx_params = cxx_params + "/DEFINE=(__USE_STD_IOSTREAM,PLIBSYS_TESTS_STATIC)/NAMES=(AS_IS, SHORTENED)"
$ cxx_params = cxx_params + "/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS"
$!
$ if build_64 .eqs. "1"
$ then
$     cxx_params = cxx_params + "/POINTER_SIZE=64"
$ else
$     cxx_params = cxx_params + "/POINTER_SIZE=32"
$ endif
$!
$ if is_debug .eqs. "1"
$ then
$     cxx_params = cxx_params + "/DEBUG/NOOPTIMIZE/LIST/SHOW=ALL"
$ endif
$!
$ test_loop:
$     next_test = f$element (test_counter, " ", plibsys_tests)
$     if next_test .nes. "" .and. next_test .nes. " "
$     then
$         next_test = next_test + "_test"
$         'vo_c' "[CXX    ] ''next_test'.cpp"
$         cxx [---.tests]'next_test'.cpp 'cxx_params'
$!
$         'vo_c' "[CXXLINK] ''next_test'.obj"
$          cxxlink 'next_test'.obj,'objdir'plibsys_link.opt/OPTION /THREADS_ENABLE
$!
$         @[-]deltree CXX_REPOSITORY
$         purge 'next_test'.obj
$         purge 'next_test'.exe
$!
$         test_counter = test_counter + 1
$         goto test_loop
$     endif
$!
$ build_done:
$     'vo_c' "Build done."
$!
$! Run unit tests
$! --------------
$!
$ if run_tests .eqs. "0"
$ then
$     goto common_exit
$ endif
$!
$ 'vo_c' "Running tests..."
$ test_counter = 0
$ tests_passed = 0
$!
$ run_loop:
$     next_test = f$element (test_counter, " ", test_list_full)
$     if next_test .nes. "" .and. next_test .nes. " "
$     then
$         if f$search("''next_test'_test.exe") .eqs. ""
$         then
$             'vo_c' "[SKIP] ''next_test'"
$             goto run_loop_next
$         endif
$!
$         'vo_c' "[RUN ] ''next_test'"
$!
$         define/user sys$error NL:
$         define/user sys$output NL:
$         define/user plibsys 'objdir'PLIBSYS.EXE
$         define/user test_imgdir 'objdir'
$!
$         xrun := $test_imgdir:'next_test'_test.exe
$         if next_test .eqs. "plibraryloader"
$         then
$             xrun 'objdir'PLIBSYS.EXE
$         else
$             xrun
$         endif
$!
$         if $STATUS .eqs. "%X00000001"
$         then
$             'vo_c' "[PASS] Test passed: ''next_test'"
$             tests_passed = tests_passed + 1
$         else
$             'vo_c' "[FAIL] *** Test failed: ''next_test'"
$         endif
$!
$ run_loop_next:
$         test_counter = test_counter + 1
$         goto run_loop
$     endif
$!
$ 'vo_c' "Tests passed: ''tests_passed'/''test_counter'"
$!
$ common_exit:
$     set default 'orig_def'
$     exit