makeengines.com 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948
  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. $!-----------------------------------------------------------------------------
  32. $!
  33. $! Set the names of the engines we want to build
  34. $! NOTE: Some might think this list ugly. However, it's made this way to
  35. $! reflect the LIBNAMES variable in Makefile as closely as possible,
  36. $! thereby making it fairly easy to verify that the lists are the same.
  37. $! NOTE: gmp isn't built, as it's mostly a test engine and brings in another
  38. $! library that isn't necessarely ported to VMS.
  39. $!
  40. $ ENGINES = "," + P6
  41. $ IF ENGINES .EQS. "," THEN -
  42. ENGINES = ",4758cca,aep,atalla,cswift,chil,nuron,sureware,ubsec,padlock,ccgost"
  43. $!
  44. $! Set the default TCP/IP library to link against if needed
  45. $!
  46. $ TCPIP_LIB = ""
  47. $!
  48. $! Check What Architecture We Are Using.
  49. $!
  50. $ IF (F$GETSYI("CPU").LT.128)
  51. $ THEN
  52. $!
  53. $! The Architecture Is VAX.
  54. $!
  55. $ ARCH := VAX
  56. $!
  57. $! Else...
  58. $!
  59. $ ELSE
  60. $!
  61. $! The Architecture Is Alpha, IA64 or whatever comes in the future.
  62. $!
  63. $ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE")
  64. $ IF (ARCH .EQS. "") THEN ARCH = "UNK"
  65. $!
  66. $! End The Architecture Check.
  67. $!
  68. $ ENDIF
  69. $!
  70. $! Set the goal directories, and creat them if necessary
  71. $!
  72. $ OBJ_DIR := SYS$DISK:[-.'ARCH'.OBJ.ENGINES]
  73. $ EXE_DIR := SYS$DISK:[-.'ARCH'.EXE.ENGINES]
  74. $ IF F$PARSE(OBJ_DIR) .EQS. "" THEN CREATE/DIRECTORY 'OBJ_DIR'
  75. $ IF F$PARSE(EXE_DIR) .EQS. "" THEN CREATE/DIRECTORY 'EXE_DIR'
  76. $!
  77. $! Set the goal files, and create them if necessary
  78. $!
  79. $ CRYPTO_LIB :=SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO.OLB
  80. $ IF F$SEARCH(CRYPTO_LIB) .EQS. "" THEN LIBRARY/CREATE/OBJECT 'CRYPTO_LIB'
  81. $!
  82. $! OK, time to check options and initialise
  83. $!
  84. $ OPT_PHASE = P1
  85. $ ACCEPT_PHASE = "ALL,ENGINES"
  86. $ OPT_DEBUG = P2
  87. $ OPT_COMPILER = P3
  88. $ OPT_TCPIP_LIB = P4
  89. $ OPT_SPECIAL_THREADS = P5
  90. $
  91. $ GOSUB CHECK_OPTIONS
  92. $ GOSUB INITIALISE
  93. $ GOSUB CHECK_OPT_FILE
  94. $!
  95. $! Define what goes into each engine. VAX includes a transfer vector.
  96. $!
  97. $ ENGINE_ = ""
  98. $ TV_OBJ = ""
  99. $ IF ARCH .EQS. "VAX"
  100. $ THEN
  101. $ ENGINE_ = "engine_vector.mar"
  102. $ TV_OBJ_NAME = OBJ_DIR + F$PARSE(ENGINE_,,,"NAME","SYNTAX_ONLY") + ".OBJ"
  103. $ TV_OBJ = ",''TV_OBJ_NAME'"
  104. $ ENDIF
  105. $ ENGINE_4758CCA = "e_4758cca"
  106. $ ENGINE_aep = "e_aep"
  107. $ ENGINE_atalla = "e_atalla"
  108. $ ENGINE_cswift = "e_cswift"
  109. $ ENGINE_chil = "e_chil"
  110. $ ENGINE_nuron = "e_nuron"
  111. $ ENGINE_sureware = "e_sureware"
  112. $ ENGINE_ubsec = "e_ubsec"
  113. $ ENGINE_ubsec = "e_padlock"
  114. $
  115. $ ENGINE_ccgost_SUBDIR = "ccgost"
  116. $ ENGINE_ccgost = "e_gost_err,gost2001_keyx,gost2001,gost89,gost94_keyx,"+ -
  117. "gost_ameth,gost_asn1,gost_crypt,gost_ctl,gost_eng,"+ -
  118. "gosthash,gost_keywrap,gost_md,gost_params,gost_pmeth,"+ -
  119. "gost_sign"
  120. $!
  121. $! Define which programs need to be linked with a TCP/IP library
  122. $!
  123. $ TCPIP_ENGINES = ",,"
  124. $ IF COMPILER .EQS. "VAXC" THEN -
  125. TCPIP_ENGINES = ",,"
  126. $!
  127. $! Set up two loops, one that keeps track of the engines,
  128. $! and one that keeps track of all the files going into
  129. $! the current engine.
  130. $!
  131. $! Here's the start of the engine loop.
  132. $!
  133. $ ENGINE_COUNTER = 0
  134. $ ENGINE_NEXT:
  135. $!
  136. $! Extract the current engine name, and if we've reached the end, stop
  137. $!
  138. $ ENGINE_NAME = F$ELEMENT(ENGINE_COUNTER,",",ENGINES)
  139. $ IF (ENGINE_NAME.EQS.",") THEN GOTO ENGINE_DONE
  140. $!
  141. $ ENGINE_COUNTER = ENGINE_COUNTER + 1
  142. $!
  143. $! Set up the engine library names.
  144. $!
  145. $ LIB_ENGINE = "ENGINE_" + ENGINE_NAME
  146. $!
  147. $! Check if the library module name actually is defined
  148. $!
  149. $ IF F$TYPE('LIB_ENGINE') .EQS. ""
  150. $ THEN
  151. $ WRITE SYS$ERROR ""
  152. $ WRITE SYS$ERROR "The module ",ENGINE_NAME," does not exist. Continuing..."
  153. $ WRITE SYS$ERROR ""
  154. $ GOTO ENGINE_NEXT
  155. $ ENDIF
  156. $!
  157. $! Talk to the user
  158. $!
  159. $ IF ENGINE_NAME .NES. ""
  160. $ THEN
  161. $ WRITE SYS$OUTPUT "Compiling The ",ENGINE_NAME," Library Files. (",BUILDALL,")"
  162. $ ELSE
  163. $ WRITE SYS$OUTPUT "Compiling Support Files. (",BUILDALL,")"
  164. $ ENDIF
  165. $!
  166. $! Create a .OPT file for the object files
  167. $!
  168. $ OPEN/WRITE OBJECTS 'EXE_DIR''ENGINE_NAME'.OPT
  169. $!
  170. $! Here's the start of per-engine module loop.
  171. $!
  172. $ FILE_COUNTER = 0
  173. $ FILE_NEXT:
  174. $!
  175. $! Extract the file name from the file list, and if we've reached the end, stop
  176. $!
  177. $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",'LIB_ENGINE')
  178. $ IF (FILE_NAME.EQS.",") THEN GOTO FILE_DONE
  179. $!
  180. $ FILE_COUNTER = FILE_COUNTER + 1
  181. $!
  182. $ IF FILE_NAME .EQS. "" THEN GOTO FILE_NEXT
  183. $!
  184. $! Set up the source and object reference
  185. $!
  186. $ IF F$TYPE('LIB_ENGINE'_SUBDIR) .EQS. ""
  187. $ THEN
  188. $ SOURCE_FILE = F$PARSE(FILE_NAME,"SYS$DISK:[].C",,,"SYNTAX_ONLY")
  189. $ ELSE
  190. $ SOURCE_FILE = F$PARSE(FILE_NAME,"SYS$DISK:[."+'LIB_ENGINE'_SUBDIR+"].C",,,"SYNTAX_ONLY")
  191. $ ENDIF
  192. $ OBJECT_FILE = OBJ_DIR + F$PARSE(FILE_NAME,,,"NAME","SYNTAX_ONLY") + ".OBJ"
  193. $!
  194. $! If we get some problem, we just go on trying to build the next module.
  195. $ ON WARNING THEN GOTO FILE_NEXT
  196. $!
  197. $! Check if the module we want to compile is actually there.
  198. $!
  199. $ IF F$SEARCH(SOURCE_FILE) .EQS. ""
  200. $ THEN
  201. $ WRITE SYS$OUTPUT ""
  202. $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Doesn't Exist."
  203. $ WRITE SYS$OUTPUT ""
  204. $ GOTO EXIT
  205. $ ENDIF
  206. $!
  207. $! Talk to the user.
  208. $!
  209. $ WRITE SYS$OUTPUT " ",FILE_NAME,""
  210. $!
  211. $! Do the dirty work.
  212. $!
  213. $ ON ERROR THEN GOTO FILE_NEXT
  214. $ IF F$EDIT(F$PARSE(SOURCE_FILE,,,"TYPE","SYNTAX_ONLY"),"UPCASE") .EQS. ".MAR"
  215. $ THEN
  216. $ MACRO/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
  217. $ ELSE
  218. $ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
  219. $ ENDIF
  220. $ WRITE OBJECTS OBJECT_FILE
  221. $!
  222. $! Next file
  223. $!
  224. $ GOTO FILE_NEXT
  225. $!
  226. $ FILE_DONE:
  227. $ CLOSE OBJECTS
  228. $!
  229. $! Do not link the support files.
  230. $!
  231. $ IF ENGINE_NAME .EQS. "" THEN GOTO ENGINE_NEXT
  232. $!
  233. $! Do not link the support files.
  234. $!
  235. $ IF ENGINE_NAME .EQS. "" THEN GOTO ENGINE_NEXT
  236. $!
  237. $! Now, there are two ways to handle this. We can either build
  238. $! shareable images or stick the engine object file into libcrypto.
  239. $! For now, the latter is NOT supported.
  240. $!
  241. $!!!!! LIBRARY/REPLACE 'CRYPTO_LIB' 'OBJECT_FILE'
  242. $!
  243. $! For shareable libraries, we need to do things a little differently
  244. $! depending on if we link with a TCP/IP library or not.
  245. $!
  246. $ ENGINE_OPT := SYS$DISK:[]'ARCH'.OPT
  247. $ IF TCPIP_LIB .NES. ""
  248. $ THEN
  249. $ LINK/'DEBUGGER'/'TRACEBACK' /SHARE='EXE_DIR''ENGINE_NAME'.EXE -
  250. 'EXE_DIR''ENGINE_NAME'.OPT/OPTION'TV_OBJ', -
  251. 'CRYPTO_LIB'/LIBRARY, -
  252. 'ENGINE_OPT'/OPTION,'TCPIP_LIB','OPT_FILE'/OPTION
  253. $ ELSE
  254. $ LINK/'DEBUGGER'/'TRACEBACK' /SHARE='EXE_DIR''ENGINE_NAME'.EXE -
  255. 'EXE_DIR''ENGINE_NAME'.OPT/OPTION'TV_OBJ', -
  256. 'CRYPTO_LIB'/LIBRARY, -
  257. 'ENGINE_OPT'/OPTION,'OPT_FILE'/OPTION
  258. $ ENDIF
  259. $!
  260. $! Next engine
  261. $!
  262. $ GOTO ENGINE_NEXT
  263. $!
  264. $ ENGINE_DONE:
  265. $!
  266. $! Talk to the user
  267. $!
  268. $ WRITE SYS$OUTPUT "All Done..."
  269. $ EXIT:
  270. $ GOSUB CLEANUP
  271. $ EXIT
  272. $!
  273. $! Check For The Link Option FIle.
  274. $!
  275. $ CHECK_OPT_FILE:
  276. $!
  277. $! Check To See If We Need To Make A VAX C Option File.
  278. $!
  279. $ IF (COMPILER.EQS."VAXC")
  280. $ THEN
  281. $!
  282. $! Check To See If We Already Have A VAX C Linker Option File.
  283. $!
  284. $ IF (F$SEARCH(OPT_FILE).EQS."")
  285. $ THEN
  286. $!
  287. $! We Need A VAX C Linker Option File.
  288. $!
  289. $ CREATE 'OPT_FILE'
  290. $DECK
  291. !
  292. ! Default System Options File To Link Agianst
  293. ! The Sharable VAX C Runtime Library.
  294. !
  295. SYS$SHARE:VAXCRTL.EXE/SHARE
  296. $EOD
  297. $!
  298. $! End The Option File Check.
  299. $!
  300. $ ENDIF
  301. $!
  302. $! End The VAXC Check.
  303. $!
  304. $ ENDIF
  305. $!
  306. $! Check To See If We Need A GNU C Option File.
  307. $!
  308. $ IF (COMPILER.EQS."GNUC")
  309. $ THEN
  310. $!
  311. $! Check To See If We Already Have A GNU C Linker Option File.
  312. $!
  313. $ IF (F$SEARCH(OPT_FILE).EQS."")
  314. $ THEN
  315. $!
  316. $! We Need A GNU C Linker Option File.
  317. $!
  318. $ CREATE 'OPT_FILE'
  319. $DECK
  320. !
  321. ! Default System Options File To Link Agianst
  322. ! The Sharable C Runtime Library.
  323. !
  324. GNU_CC:[000000]GCCLIB/LIBRARY
  325. SYS$SHARE:VAXCRTL/SHARE
  326. $EOD
  327. $!
  328. $! End The Option File Check.
  329. $!
  330. $ ENDIF
  331. $!
  332. $! End The GNU C Check.
  333. $!
  334. $ ENDIF
  335. $!
  336. $! Check To See If We Need A DEC C Option File.
  337. $!
  338. $ IF (COMPILER.EQS."DECC")
  339. $ THEN
  340. $!
  341. $! Check To See If We Already Have A DEC C Linker Option File.
  342. $!
  343. $ IF (F$SEARCH(OPT_FILE).EQS."")
  344. $ THEN
  345. $!
  346. $! Figure Out If We Need A non-VAX Or A VAX Linker Option File.
  347. $!
  348. $ IF ARCH .EQS. "VAX"
  349. $ THEN
  350. $!
  351. $! We Need A DEC C Linker Option File For VAX.
  352. $!
  353. $ CREATE 'OPT_FILE'
  354. $DECK
  355. !
  356. ! Default System Options File To Link Agianst
  357. ! The Sharable DEC C Runtime Library.
  358. !
  359. SYS$SHARE:DECC$SHR.EXE/SHARE
  360. $EOD
  361. $!
  362. $! Else...
  363. $!
  364. $ ELSE
  365. $!
  366. $! Create The non-VAX Linker Option File.
  367. $!
  368. $ CREATE 'OPT_FILE'
  369. $DECK
  370. !
  371. ! Default System Options File For non-VAX To Link Agianst
  372. ! The Sharable C Runtime Library.
  373. !
  374. SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
  375. SYS$SHARE:CMA$OPEN_RTL/SHARE
  376. $EOD
  377. $!
  378. $! End The DEC C Option File Check.
  379. $!
  380. $ ENDIF
  381. $!
  382. $! End The Option File Search.
  383. $!
  384. $ ENDIF
  385. $!
  386. $! End The DEC C Check.
  387. $!
  388. $ ENDIF
  389. $!
  390. $! Tell The User What Linker Option File We Are Using.
  391. $!
  392. $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
  393. $!
  394. $! Time To RETURN.
  395. $!
  396. $ RETURN
  397. $!
  398. $! Check The User's Options.
  399. $!
  400. $ CHECK_OPTIONS:
  401. $!
  402. $! Check To See If OPT_PHASE Is Blank.
  403. $!
  404. $ IF (OPT_PHASE.EQS."ALL")
  405. $ THEN
  406. $!
  407. $! OPT_PHASE Is Blank, So Build Everything.
  408. $!
  409. $ BUILDALL = "ALL"
  410. $!
  411. $! Else...
  412. $!
  413. $ ELSE
  414. $!
  415. $! Else, Check To See If OPT_PHASE Has A Valid Arguement.
  416. $!
  417. $ IF ("," + ACCEPT_PHASE + ",") - ("," + OPT_PHASE + ",") -
  418. .NES. ("," + ACCEPT_PHASE + ",")
  419. $ THEN
  420. $!
  421. $! A Valid Arguement.
  422. $!
  423. $ BUILDALL = OPT_PHASE
  424. $!
  425. $! Else...
  426. $!
  427. $ ELSE
  428. $!
  429. $! Tell The User We Don't Know What They Want.
  430. $!
  431. $ WRITE SYS$OUTPUT ""
  432. $ WRITE SYS$OUTPUT "The option ",OPT_PHASE," is invalid. The valid options are:"
  433. $ WRITE SYS$OUTPUT ""
  434. $ IF ("," + ACCEPT_PHASE + ",") - ",ALL," -
  435. .NES. ("," + ACCEPT_PHASE + ",") THEN -
  436. WRITE SYS$OUTPUT " ALL : just build everything."
  437. $ IF ("," + ACCEPT_PHASE + ",") - ",ENGINES," -
  438. .NES. ("," + ACCEPT_PHASE + ",") THEN -
  439. WRITE SYS$OUTPUT " ENGINES : to compile just the [.xxx.EXE.ENGINES]*.EXE hareable images."
  440. $ WRITE SYS$OUTPUT ""
  441. $ WRITE SYS$OUTPUT " where 'xxx' stands for:"
  442. $ WRITE SYS$OUTPUT ""
  443. $ WRITE SYS$OUTPUT " ALPHA : Alpha architecture."
  444. $ WRITE SYS$OUTPUT " IA64 : IA64 architecture."
  445. $ WRITE SYS$OUTPUT " VAX : VAX architecture."
  446. $ WRITE SYS$OUTPUT ""
  447. $!
  448. $! Time To EXIT.
  449. $!
  450. $ EXIT
  451. $!
  452. $! End The Valid Arguement Check.
  453. $!
  454. $ ENDIF
  455. $!
  456. $! End The OPT_PHASE Check.
  457. $!
  458. $ ENDIF
  459. $!
  460. $! Check To See If OPT_DEBUG Is Blank.
  461. $!
  462. $ IF (OPT_DEBUG.EQS."NODEBUG")
  463. $ THEN
  464. $!
  465. $! OPT_DEBUG Is NODEBUG, So Compile Without The Debugger Information.
  466. $!
  467. $ DEBUGGER = "NODEBUG"
  468. $ TRACEBACK = "NOTRACEBACK"
  469. $ GCC_OPTIMIZE = "OPTIMIZE"
  470. $ CC_OPTIMIZE = "OPTIMIZE"
  471. $ MACRO_OPTIMIZE = "OPTIMIZE"
  472. $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
  473. $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
  474. $ ELSE
  475. $!
  476. $! Check To See If We Are To Compile With Debugger Information.
  477. $!
  478. $ IF (OPT_DEBUG.EQS."DEBUG")
  479. $ THEN
  480. $!
  481. $! Compile With Debugger Information.
  482. $!
  483. $ DEBUGGER = "DEBUG"
  484. $ TRACEBACK = "TRACEBACK"
  485. $ GCC_OPTIMIZE = "NOOPTIMIZE"
  486. $ CC_OPTIMIZE = "NOOPTIMIZE"
  487. $ MACRO_OPTIMIZE = "NOOPTIMIZE"
  488. $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
  489. $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
  490. $ ELSE
  491. $!
  492. $! They Entered An Invalid Option..
  493. $!
  494. $ WRITE SYS$OUTPUT ""
  495. $ WRITE SYS$OUTPUT "The Option ",OPT_DEBUG," Is Invalid. The Valid Options Are:"
  496. $ WRITE SYS$OUTPUT ""
  497. $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
  498. $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
  499. $ WRITE SYS$OUTPUT ""
  500. $!
  501. $! Time To EXIT.
  502. $!
  503. $ EXIT
  504. $!
  505. $! End The Valid Arguement Check.
  506. $!
  507. $ ENDIF
  508. $!
  509. $! End The OPT_DEBUG Check.
  510. $!
  511. $ ENDIF
  512. $!
  513. $! Special Threads For OpenVMS v7.1 Or Later
  514. $!
  515. $! Written By: Richard Levitte
  516. $! richard@levitte.org
  517. $!
  518. $!
  519. $! Check To See If We Have A Option For OPT_SPECIAL_THREADS.
  520. $!
  521. $ IF (OPT_SPECIAL_THREADS.EQS."")
  522. $ THEN
  523. $!
  524. $! Get The Version Of VMS We Are Using.
  525. $!
  526. $ ISSEVEN :=
  527. $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
  528. $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
  529. $!
  530. $! Check To See If The VMS Version Is v7.1 Or Later.
  531. $!
  532. $ IF (TMP.GE.71)
  533. $ THEN
  534. $!
  535. $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
  536. $!
  537. $ ISSEVEN := ,PTHREAD_USE_D4
  538. $!
  539. $! End The VMS Version Check.
  540. $!
  541. $ ENDIF
  542. $!
  543. $! End The OPT_SPECIAL_THREADS Check.
  544. $!
  545. $ ENDIF
  546. $!
  547. $! Check To See If OPT_COMPILER Is Blank.
  548. $!
  549. $ IF (OPT_COMPILER.EQS."")
  550. $ THEN
  551. $!
  552. $! O.K., The User Didn't Specify A Compiler, Let's Try To
  553. $! Find Out Which One To Use.
  554. $!
  555. $! Check To See If We Have GNU C.
  556. $!
  557. $ IF (F$TRNLNM("GNU_CC").NES."")
  558. $ THEN
  559. $!
  560. $! Looks Like GNUC, Set To Use GNUC.
  561. $!
  562. $ OPT_COMPILER = "GNUC"
  563. $!
  564. $! Else...
  565. $!
  566. $ ELSE
  567. $!
  568. $! Check To See If We Have VAXC Or DECC.
  569. $!
  570. $ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
  571. $ THEN
  572. $!
  573. $! Looks Like DECC, Set To Use DECC.
  574. $!
  575. $ OPT_COMPILER = "DECC"
  576. $!
  577. $! Else...
  578. $!
  579. $ ELSE
  580. $!
  581. $! Looks Like VAXC, Set To Use VAXC.
  582. $!
  583. $ OPT_COMPILER = "VAXC"
  584. $!
  585. $! End The VAXC Compiler Check.
  586. $!
  587. $ ENDIF
  588. $!
  589. $! End The DECC & VAXC Compiler Check.
  590. $!
  591. $ ENDIF
  592. $!
  593. $! End The Compiler Check.
  594. $!
  595. $ ENDIF
  596. $!
  597. $! Check To See If We Have A Option For OPT_TCPIP_LIB.
  598. $!
  599. $ IF (OPT_TCPIP_LIB.EQS."")
  600. $ THEN
  601. $!
  602. $! Find out what socket library we have available
  603. $!
  604. $ IF F$PARSE("SOCKETSHR:") .NES. ""
  605. $ THEN
  606. $!
  607. $! We have SOCKETSHR, and it is my opinion that it's the best to use.
  608. $!
  609. $ OPT_TCPIP_LIB = "SOCKETSHR"
  610. $!
  611. $! Tell the user
  612. $!
  613. $ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP"
  614. $!
  615. $! Else, let's look for something else
  616. $!
  617. $ ELSE
  618. $!
  619. $! Like UCX (the reason to do this before Multinet is that the UCX
  620. $! emulation is easier to use...)
  621. $!
  622. $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" -
  623. .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" -
  624. .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. ""
  625. $ THEN
  626. $!
  627. $! Last resort: a UCX or UCX-compatible library
  628. $!
  629. $ OPT_TCPIP_LIB = "UCX"
  630. $!
  631. $! Tell the user
  632. $!
  633. $ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP"
  634. $!
  635. $! That was all...
  636. $!
  637. $ ENDIF
  638. $ ENDIF
  639. $ ENDIF
  640. $!
  641. $! Set Up Initial CC Definitions, Possibly With User Ones
  642. $!
  643. $ CCDEFS = "TCPIP_TYPE_''OPT_TCPIP_LIB',DSO_VMS"
  644. $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
  645. $ CCEXTRAFLAGS = ""
  646. $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
  647. $ CCDISABLEWARNINGS = "LONGLONGTYPE,LONGLONGSUFX"
  648. $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
  649. CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS
  650. $!
  651. $! Check To See If The User Entered A Valid Paramter.
  652. $!
  653. $ IF (OPT_COMPILER.EQS."VAXC").OR.(OPT_COMPILER.EQS."DECC").OR.(OPT_COMPILER.EQS."GNUC")
  654. $ THEN
  655. $!
  656. $! Check To See If The User Wanted DECC.
  657. $!
  658. $ IF (OPT_COMPILER.EQS."DECC")
  659. $ THEN
  660. $!
  661. $! Looks Like DECC, Set To Use DECC.
  662. $!
  663. $ COMPILER = "DECC"
  664. $!
  665. $! Tell The User We Are Using DECC.
  666. $!
  667. $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
  668. $!
  669. $! Use DECC...
  670. $!
  671. $ CC = "CC"
  672. $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
  673. THEN CC = "CC/DECC"
  674. $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
  675. "/NOLIST/PREFIX=ALL" + -
  676. "/INCLUDE=(SYS$DISK:[],SYS$DISK:[.VENDOR_DEFNS])" + -
  677. CCEXTRAFLAGS
  678. $!
  679. $! Define The Linker Options File Name.
  680. $!
  681. $ OPT_FILE = "''EXE_DIR'VAX_DECC_OPTIONS.OPT"
  682. $!
  683. $! End DECC Check.
  684. $!
  685. $ ENDIF
  686. $!
  687. $! Check To See If We Are To Use VAXC.
  688. $!
  689. $ IF (OPT_COMPILER.EQS."VAXC")
  690. $ THEN
  691. $!
  692. $! Looks Like VAXC, Set To Use VAXC.
  693. $!
  694. $ COMPILER = "VAXC"
  695. $!
  696. $! Tell The User We Are Using VAX C.
  697. $!
  698. $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
  699. $!
  700. $! Compile Using VAXC.
  701. $!
  702. $ CC = "CC"
  703. $ IF ARCH.NES."VAX"
  704. $ THEN
  705. $ WRITE SYS$OUTPUT "There is no VAX C on Alpha!"
  706. $ EXIT
  707. $ ENDIF
  708. $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
  709. $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
  710. "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
  711. CCEXTRAFLAGS
  712. $ CCDEFS = """VAXC""," + CCDEFS
  713. $!
  714. $! Define <sys> As SYS$COMMON:[SYSLIB]
  715. $!
  716. $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
  717. $!
  718. $! Define The Linker Options File Name.
  719. $!
  720. $ OPT_FILE = "''EXE_DIR'VAX_VAXC_OPTIONS.OPT"
  721. $!
  722. $! End VAXC Check
  723. $!
  724. $ ENDIF
  725. $!
  726. $! Check To See If We Are To Use GNU C.
  727. $!
  728. $ IF (OPT_COMPILER.EQS."GNUC")
  729. $ THEN
  730. $!
  731. $! Looks Like GNUC, Set To Use GNUC.
  732. $!
  733. $ COMPILER = "GNUC"
  734. $!
  735. $! Tell The User We Are Using GNUC.
  736. $!
  737. $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
  738. $!
  739. $! Use GNU C...
  740. $!
  741. $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
  742. "/INCLUDE=(SYS$DISK:[],SYS$DISK:[-],SYS$DISK:[.ENGINE.VENDOR_DEFNS])" + -
  743. CCEXTRAFLAGS
  744. $!
  745. $! Define The Linker Options File Name.
  746. $!
  747. $ OPT_FILE = "''EXE_DIR'VAX_GNUC_OPTIONS.OPT"
  748. $!
  749. $! End The GNU C Check.
  750. $!
  751. $ ENDIF
  752. $!
  753. $! Set up default defines
  754. $!
  755. $ CCDEFS = """FLAT_INC=1""," + CCDEFS
  756. $!
  757. $! Finish up the definition of CC.
  758. $!
  759. $ IF COMPILER .EQS. "DECC"
  760. $ THEN
  761. $ IF CCDISABLEWARNINGS .NES. ""
  762. $ THEN
  763. $ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
  764. $ ENDIF
  765. $ ELSE
  766. $ CCDISABLEWARNINGS = ""
  767. $ ENDIF
  768. $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
  769. $!
  770. $! Show user the result
  771. $!
  772. $ WRITE/SYMBOL SYS$OUTPUT "Main C Compiling Command: ",CC
  773. $!
  774. $! Else The User Entered An Invalid Arguement.
  775. $!
  776. $ ELSE
  777. $!
  778. $! Tell The User We Don't Know What They Want.
  779. $!
  780. $ WRITE SYS$OUTPUT ""
  781. $ WRITE SYS$OUTPUT "The Option ",OPT_COMPILER," Is Invalid. The Valid Options Are:"
  782. $ WRITE SYS$OUTPUT ""
  783. $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
  784. $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
  785. $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
  786. $ WRITE SYS$OUTPUT ""
  787. $!
  788. $! Time To EXIT.
  789. $!
  790. $ EXIT
  791. $!
  792. $! End The Valid Arguement Check.
  793. $!
  794. $ ENDIF
  795. $!
  796. $! Build a MACRO command for the architecture at hand
  797. $!
  798. $ IF ARCH .EQS. "VAX" THEN MACRO = "MACRO/''DEBUGGER'"
  799. $ IF ARCH .NES. "VAX" THEN MACRO = "MACRO/MIGRATION/''DEBUGGER'/''MACRO_OPTIMIZE'"
  800. $!
  801. $! Show user the result
  802. $!
  803. $ WRITE/SYMBOL SYS$OUTPUT "Main MACRO Compiling Command: ",MACRO
  804. $!
  805. $! Time to check the contents, and to make sure we get the correct library.
  806. $!
  807. $ IF OPT_TCPIP_LIB.EQS."SOCKETSHR" .OR. OPT_TCPIP_LIB.EQS."MULTINET" -
  808. .OR. OPT_TCPIP_LIB.EQS."UCX" .OR. OPT_TCPIP_LIB.EQS."TCPIP" -
  809. .OR. OPT_TCPIP_LIB.EQS."NONE"
  810. $ THEN
  811. $!
  812. $! Check to see if SOCKETSHR was chosen
  813. $!
  814. $ IF OPT_TCPIP_LIB.EQS."SOCKETSHR"
  815. $ THEN
  816. $!
  817. $! Set the library to use SOCKETSHR
  818. $!
  819. $ TCPIP_LIB = "SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT/OPT"
  820. $!
  821. $! Done with SOCKETSHR
  822. $!
  823. $ ENDIF
  824. $!
  825. $! Check to see if MULTINET was chosen
  826. $!
  827. $ IF OPT_TCPIP_LIB.EQS."MULTINET"
  828. $ THEN
  829. $!
  830. $! Set the library to use UCX emulation.
  831. $!
  832. $ OPT_TCPIP_LIB = "UCX"
  833. $!
  834. $! Done with MULTINET
  835. $!
  836. $ ENDIF
  837. $!
  838. $! Check to see if UCX was chosen
  839. $!
  840. $ IF OPT_TCPIP_LIB.EQS."UCX"
  841. $ THEN
  842. $!
  843. $! Set the library to use UCX.
  844. $!
  845. $ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT/OPT"
  846. $ IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
  847. $ THEN
  848. $ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT/OPT"
  849. $ ELSE
  850. $ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
  851. TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT/OPT"
  852. $ ENDIF
  853. $!
  854. $! Done with UCX
  855. $!
  856. $ ENDIF
  857. $!
  858. $! Check to see if TCPIP was chosen
  859. $!
  860. $ IF OPT_TCPIP_LIB.EQS."TCPIP"
  861. $ THEN
  862. $!
  863. $! Set the library to use TCPIP (post UCX).
  864. $!
  865. $ TCPIP_LIB = "SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT/OPT"
  866. $!
  867. $! Done with TCPIP
  868. $!
  869. $ ENDIF
  870. $!
  871. $! Check to see if NONE was chosen
  872. $!
  873. $ IF OPT_TCPIP_LIB.EQS."NONE"
  874. $ THEN
  875. $!
  876. $! Do not use a TCPIP library.
  877. $!
  878. $ TCPIP_LIB = ""
  879. $!
  880. $! Done with TCPIP
  881. $!
  882. $ ENDIF
  883. $!
  884. $! Print info
  885. $!
  886. $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB
  887. $!
  888. $! Else The User Entered An Invalid Arguement.
  889. $!
  890. $ ELSE
  891. $!
  892. $! Tell The User We Don't Know What They Want.
  893. $!
  894. $ WRITE SYS$OUTPUT ""
  895. $ WRITE SYS$OUTPUT "The Option ",OPT_TCPIP_LIB," Is Invalid. The Valid Options Are:"
  896. $ WRITE SYS$OUTPUT ""
  897. $ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library."
  898. $ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library."
  899. $ WRITE SYS$OUTPUT " TCPIP : To link with TCPIP (post UCX) TCP/IP library."
  900. $ WRITE SYS$OUTPUT ""
  901. $!
  902. $! Time To EXIT.
  903. $!
  904. $ EXIT
  905. $!
  906. $! Done with TCP/IP libraries
  907. $!
  908. $ ENDIF
  909. $!
  910. $! Time To RETURN...
  911. $!
  912. $ RETURN
  913. $!
  914. $ INITIALISE:
  915. $!
  916. $! Save old value of the logical name OPENSSL
  917. $!
  918. $ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE")
  919. $!
  920. $! Save directory information
  921. $!
  922. $ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
  923. $ __HERE = F$EDIT(__HERE,"UPCASE")
  924. $ __TOP = __HERE - "ENGINES]"
  925. $ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
  926. $!
  927. $! Set up the logical name OPENSSL to point at the include directory
  928. $!
  929. $ DEFINE OPENSSL/NOLOG '__INCLUDE'
  930. $!
  931. $! Done
  932. $!
  933. $ RETURN
  934. $!
  935. $ CLEANUP:
  936. $!
  937. $! Restore the logical name OPENSSL if it had a value
  938. $!
  939. $ IF __SAVE_OPENSSL .EQS. ""
  940. $ THEN
  941. $ DEASSIGN OPENSSL
  942. $ ELSE
  943. $ DEFINE/NOLOG OPENSSL '__SAVE_OPENSSL'
  944. $ ENDIF
  945. $!
  946. $! Done
  947. $!
  948. $ RETURN