1$! 2$! MAKEENGINES.COM 3$! Written By: Richard Levitte 4$! richard@levitte.org 5$! 6$! This command file compiles and creates the various engines in form 7$! of shared images. They are placed in [.xxx.EXE.ENGINES], where "xxx" 8$! is ALPHA, IA64 or VAX, depending on your hardware. 9$! 10$! P1 if this is ENGINES or ALL, the engines will build, otherwise not. 11$! 12$! P2 DEBUG or NODEBUG to compile with or without debugger information. 13$! 14$! P3 VAXC for VAX C 15$! DECC for DEC C 16$! GNUC for GNU C (untested) 17$! 18$! P4 if defined, sets the TCP/IP libraries to use. UCX or TCPIP is 19$! used by default since most other implementations come with a 20$! compatibility library. The value must be one of the following: 21$! 22$! UCX for UCX 23$! SOCKETSHR for SOCKETSHR+NETLIB 24$! TCPIP for TCPIP (post UCX) 25$! 26$! P5 if defined, tells the compiler not to use special threads. 27$! 28$! P6 if defined, denotes which engines to build. If not defined, 29$! all available engines are built. 30$! 31$! P7, if defined, specifies the C pointer size. Ignored on VAX. 32$! ("64=ARGV" gives more efficient code with HP C V7.3 or newer.) 33$! Supported values are: 34$! 35$! "" Compile with default (/NOPOINTER_SIZE) 36$! 32 Compile with /POINTER_SIZE=32 (SHORT) 37$! 64 Compile with /POINTER_SIZE=64[=ARGV] (LONG[=ARGV]) 38$! (Automatically select ARGV if compiler supports it.) 39$! 64= Compile with /POINTER_SIZE=64 (LONG). 40$! 64=ARGV Compile with /POINTER_SIZE=64=ARGV (LONG=ARGV). 41$! 42$! P8, if defined, specifies a directory where ZLIB files (zlib.h, 43$! libz.olb) may be found. Optionally, a non-default object library 44$! name may be included ("dev:[dir]libz_64.olb", for example). 45$! 46$!----------------------------------------------------------------------------- 47$! 48$! Announce/identify. 49$! 50$ proc = f$environment( "procedure") 51$ write sys$output "@@@ "+ - 52 f$parse( proc, , , "name")+ f$parse( proc, , , "type") 53$! 54$ on control_c then goto exit 55$! 56$! Set the default TCP/IP library to link against if needed 57$! 58$ TCPIP_LIB = "" 59$ ZLIB_LIB = "" 60$! 61$! Check What Architecture We Are Using. 62$! 63$ IF (F$GETSYI("CPU").LT.128) 64$ THEN 65$! 66$! The Architecture Is VAX. 67$! 68$ ARCH = "VAX" 69$! 70$! Else... 71$! 72$ ELSE 73$! 74$! The Architecture Is Alpha, IA64 or whatever comes in the future. 75$! 76$ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE") 77$ IF (ARCH .EQS. "") THEN ARCH = "UNK" 78$! 79$! End The Architecture Check. 80$! 81$ ENDIF 82$! 83$ ARCHD = ARCH 84$ LIB32 = "32" 85$ OPT_FILE = "" 86$ POINTER_SIZE = "" 87$! 88$! Set the names of the engines we want to build 89$! NOTE: Some might think this list ugly. However, it's made this way to 90$! reflect the LIBNAMES variable in Makefile as closely as possible, 91$! thereby making it fairly easy to verify that the lists are the same. 92$! NOTE: gmp isn't built, as it's mostly a test engine and brings in another 93$! library that isn't necessarely ported to VMS. 94$! 95$ ENGINES = "," + P6 96$ IF ENGINES .EQS. "," THEN - 97 ENGINES = ",4758cca,aep,atalla,cswift,chil,nuron,sureware,ubsec,padlock," 98$! 99$! GOST requires a 64-bit integer type, unavailable on VAX. 100$! 101$ IF (ARCH .NES. "VAX") THEN - 102 ENGINES = ENGINES+ ",ccgost" 103$! 104$! Check options. 105$! 106$ OPT_PHASE = P1 107$ ACCEPT_PHASE = "ALL,ENGINES" 108$ OPT_DEBUG = P2 109$ OPT_COMPILER = P3 110$ OPT_TCPIP_LIB = P4 111$ OPT_SPECIAL_THREADS = P5 112$ OPT_POINTER_SIZE = P7 113$ ZLIB = P8 114$ 115$ GOSUB CHECK_OPTIONS 116$! 117$! Set the goal directories, and create them if necessary 118$! 119$ OBJ_DIR := SYS$DISK:[-.'ARCHD'.OBJ.ENGINES] 120$ EXE_DIR := SYS$DISK:[-.'ARCHD'.EXE.ENGINES] 121$ IF F$PARSE(OBJ_DIR) .EQS. "" THEN CREATE/DIRECTORY 'OBJ_DIR' 122$ IF F$PARSE(EXE_DIR) .EQS. "" THEN CREATE/DIRECTORY 'EXE_DIR' 123$! 124$! Set the goal files, and create them if necessary 125$! 126$ CRYPTO_LIB := SYS$DISK:[-.'ARCHD'.EXE.CRYPTO]SSL_LIBCRYPTO'LIB32'.OLB 127$ IF F$SEARCH(CRYPTO_LIB) .EQS. "" THEN LIBRARY/CREATE/OBJECT 'CRYPTO_LIB' 128$! 129$! Specify the destination directory in any /MAP option. 130$! 131$ if (LINKMAP .eqs. "MAP") 132$ then 133$ LINKMAP = LINKMAP+ "=''EXE_DIR'" 134$ endif 135$! 136$! Add the location prefix to the linker options file name. 137$! 138$ if (OPT_FILE .nes. "") 139$ then 140$ OPT_FILE = EXE_DIR+ OPT_FILE 141$ endif 142$! 143$! Initialise. 144$! 145$ GOSUB INITIALISE 146$ GOSUB CHECK_OPT_FILE 147$! 148$! Define what goes into each engine. VAX includes a transfer vector. 149$! 150$ ENGINE_ = "" 151$ TV_OBJ = "" 152$ IF ARCH .EQS. "VAX" 153$ THEN 154$ ENGINE_ = "engine_vector.mar" 155$ TV_OBJ_NAME = OBJ_DIR + F$PARSE(ENGINE_,,,"NAME","SYNTAX_ONLY") + ".OBJ" 156$ TV_OBJ = ",''TV_OBJ_NAME'" 157$ ENDIF 158$ ENGINE_4758cca = "e_4758cca" 159$ ENGINE_aep = "e_aep" 160$ ENGINE_atalla = "e_atalla" 161$ ENGINE_cswift = "e_cswift" 162$ ENGINE_chil = "e_chil" 163$ ENGINE_nuron = "e_nuron" 164$ ENGINE_sureware = "e_sureware" 165$ ENGINE_ubsec = "e_ubsec" 166$ ENGINE_padlock = "e_padlock" 167$ 168$ ENGINE_ccgost_SUBDIR = "ccgost" 169$ ENGINE_ccgost = "e_gost_err,gost2001_keyx,gost2001,gost89,gost94_keyx,"+ - 170 "gost_ameth,gost_asn1,gost_crypt,gost_ctl,gost_eng,"+ - 171 "gosthash,gost_keywrap,gost_md,gost_params,gost_pmeth,"+ - 172 "gost_sign" 173$! 174$! Define which programs need to be linked with a TCP/IP library 175$! 176$ TCPIP_ENGINES = ",," 177$ IF COMPILER .EQS. "VAXC" THEN - 178 TCPIP_ENGINES = ",," 179$! 180$! Set up two loops, one that keeps track of the engines, 181$! and one that keeps track of all the files going into 182$! the current engine. 183$! 184$! Here's the start of the engine loop. 185$! 186$ ENGINE_COUNTER = 0 187$ ENGINE_NEXT: 188$! 189$! Extract the current engine name, and if we've reached the end, stop 190$! 191$ ENGINE_NAME = F$ELEMENT(ENGINE_COUNTER,",",ENGINES) 192$ IF (ENGINE_NAME.EQS.",") THEN GOTO ENGINE_DONE 193$! 194$ ENGINE_COUNTER = ENGINE_COUNTER + 1 195$! 196$! Set up the engine library names. 197$! 198$ LIB_ENGINE = "ENGINE_" + ENGINE_NAME 199$! 200$! Check if the library module name actually is defined 201$! 202$ IF F$TYPE('LIB_ENGINE') .EQS. "" 203$ THEN 204$ WRITE SYS$ERROR "" 205$ WRITE SYS$ERROR "The module ",ENGINE_NAME," does not exist. Continuing..." 206$ WRITE SYS$ERROR "" 207$ GOTO ENGINE_NEXT 208$ ENDIF 209$! 210$! Talk to the user 211$! 212$ IF ENGINE_NAME .NES. "" 213$ THEN 214$ WRITE SYS$OUTPUT "Compiling The ",ENGINE_NAME," Library Files. (",BUILDALL,")" 215$ ELSE 216$ WRITE SYS$OUTPUT "Compiling Support Files. (",BUILDALL,")" 217$ ENDIF 218$! 219$! Create a .OPT file for the object files (for a real engine name). 220$! 221$ IF ENGINE_NAME .NES. "" 222$ THEN 223$ OPEN /WRITE OBJECTS 'EXE_DIR''ENGINE_NAME'.OPT 224$ ENDIF 225$! 226$! Here's the start of per-engine module loop. 227$! 228$ FILE_COUNTER = 0 229$ FILE_NEXT: 230$! 231$! Extract the file name from the file list, and if we've reached the end, stop 232$! 233$ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",'LIB_ENGINE') 234$ IF (FILE_NAME.EQS.",") THEN GOTO FILE_DONE 235$! 236$ FILE_COUNTER = FILE_COUNTER + 1 237$! 238$ IF FILE_NAME .EQS. "" THEN GOTO FILE_NEXT 239$! 240$! Set up the source and object reference 241$! 242$ IF F$TYPE('LIB_ENGINE'_SUBDIR) .EQS. "" 243$ THEN 244$ SOURCE_FILE = F$PARSE(FILE_NAME,"SYS$DISK:[].C",,,"SYNTAX_ONLY") 245$ ELSE 246$ SOURCE_FILE = F$PARSE(FILE_NAME,"SYS$DISK:[."+'LIB_ENGINE'_SUBDIR+"].C",,,"SYNTAX_ONLY") 247$ ENDIF 248$ OBJECT_FILE = OBJ_DIR + F$PARSE(FILE_NAME,,,"NAME","SYNTAX_ONLY") + ".OBJ" 249$! 250$! If we get some problem, we just go on trying to build the next module. 251$ ON WARNING THEN GOTO FILE_NEXT 252$! 253$! Check if the module we want to compile is actually there. 254$! 255$ IF F$SEARCH(SOURCE_FILE) .EQS. "" 256$ THEN 257$ WRITE SYS$OUTPUT "" 258$ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Doesn't Exist." 259$ WRITE SYS$OUTPUT "" 260$ GOTO EXIT 261$ ENDIF 262$! 263$! Talk to the user. 264$! 265$ WRITE SYS$OUTPUT " ",FILE_NAME,"" 266$! 267$! Do the dirty work. 268$! 269$ ON ERROR THEN GOTO FILE_NEXT 270$ IF F$EDIT(F$PARSE(SOURCE_FILE,,,"TYPE","SYNTAX_ONLY"),"UPCASE") .EQS. ".MAR" 271$ THEN 272$ MACRO/OBJECT='OBJECT_FILE' 'SOURCE_FILE' 273$ ELSE 274$ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE' 275$ ENDIF 276$! 277$! Write the entry to the .OPT file (for a real engine name). 278$! 279$ IF ENGINE_NAME .NES. "" 280$ THEN 281$ WRITE OBJECTS OBJECT_FILE 282$ ENDIF 283$! 284$! Next file 285$! 286$ GOTO FILE_NEXT 287$! 288$ FILE_DONE: 289$! 290$! Do not link the support files. 291$! 292$ IF ENGINE_NAME .EQS. "" THEN GOTO ENGINE_NEXT 293$! 294$! Close the linker options file (for a real engine name). 295$! 296$ CLOSE OBJECTS 297$! 298$! Now, there are two ways to handle this. We can either build 299$! shareable images or stick the engine object file into libcrypto. 300$! For now, the latter is NOT supported. 301$! 302$!!!!! LIBRARY/REPLACE 'CRYPTO_LIB' 'OBJECT_FILE' 303$! 304$! For shareable libraries, we need to do things a little differently 305$! depending on if we link with a TCP/IP library or not. 306$! 307$ ENGINE_OPT := SYS$DISK:[]'ARCH'.OPT 308$ LINK /'DEBUGGER' /'LINKMAP' /'TRACEBACK' /SHARE='EXE_DIR''ENGINE_NAME'.EXE - 309 'EXE_DIR''ENGINE_NAME'.OPT /OPTIONS - 310 'TV_OBJ', - 311 'CRYPTO_LIB' /LIBRARY, - 312 'ENGINE_OPT' /OPTIONS - 313 'TCPIP_LIB' - 314 'ZLIB_LIB' - 315 ,'OPT_FILE' /OPTIONS 316$! 317$! Next engine 318$! 319$ GOTO ENGINE_NEXT 320$! 321$ ENGINE_DONE: 322$! 323$! Talk to the user 324$! 325$ WRITE SYS$OUTPUT "All Done..." 326$ EXIT: 327$ GOSUB CLEANUP 328$ EXIT 329$! 330$! Check For The Link Option FIle. 331$! 332$ CHECK_OPT_FILE: 333$! 334$! Check To See If We Need To Make A VAX C Option File. 335$! 336$ IF (COMPILER.EQS."VAXC") 337$ THEN 338$! 339$! Check To See If We Already Have A VAX C Linker Option File. 340$! 341$ IF (F$SEARCH(OPT_FILE).EQS."") 342$ THEN 343$! 344$! We Need A VAX C Linker Option File. 345$! 346$ CREATE 'OPT_FILE' 347$DECK 348! 349! Default System Options File To Link Against 350! The Sharable VAX C Runtime Library. 351! 352SYS$SHARE:VAXCRTL.EXE/SHARE 353$EOD 354$! 355$! End The Option File Check. 356$! 357$ ENDIF 358$! 359$! End The VAXC Check. 360$! 361$ ENDIF 362$! 363$! Check To See If We Need A GNU C Option File. 364$! 365$ IF (COMPILER.EQS."GNUC") 366$ THEN 367$! 368$! Check To See If We Already Have A GNU C Linker Option File. 369$! 370$ IF (F$SEARCH(OPT_FILE).EQS."") 371$ THEN 372$! 373$! We Need A GNU C Linker Option File. 374$! 375$ CREATE 'OPT_FILE' 376$DECK 377! 378! Default System Options File To Link Against 379! The Sharable C Runtime Library. 380! 381GNU_CC:[000000]GCCLIB/LIBRARY 382SYS$SHARE:VAXCRTL/SHARE 383$EOD 384$! 385$! End The Option File Check. 386$! 387$ ENDIF 388$! 389$! End The GNU C Check. 390$! 391$ ENDIF 392$! 393$! Check To See If We Need A DEC C Option File. 394$! 395$ IF (COMPILER.EQS."DECC") 396$ THEN 397$! 398$! Check To See If We Already Have A DEC C Linker Option File. 399$! 400$ IF (F$SEARCH(OPT_FILE).EQS."") 401$ THEN 402$! 403$! Figure Out If We Need A non-VAX Or A VAX Linker Option File. 404$! 405$ IF ARCH .EQS. "VAX" 406$ THEN 407$! 408$! We Need A DEC C Linker Option File For VAX. 409$! 410$ CREATE 'OPT_FILE' 411$DECK 412! 413! Default System Options File To Link Against 414! The Sharable DEC C Runtime Library. 415! 416SYS$SHARE:DECC$SHR.EXE/SHARE 417$EOD 418$! 419$! Else... 420$! 421$ ELSE 422$! 423$! Create The non-VAX Linker Option File. 424$! 425$ CREATE 'OPT_FILE' 426$DECK 427! 428! Default System Options File For non-VAX To Link Against 429! The Sharable C Runtime Library. 430! 431SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE 432SYS$SHARE:CMA$OPEN_RTL/SHARE 433$EOD 434$! 435$! End The DEC C Option File Check. 436$! 437$ ENDIF 438$! 439$! End The Option File Search. 440$! 441$ ENDIF 442$! 443$! End The DEC C Check. 444$! 445$ ENDIF 446$! 447$! Tell The User What Linker Option File We Are Using. 448$! 449$ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"." 450$! 451$! Time To RETURN. 452$! 453$ RETURN 454$! 455$! Check The User's Options. 456$! 457$ CHECK_OPTIONS: 458$! 459$! Check To See If OPT_PHASE Is Blank. 460$! 461$ IF (OPT_PHASE.EQS."ALL") 462$ THEN 463$! 464$! OPT_PHASE Is Blank, So Build Everything. 465$! 466$ BUILDALL = "ALL" 467$! 468$! Else... 469$! 470$ ELSE 471$! 472$! Else, Check To See If OPT_PHASE Has A Valid Argument. 473$! 474$ IF ("," + ACCEPT_PHASE + ",") - ("," + OPT_PHASE + ",") - 475 .NES. ("," + ACCEPT_PHASE + ",") 476$ THEN 477$! 478$! A Valid Argument. 479$! 480$ BUILDALL = OPT_PHASE 481$! 482$! Else... 483$! 484$ ELSE 485$! 486$! Tell The User We Don't Know What They Want. 487$! 488$ WRITE SYS$OUTPUT "" 489$ WRITE SYS$OUTPUT "The option ",OPT_PHASE," is invalid. The valid options are:" 490$ WRITE SYS$OUTPUT "" 491$ IF ("," + ACCEPT_PHASE + ",") - ",ALL," - 492 .NES. ("," + ACCEPT_PHASE + ",") THEN - 493 WRITE SYS$OUTPUT " ALL : just build everything." 494$ IF ("," + ACCEPT_PHASE + ",") - ",ENGINES," - 495 .NES. ("," + ACCEPT_PHASE + ",") THEN - 496 WRITE SYS$OUTPUT " ENGINES : to compile just the [.xxx.EXE.ENGINES]*.EXE hareable images." 497$ WRITE SYS$OUTPUT "" 498$ WRITE SYS$OUTPUT " where 'xxx' stands for:" 499$ WRITE SYS$OUTPUT "" 500$ WRITE SYS$OUTPUT " ALPHA[64]: Alpha architecture." 501$ WRITE SYS$OUTPUT " IA64[64] : IA64 architecture." 502$ WRITE SYS$OUTPUT " VAX : VAX architecture." 503$ WRITE SYS$OUTPUT "" 504$! 505$! Time To EXIT. 506$! 507$ EXIT 508$! 509$! End The Valid Argument Check. 510$! 511$ ENDIF 512$! 513$! End The OPT_PHASE Check. 514$! 515$ ENDIF 516$! 517$! Check To See If OPT_DEBUG Is Blank. 518$! 519$ IF (OPT_DEBUG.EQS."NODEBUG") 520$ THEN 521$! 522$! OPT_DEBUG Is NODEBUG, So Compile Without The Debugger Information. 523$! 524$ DEBUGGER = "NODEBUG" 525$ LINKMAP = "NOMAP" 526$ TRACEBACK = "NOTRACEBACK" 527$ GCC_OPTIMIZE = "OPTIMIZE" 528$ CC_OPTIMIZE = "OPTIMIZE" 529$ MACRO_OPTIMIZE = "OPTIMIZE" 530$ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile." 531$ WRITE SYS$OUTPUT "Compiling With Compiler Optimization." 532$ ELSE 533$! 534$! Check To See If We Are To Compile With Debugger Information. 535$! 536$ IF (OPT_DEBUG.EQS."DEBUG") 537$ THEN 538$! 539$! Compile With Debugger Information. 540$! 541$ DEBUGGER = "DEBUG" 542$ LINKMAP = "MAP" 543$ TRACEBACK = "TRACEBACK" 544$ GCC_OPTIMIZE = "NOOPTIMIZE" 545$ CC_OPTIMIZE = "NOOPTIMIZE" 546$ MACRO_OPTIMIZE = "NOOPTIMIZE" 547$ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile." 548$ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization." 549$ ELSE 550$! 551$! They Entered An Invalid Option. 552$! 553$ WRITE SYS$OUTPUT "" 554$ WRITE SYS$OUTPUT "The Option ",OPT_DEBUG," Is Invalid. The Valid Options Are:" 555$ WRITE SYS$OUTPUT "" 556$ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information." 557$ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information." 558$ WRITE SYS$OUTPUT "" 559$! 560$! Time To EXIT. 561$! 562$ EXIT 563$! 564$! End The Valid Argument Check. 565$! 566$ ENDIF 567$! 568$! End The OPT_DEBUG Check. 569$! 570$ ENDIF 571$! 572$! Special Threads For OpenVMS v7.1 Or Later 573$! 574$! Written By: Richard Levitte 575$! richard@levitte.org 576$! 577$! 578$! Check To See If We Have A Option For OPT_SPECIAL_THREADS. 579$! 580$ IF (OPT_SPECIAL_THREADS.EQS."") 581$ THEN 582$! 583$! Get The Version Of VMS We Are Using. 584$! 585$ ISSEVEN := 586$ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION"))) 587$ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP)) 588$! 589$! Check To See If The VMS Version Is v7.1 Or Later. 590$! 591$ IF (TMP.GE.71) 592$ THEN 593$! 594$! We Have OpenVMS v7.1 Or Later, So Use The Special Threads. 595$! 596$ ISSEVEN := ,PTHREAD_USE_D4 597$! 598$! End The VMS Version Check. 599$! 600$ ENDIF 601$! 602$! End The OPT_SPECIAL_THREADS Check. 603$! 604$ ENDIF 605$! 606$! Check OPT_POINTER_SIZE (P7). 607$! 608$ IF (OPT_POINTER_SIZE .NES. "") .AND. (ARCH .NES. "VAX") 609$ THEN 610$! 611$ IF (OPT_POINTER_SIZE .EQS. "32") 612$ THEN 613$ POINTER_SIZE = " /POINTER_SIZE=32" 614$ ELSE 615$ POINTER_SIZE = F$EDIT( OPT_POINTER_SIZE, "COLLAPSE, UPCASE") 616$ IF ((POINTER_SIZE .EQS. "64") .OR. - 617 (POINTER_SIZE .EQS. "64=") .OR. - 618 (POINTER_SIZE .EQS. "64=ARGV")) 619$ THEN 620$ ARCHD = ARCH+ "_64" 621$ LIB32 = "" 622$ POINTER_SIZE = " /POINTER_SIZE=64" 623$ ELSE 624$! 625$! Tell The User Entered An Invalid Option. 626$! 627$ WRITE SYS$OUTPUT "" 628$ WRITE SYS$OUTPUT "The Option ", OPT_POINTER_SIZE, - 629 " Is Invalid. The Valid Options Are:" 630$ WRITE SYS$OUTPUT "" 631$ WRITE SYS$OUTPUT - 632 " """" : Compile with default (short) pointers." 633$ WRITE SYS$OUTPUT - 634 " 32 : Compile with 32-bit (short) pointers." 635$ WRITE SYS$OUTPUT - 636 " 64 : Compile with 64-bit (long) pointers (auto ARGV)." 637$ WRITE SYS$OUTPUT - 638 " 64= : Compile with 64-bit (long) pointers (no ARGV)." 639$ WRITE SYS$OUTPUT - 640 " 64=ARGV : Compile with 64-bit (long) pointers (ARGV)." 641$ WRITE SYS$OUTPUT "" 642$! 643$! Time To EXIT. 644$! 645$ EXIT 646$! 647$ ENDIF 648$! 649$ ENDIF 650$! 651$! End The OPT_POINTER_SIZE Check. 652$! 653$ ENDIF 654$! 655$! Set basic C compiler /INCLUDE directories. 656$! 657$ CC_INCLUDES = "SYS$DISK:[],SYS$DISK:[.VENDOR_DEFNS]" 658$! 659$! Check To See If OPT_COMPILER Is Blank. 660$! 661$ IF (OPT_COMPILER.EQS."") 662$ THEN 663$! 664$! O.K., The User Didn't Specify A Compiler, Let's Try To 665$! Find Out Which One To Use. 666$! 667$! Check To See If We Have GNU C. 668$! 669$ IF (F$TRNLNM("GNU_CC").NES."") 670$ THEN 671$! 672$! Looks Like GNUC, Set To Use GNUC. 673$! 674$ OPT_COMPILER = "GNUC" 675$! 676$! Else... 677$! 678$ ELSE 679$! 680$! Check To See If We Have VAXC Or DECC. 681$! 682$ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."") 683$ THEN 684$! 685$! Looks Like DECC, Set To Use DECC. 686$! 687$ OPT_COMPILER = "DECC" 688$! 689$! Else... 690$! 691$ ELSE 692$! 693$! Looks Like VAXC, Set To Use VAXC. 694$! 695$ OPT_COMPILER = "VAXC" 696$! 697$! End The VAXC Compiler Check. 698$! 699$ ENDIF 700$! 701$! End The DECC & VAXC Compiler Check. 702$! 703$ ENDIF 704$! 705$! End The Compiler Check. 706$! 707$ ENDIF 708$! 709$! Check To See If We Have A Option For OPT_TCPIP_LIB. 710$! 711$ IF (OPT_TCPIP_LIB.EQS."") 712$ THEN 713$! 714$! Find out what socket library we have available 715$! 716$ IF F$PARSE("SOCKETSHR:") .NES. "" 717$ THEN 718$! 719$! We have SOCKETSHR, and it is my opinion that it's the best to use. 720$! 721$ OPT_TCPIP_LIB = "SOCKETSHR" 722$! 723$! Tell the user 724$! 725$ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP" 726$! 727$! Else, let's look for something else 728$! 729$ ELSE 730$! 731$! Like UCX (the reason to do this before Multinet is that the UCX 732$! emulation is easier to use...) 733$! 734$ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" - 735 .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" - 736 .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. "" 737$ THEN 738$! 739$! Last resort: a UCX or UCX-compatible library 740$! 741$ OPT_TCPIP_LIB = "UCX" 742$! 743$! Tell the user 744$! 745$ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP" 746$! 747$! That was all... 748$! 749$ ENDIF 750$ ENDIF 751$ ENDIF 752$! 753$! Set Up Initial CC Definitions, Possibly With User Ones 754$! 755$ CCDEFS = "TCPIP_TYPE_''OPT_TCPIP_LIB',DSO_VMS" 756$ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS 757$ CCEXTRAFLAGS = "" 758$ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS 759$ CCDISABLEWARNINGS = "" !!! "MAYLOSEDATA3" !!! "LONGLONGTYPE,LONGLONGSUFX" 760$ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" 761$ THEN 762$ IF CCDISABLEWARNINGS .NES. THEN CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," 763$ CCDISABLEWARNINGS = CCDISABLEWARNINGS + USER_CCDISABLEWARNINGS 764$ ENDIF 765$! 766$! Check To See If We Have A ZLIB Option. 767$! 768$ IF (ZLIB .NES. "") 769$ THEN 770$! 771$! Check for expected ZLIB files. 772$! 773$ err = 0 774$ file1 = f$parse( "zlib.h", ZLIB, , , "SYNTAX_ONLY") 775$ if (f$search( file1) .eqs. "") 776$ then 777$ WRITE SYS$OUTPUT "" 778$ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid." 779$ WRITE SYS$OUTPUT " Can't find header: ''file1'" 780$ err = 1 781$ endif 782$ file1 = f$parse( "A.;", ZLIB)- "A.;" 783$! 784$ file2 = f$parse( ZLIB, "libz.olb", , , "SYNTAX_ONLY") 785$ if (f$search( file2) .eqs. "") 786$ then 787$ if (err .eq. 0) 788$ then 789$ WRITE SYS$OUTPUT "" 790$ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid." 791$ endif 792$ WRITE SYS$OUTPUT " Can't find library: ''file2'" 793$ WRITE SYS$OUTPUT "" 794$ err = err+ 2 795$ endif 796$ if (err .eq. 1) 797$ then 798$ WRITE SYS$OUTPUT "" 799$ endif 800$! 801$ if (err .ne. 0) 802$ then 803$ EXIT 804$ endif 805$! 806$ CCDEFS = """ZLIB=1"", "+ CCDEFS 807$ CC_INCLUDES = CC_INCLUDES+ ", "+ file1 808$ ZLIB_LIB = ", ''file2' /library" 809$! 810$! Print info 811$! 812$ WRITE SYS$OUTPUT "ZLIB library spec: ", file2 813$! 814$! End The ZLIB Check. 815$! 816$ ENDIF 817$! 818$! Check To See If The User Entered A Valid Parameter. 819$! 820$ IF (OPT_COMPILER.EQS."VAXC").OR.(OPT_COMPILER.EQS."DECC").OR.(OPT_COMPILER.EQS."GNUC") 821$ THEN 822$! 823$! Check To See If The User Wanted DECC. 824$! 825$ IF (OPT_COMPILER.EQS."DECC") 826$ THEN 827$! 828$! Looks Like DECC, Set To Use DECC. 829$! 830$ COMPILER = "DECC" 831$! 832$! Tell The User We Are Using DECC. 833$! 834$ WRITE SYS$OUTPUT "Using DECC 'C' Compiler." 835$! 836$! Use DECC... 837$! 838$ CC = "CC" 839$ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" - 840 THEN CC = "CC/DECC" 841$ CC = CC + " /''CC_OPTIMIZE' /''DEBUGGER' /STANDARD=RELAXED"+ - 842 "''POINTER_SIZE' /NOLIST /PREFIX=ALL" + - 843 " /INCLUDE=(''CC_INCLUDES') " + - 844 CCEXTRAFLAGS 845$! 846$! Define The Linker Options File Name. 847$! 848$ OPT_FILE = "VAX_DECC_OPTIONS.OPT" 849$! 850$! End DECC Check. 851$! 852$ ENDIF 853$! 854$! Check To See If We Are To Use VAXC. 855$! 856$ IF (OPT_COMPILER.EQS."VAXC") 857$ THEN 858$! 859$! Looks Like VAXC, Set To Use VAXC. 860$! 861$ COMPILER = "VAXC" 862$! 863$! Tell The User We Are Using VAX C. 864$! 865$ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler." 866$! 867$! Compile Using VAXC. 868$! 869$ CC = "CC" 870$ IF ARCH.NES."VAX" 871$ THEN 872$ WRITE SYS$OUTPUT "There is no VAX C on Alpha!" 873$ EXIT 874$ ENDIF 875$ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC" 876$ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - 877 "/INCLUDE=(''CC_INCLUDES')" + - 878 CCEXTRAFLAGS 879$ CCDEFS = """VAXC""," + CCDEFS 880$! 881$! Define <sys> As SYS$COMMON:[SYSLIB] 882$! 883$ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB] 884$! 885$! Define The Linker Options File Name. 886$! 887$ OPT_FILE = "VAX_VAXC_OPTIONS.OPT" 888$! 889$! End VAXC Check 890$! 891$ ENDIF 892$! 893$! Check To See If We Are To Use GNU C. 894$! 895$ IF (OPT_COMPILER.EQS."GNUC") 896$ THEN 897$! 898$! Looks Like GNUC, Set To Use GNUC. 899$! 900$ COMPILER = "GNUC" 901$! 902$! Tell The User We Are Using GNUC. 903$! 904$ WRITE SYS$OUTPUT "Using GNU 'C' Compiler." 905$! 906$! Use GNU C... 907$! 908$ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + - 909 "/INCLUDE=(''CC_INCLUDES')" + - 910 CCEXTRAFLAGS 911$! 912$! Define The Linker Options File Name. 913$! 914$ OPT_FILE = "VAX_GNUC_OPTIONS.OPT" 915$! 916$! End The GNU C Check. 917$! 918$ ENDIF 919$! 920$! Set up default defines 921$! 922$ CCDEFS = """FLAT_INC=1""," + CCDEFS 923$! 924$! Finish up the definition of CC. 925$! 926$ IF COMPILER .EQS. "DECC" 927$ THEN 928$! Not all compiler versions support MAYLOSEDATA3. 929$ OPT_TEST = "MAYLOSEDATA3" 930$ DEFINE /USER_MODE SYS$ERROR NL: 931$ DEFINE /USER_MODE SYS$OUTPUT NL: 932$ 'CC' /NOCROSS_REFERENCE /NOLIST /NOOBJECT - 933 /WARNINGS = DISABLE = ('OPT_TEST', EMPTYFILE) NL: 934$ IF ($SEVERITY) 935$ THEN 936$ IF CCDISABLEWARNINGS .NES. "" THEN - 937 CCDISABLEWARNINGS = CCDISABLEWARNINGS+ "," 938$ CCDISABLEWARNINGS = CCDISABLEWARNINGS+ OPT_TEST 939$ ENDIF 940$ IF CCDISABLEWARNINGS .NES. "" 941$ THEN 942$ CCDISABLEWARNINGS = " /WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))" 943$ ENDIF 944$ ELSE 945$ CCDISABLEWARNINGS = "" 946$ ENDIF 947$ CC = CC + " /DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS 948$! 949$! Show user the result 950$! 951$ WRITE/SYMBOL SYS$OUTPUT "Main C Compiling Command: ",CC 952$! 953$! Else The User Entered An Invalid Argument. 954$! 955$ ELSE 956$! 957$! Tell The User We Don't Know What They Want. 958$! 959$ WRITE SYS$OUTPUT "" 960$ WRITE SYS$OUTPUT "The Option ",OPT_COMPILER," Is Invalid. The Valid Options Are:" 961$ WRITE SYS$OUTPUT "" 962$ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C." 963$ WRITE SYS$OUTPUT " DECC : To Compile With DEC C." 964$ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C." 965$ WRITE SYS$OUTPUT "" 966$! 967$! Time To EXIT. 968$! 969$ EXIT 970$! 971$! End The Valid Argument Check. 972$! 973$ ENDIF 974$! 975$! Build a MACRO command for the architecture at hand 976$! 977$ IF ARCH .EQS. "VAX" 978$ THEN 979$ MACRO = "MACRO/''DEBUGGER'" 980$ ELSE 981$ MACRO = "MACRO/MIGRATION/''DEBUGGER'/''MACRO_OPTIMIZE'" 982$ ENDIF 983$! 984$! Show user the result 985$! 986$ WRITE/SYMBOL SYS$OUTPUT "Main MACRO Compiling Command: ",MACRO 987$! 988$! Time to check the contents, and to make sure we get the correct library. 989$! 990$ IF OPT_TCPIP_LIB.EQS."SOCKETSHR" .OR. OPT_TCPIP_LIB.EQS."MULTINET" - 991 .OR. OPT_TCPIP_LIB.EQS."UCX" .OR. OPT_TCPIP_LIB.EQS."TCPIP" - 992 .OR. OPT_TCPIP_LIB.EQS."NONE" 993$ THEN 994$! 995$! Check to see if SOCKETSHR was chosen 996$! 997$ IF OPT_TCPIP_LIB.EQS."SOCKETSHR" 998$ THEN 999$! 1000$! Set the library to use SOCKETSHR 1001$! 1002$ TCPIP_LIB = ",SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT /OPTIONS" 1003$! 1004$! Done with SOCKETSHR 1005$! 1006$ ENDIF 1007$! 1008$! Check to see if MULTINET was chosen 1009$! 1010$ IF OPT_TCPIP_LIB.EQS."MULTINET" 1011$ THEN 1012$! 1013$! Set the library to use UCX emulation. 1014$! 1015$ OPT_TCPIP_LIB = "UCX" 1016$! 1017$! Done with MULTINET 1018$! 1019$ ENDIF 1020$! 1021$! Check to see if UCX was chosen 1022$! 1023$ IF OPT_TCPIP_LIB.EQS."UCX" 1024$ THEN 1025$! 1026$! Set the library to use UCX. 1027$! 1028$ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT /OPTIONS" 1029$ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" 1030$ THEN 1031$ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT /OPTIONS" 1032$ ELSE 1033$ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN - 1034 TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT /OPTIONS" 1035$ ENDIF 1036$! 1037$! Done with UCX 1038$! 1039$ ENDIF 1040$! 1041$! Check to see if TCPIP was chosen 1042$! 1043$ IF OPT_TCPIP_LIB.EQS."TCPIP" 1044$ THEN 1045$! 1046$! Set the library to use TCPIP (post UCX). 1047$! 1048$ TCPIP_LIB = ",SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT /OPTIONS" 1049$! 1050$! Done with TCPIP 1051$! 1052$ ENDIF 1053$! 1054$! Check to see if NONE was chosen 1055$! 1056$ IF OPT_TCPIP_LIB.EQS."NONE" 1057$ THEN 1058$! 1059$! Do not use a TCPIP library. 1060$! 1061$ TCPIP_LIB = "" 1062$! 1063$! Done with TCPIP 1064$! 1065$ ENDIF 1066$! 1067$! Print info 1068$! 1069$ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB- "," 1070$! 1071$! Else The User Entered An Invalid Argument. 1072$! 1073$ ELSE 1074$! 1075$! Tell The User We Don't Know What They Want. 1076$! 1077$ WRITE SYS$OUTPUT "" 1078$ WRITE SYS$OUTPUT "The Option ",OPT_TCPIP_LIB," Is Invalid. The Valid Options Are:" 1079$ WRITE SYS$OUTPUT "" 1080$ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library." 1081$ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library." 1082$ WRITE SYS$OUTPUT " TCPIP : To link with TCPIP (post UCX) TCP/IP library." 1083$ WRITE SYS$OUTPUT "" 1084$! 1085$! Time To EXIT. 1086$! 1087$ EXIT 1088$! 1089$! Done with TCP/IP libraries 1090$! 1091$ ENDIF 1092$! 1093$! Time To RETURN... 1094$! 1095$ RETURN 1096$! 1097$ INITIALISE: 1098$! 1099$! Save old value of the logical name OPENSSL 1100$! 1101$ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE") 1102$! 1103$! Save directory information 1104$! 1105$ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;" 1106$ __HERE = F$EDIT(__HERE,"UPCASE") 1107$ __TOP = __HERE - "ENGINES]" 1108$ __INCLUDE = __TOP + "INCLUDE.OPENSSL]" 1109$! 1110$! Set up the logical name OPENSSL to point at the include directory 1111$! 1112$ DEFINE OPENSSL /NOLOG '__INCLUDE' 1113$! 1114$! Done 1115$! 1116$ RETURN 1117$! 1118$ CLEANUP: 1119$! 1120$! Restore the saved logical name OPENSSL, if it had a value. 1121$! 1122$ if (f$type( __SAVE_OPENSSL) .nes. "") 1123$ then 1124$ IF __SAVE_OPENSSL .EQS. "" 1125$ THEN 1126$ DEASSIGN OPENSSL 1127$ ELSE 1128$ DEFINE /NOLOG OPENSSL '__SAVE_OPENSSL' 1129$ ENDIF 1130$ endif 1131$! 1132$! Close any open files. 1133$! 1134$ if (f$trnlnm( "objects", "LNM$PROCESS", 0, "SUPERVISOR") .nes. "") then - 1135 close objects 1136$! 1137$! Done 1138$! 1139$ RETURN 1140$! 1141