des-lib.com 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005
  1. $!
  2. $! DES-LIB.COM
  3. $! Written By: Robert Byer
  4. $! Vice-President
  5. $! A-Com Computing, Inc.
  6. $! byer@mail.all-net.net
  7. $!
  8. $! Changes by Richard Levitte <richard@levitte.org>
  9. $!
  10. $! This command files compiles and creates the
  11. $! "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" library. The "xxx" denotes the machine
  12. $! architecture of ALPHA, IA64 or VAX.
  13. $!
  14. $! It was re-written to try to determine which "C" compiler to try to use
  15. $! or the user can specify a compiler in P3.
  16. $!
  17. $! Specify one of the following to build just that part, specify "ALL" to
  18. $! just build everything.
  19. $!
  20. $! ALL To Just Build "Everything".
  21. $! LIBRARY To Just Build The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library.
  22. $! DESTEST To Just Build The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program.
  23. $! SPEED To Just Build The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program.
  24. $! RPW To Just Build The [.xxx.EXE.CRYPTO.DES]RPW.EXE Program.
  25. $! DES To Just Build The [.xxx.EXE.CRYPTO.DES]DES.EXE Program.
  26. $! DES_OPTS To Just Build The [.xxx.EXE.CRYPTO.DES]DES_OPTS.EXE Program.
  27. $!
  28. $! Specify either DEBUG or NODEBUG as P2 to compile with or without
  29. $! debugging information.
  30. $!
  31. $! Specify which compiler at P3 to try to compile under.
  32. $!
  33. $! VAXC For VAX C.
  34. $! DECC For DEC C.
  35. $! GNUC For GNU C.
  36. $!
  37. $! If you don't speficy a compiler, it will try to determine which
  38. $! "C" compiler to try to use.
  39. $!
  40. $! P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
  41. $!
  42. $!
  43. $! Make sure we know what architecture we run on.
  44. $!
  45. $!
  46. $! Check Which Architecture We Are Using.
  47. $!
  48. $ IF (F$GETSYI("CPU").LT.128)
  49. $ THEN
  50. $!
  51. $! The Architecture Is VAX
  52. $!
  53. $ ARCH := VAX
  54. $!
  55. $! Else...
  56. $!
  57. $ ELSE
  58. $!
  59. $! The Architecture Is Alpha, IA64 or whatever comes in the future.
  60. $!
  61. $ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE")
  62. $ IF (ARCH .EQS. "") THEN ARCH = "UNK"
  63. $!
  64. $! End The Architecture Check.
  65. $!
  66. $ ENDIF
  67. $!
  68. $! Define The OBJ Directory Name.
  69. $!
  70. $ OBJ_DIR := SYS$DISK:[--.'ARCH'.OBJ.CRYPTO.DES]
  71. $!
  72. $! Define The EXE Directory Name.
  73. $!
  74. $ EXE_DIR :== SYS$DISK:[--.'ARCH'.EXE.CRYPTO.DES]
  75. $!
  76. $! Check To Make Sure We Have Valid Command Line Parameters.
  77. $!
  78. $ GOSUB CHECK_OPTIONS
  79. $!
  80. $! Tell The User What Kind of Machine We Run On.
  81. $!
  82. $ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine."
  83. $!
  84. $! Check To See If The Architecture Specific OBJ Directory Exists.
  85. $!
  86. $ IF (F$PARSE(OBJ_DIR).EQS."")
  87. $ THEN
  88. $!
  89. $! It Dosen't Exist, So Create It.
  90. $!
  91. $ CREATE/DIR 'OBJ_DIR'
  92. $!
  93. $! End The Architecture Specific OBJ Directory Check.
  94. $!
  95. $ ENDIF
  96. $!
  97. $! Check To See If The Architecture Specific Directory Exists.
  98. $!
  99. $ IF (F$PARSE(EXE_DIR).EQS."")
  100. $ THEN
  101. $!
  102. $! It Dosen't Exist, So Create It.
  103. $!
  104. $ CREATE/DIR 'EXE_DIR'
  105. $!
  106. $! End The Architecture Specific Directory Check.
  107. $!
  108. $ ENDIF
  109. $!
  110. $! Define The Library Name.
  111. $!
  112. $ LIB_NAME := 'EXE_DIR'LIBDES.OLB
  113. $!
  114. $! Check To See What We Are To Do.
  115. $!
  116. $ IF (BUILDALL.EQS."TRUE")
  117. $ THEN
  118. $!
  119. $! Since Nothing Special Was Specified, Do Everything.
  120. $!
  121. $ GOSUB LIBRARY
  122. $ GOSUB DESTEST
  123. $ GOSUB SPEED
  124. $ GOSUB RPW
  125. $ GOSUB DES
  126. $ GOSUB DES_OPTS
  127. $!
  128. $! Else...
  129. $!
  130. $ ELSE
  131. $!
  132. $! Build Just What The User Wants Us To Build.
  133. $!
  134. $ GOSUB 'BUILDALL'
  135. $!
  136. $! End The BUILDALL Check.
  137. $!
  138. $ ENDIF
  139. $!
  140. $! Time To EXIT.
  141. $!
  142. $ EXIT
  143. $ LIBRARY:
  144. $!
  145. $! Tell The User That We Are Compiling.
  146. $!
  147. $ WRITE SYS$OUTPUT "Compiling The ",LIB_NAME," Files."
  148. $!
  149. $! Check To See If We Already Have A "[.xxx.EXE.CRYPTO.DES]LIBDES.OLB" Library...
  150. $!
  151. $ IF (F$SEARCH(LIB_NAME).EQS."")
  152. $ THEN
  153. $!
  154. $! Guess Not, Create The Library.
  155. $!
  156. $ LIBRARY/CREATE/OBJECT 'LIB_NAME'
  157. $!
  158. $! End The Library Exist Check.
  159. $!
  160. $ ENDIF
  161. $!
  162. $! Define The DES Library Files.
  163. $!
  164. $ LIB_DES = "set_key,ecb_enc,cbc_enc,"+ -
  165. "ecb3_enc,cfb64enc,cfb64ede,cfb_enc,ofb64ede,"+ -
  166. "enc_read,enc_writ,ofb64enc,"+ -
  167. "ofb_enc,str2key,pcbc_enc,qud_cksm,rand_key,"+ -
  168. "des_enc,fcrypt_b,read2pwd,"+ -
  169. "fcrypt,xcbc_enc,read_pwd,rpc_enc,cbc_cksm,supp"
  170. $!
  171. $! Define A File Counter And Set It To "0".
  172. $!
  173. $ FILE_COUNTER = 0
  174. $!
  175. $! Top Of The File Loop.
  176. $!
  177. $ NEXT_FILE:
  178. $!
  179. $! O.K, Extract The File Name From The File List.
  180. $!
  181. $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",LIB_DES)
  182. $!
  183. $! Check To See If We Are At The End Of The File List.
  184. $!
  185. $ IF (FILE_NAME.EQS.",") THEN GOTO FILE_DONE
  186. $!
  187. $! Increment The Counter.
  188. $!
  189. $ FILE_COUNTER = FILE_COUNTER + 1
  190. $!
  191. $! Create The Source File Name.
  192. $!
  193. $ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME + ".C"
  194. $!
  195. $! Tell The User We Are Compiling The Source File.
  196. $!
  197. $ WRITE SYS$OUTPUT " ",FILE_NAME,".C"
  198. $!
  199. $! Create The Object File Name.
  200. $!
  201. $ OBJECT_FILE = OBJ_DIR + FILE_NAME + "." + ARCH + "OBJ"
  202. $ ON WARNING THEN GOTO NEXT_FILE
  203. $!
  204. $! Check To See If The File We Want To Compile Actually Exists.
  205. $!
  206. $ IF (F$SEARCH(SOURCE_FILE).EQS."")
  207. $ THEN
  208. $!
  209. $! Tell The User That The File Dosen't Exist.
  210. $!
  211. $ WRITE SYS$OUTPUT ""
  212. $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist."
  213. $ WRITE SYS$OUTPUT ""
  214. $!
  215. $! Exit The Build.
  216. $!
  217. $ EXIT
  218. $!
  219. $! End The File Exists Check.
  220. $!
  221. $ ENDIF
  222. $!
  223. $! Compile The File.
  224. $!
  225. $ ON ERROR THEN GOTO NEXT_FILE
  226. $ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
  227. $!
  228. $! Add It To The Library.
  229. $!
  230. $ LIBRARY/REPLACE/OBJECT 'LIB_NAME' 'OBJECT_FILE'
  231. $!
  232. $! Time To Clean Up The Object File.
  233. $!
  234. $ DELETE 'OBJECT_FILE';*
  235. $!
  236. $! Go Back And Do It Again.
  237. $!
  238. $ GOTO NEXT_FILE
  239. $!
  240. $! All Done With This Library Part.
  241. $!
  242. $ FILE_DONE:
  243. $!
  244. $! Tell The User That We Are All Done.
  245. $!
  246. $ WRITE SYS$OUTPUT "Library ",LIB_NAME," Built."
  247. $!
  248. $! All Done, Time To Return.
  249. $!
  250. $ RETURN
  251. $!
  252. $! Compile The DESTEST Program.
  253. $!
  254. $ DESTEST:
  255. $!
  256. $! Check To See If We Have The Proper Libraries.
  257. $!
  258. $ GOSUB LIB_CHECK
  259. $!
  260. $! Check To See If We Have A Linker Option File.
  261. $!
  262. $ GOSUB CHECK_OPT_FILE
  263. $!
  264. $! Check To See If The File We Want To Compile Actually Exists.
  265. $!
  266. $ IF (F$SEARCH("SYS$DISK:[]DESTEST.C").EQS."")
  267. $ THEN
  268. $!
  269. $! Tell The User That The File Dosen't Exist.
  270. $!
  271. $ WRITE SYS$OUTPUT ""
  272. $ WRITE SYS$OUTPUT "The File DESTEST.C Dosen't Exist."
  273. $ WRITE SYS$OUTPUT ""
  274. $!
  275. $! Exit The Build.
  276. $!
  277. $ EXIT
  278. $!
  279. $! End The DESTEST.C File Check.
  280. $!
  281. $ ENDIF
  282. $!
  283. $! Tell The User What We Are Building.
  284. $!
  285. $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DESTEST.EXE"
  286. $!
  287. $! Compile The DESTEST Program.
  288. $!
  289. $ CC/OBJECT='OBJ_DIR'DESTEST.OBJ SYS$DISK:[]DESTEST.C
  290. $!
  291. $! Link The DESTEST Program.
  292. $!
  293. $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DESTEST.EXE -
  294. 'OBJ_DIR'DESTEST.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
  295. $!
  296. $! All Done, Time To Return.
  297. $!
  298. $ RETURN
  299. $!
  300. $! Compile The SPEED Program.
  301. $!
  302. $ SPEED:
  303. $!
  304. $! Check To See If We Have The Proper Libraries.
  305. $!
  306. $ GOSUB LIB_CHECK
  307. $!
  308. $! Check To See If We Have A Linker Option File.
  309. $!
  310. $ GOSUB CHECK_OPT_FILE
  311. $!
  312. $! Check To See If The File We Want To Compile Actually Exists.
  313. $!
  314. $ IF (F$SEARCH("SYS$DISK:[]SPEED.C").EQS."")
  315. $ THEN
  316. $!
  317. $! Tell The User That The File Dosen't Exist.
  318. $!
  319. $ WRITE SYS$OUTPUT ""
  320. $ WRITE SYS$OUTPUT "The File SPEED.C Dosen't Exist."
  321. $ WRITE SYS$OUTPUT ""
  322. $!
  323. $! Exit The Build.
  324. $!
  325. $ EXIT
  326. $!
  327. $! End The SPEED.C File Check.
  328. $!
  329. $ ENDIF
  330. $!
  331. $! Tell The User What We Are Building.
  332. $!
  333. $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"SPEED.EXE"
  334. $!
  335. $! Compile The SPEED Program.
  336. $!
  337. $ CC/OBJECT='OBJ_DIR'SPEED.OBJ SYS$DISK:[]SPEED.C
  338. $!
  339. $! Link The SPEED Program.
  340. $!
  341. $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'SPEED.EXE -
  342. 'OBJ_DIR'SPEED.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
  343. $!
  344. $! All Done, Time To Return.
  345. $!
  346. $ RETURN
  347. $!
  348. $! Compile The RPW Program.
  349. $!
  350. $ RPW:
  351. $!
  352. $! Check To See If We Have The Proper Libraries.
  353. $!
  354. $ GOSUB LIB_CHECK
  355. $!
  356. $! Check To See If We Have A Linker Option File.
  357. $!
  358. $ GOSUB CHECK_OPT_FILE
  359. $!
  360. $! Check To See If The File We Want To Compile Actually Exists.
  361. $!
  362. $ IF (F$SEARCH("SYS$DISK:[]RPW.C").EQS."")
  363. $ THEN
  364. $!
  365. $! Tell The User That The File Dosen't Exist.
  366. $!
  367. $ WRITE SYS$OUTPUT ""
  368. $ WRITE SYS$OUTPUT "The File RPW.C Dosen't Exist."
  369. $ WRITE SYS$OUTPUT ""
  370. $!
  371. $! Exit The Build.
  372. $!
  373. $ EXIT
  374. $!
  375. $! End The RPW.C File Check.
  376. $!
  377. $ ENDIF
  378. $!
  379. $! Tell The User What We Are Building.
  380. $!
  381. $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"RPW.EXE"
  382. $!
  383. $! Compile The RPW Program.
  384. $!
  385. $ CC/OBJECT='OBJ_DIR'RPW.OBJ SYS$DISK:[]RPW.C
  386. $!
  387. $! Link The RPW Program.
  388. $!
  389. $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'RPW.EXE -
  390. 'OBJ_DIR'RPW.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
  391. $!
  392. $! All Done, Time To Return.
  393. $!
  394. $ RETURN
  395. $!
  396. $! Compile The DES Program.
  397. $!
  398. $ DES:
  399. $!
  400. $! Check To See If We Have The Proper Libraries.
  401. $!
  402. $ GOSUB LIB_CHECK
  403. $!
  404. $! Check To See If We Have A Linker Option File.
  405. $!
  406. $ GOSUB CHECK_OPT_FILE
  407. $!
  408. $! Check To See If The File We Want To Compile Actually Exists.
  409. $!
  410. $ IF (F$SEARCH("SYS$DISK:[]DES.C").EQS."")
  411. $ THEN
  412. $!
  413. $! Tell The User That The File Dosen't Exist.
  414. $!
  415. $ WRITE SYS$OUTPUT ""
  416. $ WRITE SYS$OUTPUT "The File DES.C Dosen't Exist."
  417. $ WRITE SYS$OUTPUT ""
  418. $!
  419. $! Exit The Build.
  420. $!
  421. $ EXIT
  422. $!
  423. $! End The DES.C File Check.
  424. $!
  425. $ ENDIF
  426. $!
  427. $! Tell The User What We Are Building.
  428. $!
  429. $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DES.EXE"
  430. $!
  431. $! Compile The DES Program.
  432. $!
  433. $ CC/OBJECT='OBJ_DIR'DES.OBJ SYS$DISK:[]DES.C
  434. $ CC/OBJECT='OBJ_DIR'DES.OBJ SYS$DISK:[]CBC3_ENC.C
  435. $!
  436. $! Link The DES Program.
  437. $!
  438. $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DES.EXE -
  439. 'OBJ_DIR'DES.OBJ,'OBJ_DIR'CBC3_ENC.OBJ,-
  440. 'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
  441. $!
  442. $! All Done, Time To Return.
  443. $!
  444. $ RETURN
  445. $!
  446. $! Compile The DES_OPTS Program.
  447. $!
  448. $ DES_OPTS:
  449. $!
  450. $! Check To See If We Have The Proper Libraries.
  451. $!
  452. $ GOSUB LIB_CHECK
  453. $!
  454. $! Check To See If We Have A Linker Option File.
  455. $!
  456. $ GOSUB CHECK_OPT_FILE
  457. $!
  458. $! Check To See If The File We Want To Compile Actually Exists.
  459. $!
  460. $ IF (F$SEARCH("SYS$DISK:[]DES_OPTS.C").EQS."")
  461. $ THEN
  462. $!
  463. $! Tell The User That The File Dosen't Exist.
  464. $!
  465. $ WRITE SYS$OUTPUT ""
  466. $ WRITE SYS$OUTPUT "The File DES_OPTS.C Dosen't Exist."
  467. $ WRITE SYS$OUTPUT ""
  468. $!
  469. $! Exit The Build.
  470. $!
  471. $ EXIT
  472. $!
  473. $! End The DES_OPTS.C File Check.
  474. $!
  475. $ ENDIF
  476. $!
  477. $! Tell The User What We Are Building.
  478. $!
  479. $ WRITE SYS$OUTPUT "Building ",EXE_DIR,"DES_OPTS.EXE"
  480. $!
  481. $! Compile The DES_OPTS Program.
  482. $!
  483. $ CC/OBJECT='OBJ_DIR'DES_OPTS.OBJ SYS$DISK:[]DES_OPTS.C
  484. $!
  485. $! Link The DES_OPTS Program.
  486. $!
  487. $ LINK/'DEBUGGER'/'TRACEBACK'/CONTIGUOUS/EXE='EXE_DIR'DES_OPTS.EXE -
  488. 'OBJ_DIR'DES_OPTS.OBJ,'LIB_NAME'/LIBRARY,'OPT_FILE'/OPTION
  489. $!
  490. $! All Done, Time To Return.
  491. $!
  492. $ RETURN
  493. $ EXIT
  494. $!
  495. $! Check For The Link Option FIle.
  496. $!
  497. $ CHECK_OPT_FILE:
  498. $!
  499. $! Check To See If We Need To Make A VAX C Option File.
  500. $!
  501. $ IF (COMPILER.EQS."VAXC")
  502. $ THEN
  503. $!
  504. $! Check To See If We Already Have A VAX C Linker Option File.
  505. $!
  506. $ IF (F$SEARCH(OPT_FILE).EQS."")
  507. $ THEN
  508. $!
  509. $! We Need A VAX C Linker Option File.
  510. $!
  511. $ CREATE 'OPT_FILE'
  512. $DECK
  513. !
  514. ! Default System Options File To Link Agianst
  515. ! The Sharable VAX C Runtime Library.
  516. !
  517. SYS$SHARE:VAXCRTL.EXE/SHARE
  518. $EOD
  519. $!
  520. $! End The Option File Check.
  521. $!
  522. $ ENDIF
  523. $!
  524. $! End The VAXC Check.
  525. $!
  526. $ ENDIF
  527. $!
  528. $! Check To See If We Need A GNU C Option File.
  529. $!
  530. $ IF (COMPILER.EQS."GNUC")
  531. $ THEN
  532. $!
  533. $! Check To See If We Already Have A GNU C Linker Option File.
  534. $!
  535. $ IF (F$SEARCH(OPT_FILE).EQS."")
  536. $ THEN
  537. $!
  538. $! We Need A GNU C Linker Option File.
  539. $!
  540. $ CREATE 'OPT_FILE'
  541. $DECK
  542. !
  543. ! Default System Options File To Link Agianst
  544. ! The Sharable C Runtime Library.
  545. !
  546. GNU_CC:[000000]GCCLIB/LIBRARY
  547. SYS$SHARE:VAXCRTL/SHARE
  548. $EOD
  549. $!
  550. $! End The Option File Check.
  551. $!
  552. $ ENDIF
  553. $!
  554. $! End The GNU C Check.
  555. $!
  556. $ ENDIF
  557. $!
  558. $! Check To See If We Need A DEC C Option File.
  559. $!
  560. $ IF (COMPILER.EQS."DECC")
  561. $ THEN
  562. $!
  563. $! Check To See If We Already Have A DEC C Linker Option File.
  564. $!
  565. $ IF (F$SEARCH(OPT_FILE).EQS."")
  566. $ THEN
  567. $!
  568. $! Figure Out If We Need An non-VAX Or A VAX Linker Option File.
  569. $!
  570. $ IF (F$GETSYI("CPU").LT.128)
  571. $ THEN
  572. $!
  573. $! We Need A DEC C Linker Option File For VAX.
  574. $!
  575. $ CREATE 'OPT_FILE'
  576. $DECK
  577. !
  578. ! Default System Options File To Link Agianst
  579. ! The Sharable DEC C Runtime Library.
  580. !
  581. SYS$SHARE:DECC$SHR.EXE/SHARE
  582. $EOD
  583. $!
  584. $! Else...
  585. $!
  586. $ ELSE
  587. $!
  588. $! Create The non-VAX Linker Option File.
  589. $!
  590. $ CREATE 'OPT_FILE'
  591. $DECK
  592. !
  593. ! Default System Options File For non-VAX To Link Agianst
  594. ! The Sharable C Runtime Library.
  595. !
  596. SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
  597. SYS$SHARE:CMA$OPEN_RTL/SHARE
  598. $EOD
  599. $!
  600. $! End The DEC C Option File Check.
  601. $!
  602. $ ENDIF
  603. $!
  604. $! End The Option File Search.
  605. $!
  606. $ ENDIF
  607. $!
  608. $! End The DEC C Check.
  609. $!
  610. $ ENDIF
  611. $!
  612. $! Tell The User What Linker Option File We Are Using.
  613. $!
  614. $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
  615. $!
  616. $! Time To RETURN.
  617. $!
  618. $ RETURN
  619. $!
  620. $! Library Check.
  621. $!
  622. $ LIB_CHECK:
  623. $!
  624. $! Look For The Library LIBDES.OLB.
  625. $!
  626. $ IF (F$SEARCH(LIB_NAME).EQS."")
  627. $ THEN
  628. $!
  629. $! Tell The User We Can't Find The [.xxx.CRYPTO.DES]LIBDES.OLB Library.
  630. $!
  631. $ WRITE SYS$OUTPUT ""
  632. $ WRITE SYS$OUTPUT "Can't Find The Library ",LIB_NAME,"."
  633. $ WRITE SYS$OUTPUT "We Can't Link Without It."
  634. $ WRITE SYS$OUTPUT ""
  635. $!
  636. $! Since We Can't Link Without It, Exit.
  637. $!
  638. $ EXIT
  639. $ ENDIF
  640. $!
  641. $! Time To Return.
  642. $!
  643. $ RETURN
  644. $!
  645. $! Check The User's Options.
  646. $!
  647. $ CHECK_OPTIONS:
  648. $!
  649. $! Check To See If We Are To "Just Build Everything".
  650. $!
  651. $ IF (P1.EQS."ALL")
  652. $ THEN
  653. $!
  654. $! P1 Is "ALL", So Build Everything.
  655. $!
  656. $ BUILDALL = "TRUE"
  657. $!
  658. $! Else...
  659. $!
  660. $ ELSE
  661. $!
  662. $! Else, Check To See If P1 Has A Valid Argument.
  663. $!
  664. $ IF (P1.EQS."LIBRARY").OR.(P1.EQS."DESTEST").OR.(P1.EQS."SPEED") -
  665. .OR.(P1.EQS."RPW").OR.(P1.EQS."DES").OR.(P1.EQS."DES_OPTS")
  666. $ THEN
  667. $!
  668. $! A Valid Argument.
  669. $!
  670. $ BUILDALL = P1
  671. $!
  672. $! Else...
  673. $!
  674. $ ELSE
  675. $!
  676. $! Tell The User We Don't Know What They Want.
  677. $!
  678. $ WRITE SYS$OUTPUT ""
  679. $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
  680. $ WRITE SYS$OUTPUT ""
  681. $ WRITE SYS$OUTPUT " ALL : Just Build Everything."
  682. $ WRITE SYS$OUTPUT " LIBRARY : To Compile Just The [.xxx.EXE.CRYPTO.DES]LIBDES.OLB Library."
  683. $ WRITE SYS$OUTPUT " DESTEST : To Compile Just The [.xxx.EXE.CRYPTO.DES]DESTEST.EXE Program."
  684. $ WRITE SYS$OUTPUT " SPEED : To Compile Just The [.xxx.EXE.CRYPTO.DES]SPEED.EXE Program."
  685. $ WRITE SYS$OUTPUT " RPW : To Compile Just The [.xxx.EXE.CRYPTO.DES]RPW.EXE Program."
  686. $ WRITE SYS$OUTPUT " DES : To Compile Just The [.xxx.EXE.CRYPTO.DES]DES.EXE Program."
  687. $ WRITE SYS$OUTPUT " DES_OPTS : To Compile Just The [.xxx.EXE.CRYTPO.DES]DES_OPTS.EXE Program."
  688. $ WRITE SYS$OUTPUT ""
  689. $ WRITE SYS$OUTPUT " Where 'xxx' Stands For: "
  690. $ WRITE SYS$OUTPUT ""
  691. $ WRITE SYS$OUTPUT " ALPHA : Alpha Architecture."
  692. $ WRITE SYS$OUTPUT " IA64 : IA64 Architecture."
  693. $ WRITE SYS$OUTPUT " VAX : VAX Architecture."
  694. $ WRITE SYS$OUTPUT ""
  695. $!
  696. $! Time To EXIT.
  697. $!
  698. $ EXIT
  699. $!
  700. $! End The Valid Argument Check.
  701. $!
  702. $ ENDIF
  703. $!
  704. $! End The P1 Check.
  705. $!
  706. $ ENDIF
  707. $!
  708. $! Check To See If We Are To Compile Without Debugger Information.
  709. $!
  710. $ IF (P2.EQS."NODEBUG")
  711. $ THEN
  712. $!
  713. $! P2 Is Blank, So Compile Without Debugger Information.
  714. $!
  715. $ DEBUGGER = "NODEBUG"
  716. $ TRACEBACK = "NOTRACEBACK"
  717. $ GCC_OPTIMIZE = "OPTIMIZE"
  718. $ CC_OPTIMIZE = "OPTIMIZE"
  719. $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
  720. $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
  721. $!
  722. $! Else...
  723. $!
  724. $ ELSE
  725. $!
  726. $! Check To See If We Are To Compile With Debugger Information.
  727. $!
  728. $ IF (P2.EQS."DEBUG")
  729. $ THEN
  730. $!
  731. $! Compile With Debugger Information.
  732. $!
  733. $ DEBUGGER = "DEBUG"
  734. $ TRACEBACK = "TRACEBACK"
  735. $ GCC_OPTIMIZE = "NOOPTIMIZE"
  736. $ CC_OPTIMIZE = "NOOPTIMIZE"
  737. $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
  738. $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
  739. $!
  740. $! Else...
  741. $!
  742. $ ELSE
  743. $!
  744. $! Tell The User Entered An Invalid Option..
  745. $!
  746. $ WRITE SYS$OUTPUT ""
  747. $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
  748. $ WRITE SYS$OUTPUT ""
  749. $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
  750. $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
  751. $ WRITE SYS$OUTPUT ""
  752. $!
  753. $! Time To EXIT.
  754. $!
  755. $ EXIT
  756. $!
  757. $! End The Valid Argument Check.
  758. $!
  759. $ ENDIF
  760. $!
  761. $! End The P2 Check.
  762. $!
  763. $ ENDIF
  764. $!
  765. $! Special Threads For OpenVMS v7.1 Or Later.
  766. $!
  767. $! Written By: Richard Levitte
  768. $! richard@levitte.org
  769. $!
  770. $!
  771. $! Check To See If We Have A Option For P4.
  772. $!
  773. $ IF (P4.EQS."")
  774. $ THEN
  775. $!
  776. $! Get The Version Of VMS We Are Using.
  777. $!
  778. $ ISSEVEN := ""
  779. $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
  780. $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
  781. $!
  782. $! Check To See If The VMS Version Is v7.1 Or Later.
  783. $!
  784. $ IF (TMP.GE.71)
  785. $ THEN
  786. $!
  787. $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
  788. $!
  789. $ ISSEVEN := ,PTHREAD_USE_D4
  790. $!
  791. $! End The VMS Version Check.
  792. $!
  793. $ ENDIF
  794. $!
  795. $! End The P4 Check.
  796. $!
  797. $ ENDIF
  798. $!
  799. $! Check To See If P3 Is Blank.
  800. $!
  801. $ IF (P3.EQS."")
  802. $ THEN
  803. $!
  804. $! O.K., The User Didn't Specify A Compiler, Let's Try To
  805. $! Find Out Which One To Use.
  806. $!
  807. $! Check To See If We Have GNU C.
  808. $!
  809. $ IF (F$TRNLNM("GNU_CC").NES."")
  810. $ THEN
  811. $!
  812. $! Looks Like GNUC, Set To Use GNUC.
  813. $!
  814. $ P3 = "GNUC"
  815. $!
  816. $! Else...
  817. $!
  818. $ ELSE
  819. $!
  820. $! Check To See If We Have VAXC Or DECC.
  821. $!
  822. $ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
  823. $ THEN
  824. $!
  825. $! Looks Like DECC, Set To Use DECC.
  826. $!
  827. $ P3 = "DECC"
  828. $!
  829. $! Else...
  830. $!
  831. $ ELSE
  832. $!
  833. $! Looks Like VAXC, Set To Use VAXC.
  834. $!
  835. $ P3 = "VAXC"
  836. $!
  837. $! End The VAXC Compiler Check.
  838. $!
  839. $ ENDIF
  840. $!
  841. $! End The DECC & VAXC Compiler Check.
  842. $!
  843. $ ENDIF
  844. $!
  845. $! End The Compiler Check.
  846. $!
  847. $ ENDIF
  848. $!
  849. $! Set Up Initial CC Definitions, Possibly With User Ones
  850. $!
  851. $ CCDEFS = ""
  852. $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = USER_CCDEFS
  853. $ CCEXTRAFLAGS = ""
  854. $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
  855. $ CCDISABLEWARNINGS = ""
  856. $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
  857. CCDISABLEWARNINGS = USER_CCDISABLEWARNINGS
  858. $!
  859. $! Check To See If The User Entered A Valid Paramter.
  860. $!
  861. $ IF (P3.EQS."VAXC").OR.(P3.EQS."DECC").OR.(P3.EQS."GNUC")
  862. $ THEN
  863. $!
  864. $! Check To See If The User Wanted DECC.
  865. $!
  866. $ IF (P3.EQS."DECC")
  867. $ THEN
  868. $!
  869. $! Looks Like DECC, Set To Use DECC.
  870. $!
  871. $ COMPILER = "DECC"
  872. $!
  873. $! Tell The User We Are Using DECC.
  874. $!
  875. $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
  876. $!
  877. $! Use DECC...
  878. $!
  879. $ CC = "CC"
  880. $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
  881. THEN CC = "CC/DECC"
  882. $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
  883. "/NOLIST/PREFIX=ALL" + CCEXTRAFLAGS
  884. $!
  885. $! Define The Linker Options File Name.
  886. $!
  887. $ OPT_FILE = "''EXE_DIR'VAX_DECC_OPTIONS.OPT"
  888. $!
  889. $! End DECC Check.
  890. $!
  891. $ ENDIF
  892. $!
  893. $! Check To See If We Are To Use VAXC.
  894. $!
  895. $ IF (P3.EQS."VAXC")
  896. $ THEN
  897. $!
  898. $! Looks Like VAXC, Set To Use VAXC.
  899. $!
  900. $ COMPILER = "VAXC"
  901. $!
  902. $! Tell The User We Are Using VAX C.
  903. $!
  904. $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
  905. $!
  906. $! Compile Using VAXC.
  907. $!
  908. $ CC = "CC"
  909. $ IF ARCH.NES."VAX"
  910. $ THEN
  911. $ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!"
  912. $ EXIT
  913. $ ENDIF
  914. $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
  915. $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS
  916. $ CCDEFS = """VAXC""," + CCDEFS
  917. $!
  918. $! Define <sys> As SYS$COMMON:[SYSLIB]
  919. $!
  920. $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
  921. $!
  922. $! Define The Linker Options File Name.
  923. $!
  924. $ OPT_FILE = "''EXE_DIR'VAX_VAXC_OPTIONS.OPT"
  925. $!
  926. $! End VAXC Check
  927. $!
  928. $ ENDIF
  929. $!
  930. $! Check To See If We Are To Use GNU C.
  931. $!
  932. $ IF (P3.EQS."GNUC")
  933. $ THEN
  934. $!
  935. $! Looks Like GNUC, Set To Use GNUC.
  936. $!
  937. $ COMPILER = "GNUC"
  938. $!
  939. $! Tell The User We Are Using GNUC.
  940. $!
  941. $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
  942. $!
  943. $! Use GNU C...
  944. $!
  945. $ CC = "GCC/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + CCEXTRAFLAGS
  946. $!
  947. $! Define The Linker Options File Name.
  948. $!
  949. $ OPT_FILE = "''EXE_DIR'VAX_GNUC_OPTIONS.OPT"
  950. $!
  951. $! End The GNU C Check.
  952. $!
  953. $ ENDIF
  954. $!
  955. $! Set up default defines
  956. $!
  957. $ CCDEFS = """FLAT_INC=1""," + CCDEFS
  958. $!
  959. $! Finish up the definition of CC.
  960. $!
  961. $ IF COMPILER .EQS. "DECC"
  962. $ THEN
  963. $ IF CCDISABLEWARNINGS .EQS. ""
  964. $ THEN
  965. $ CC4DISABLEWARNINGS = "DOLLARID"
  966. $ ELSE
  967. $ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID"
  968. $ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
  969. $ ENDIF
  970. $ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))"
  971. $ ELSE
  972. $ CCDISABLEWARNINGS = ""
  973. $ CC4DISABLEWARNINGS = ""
  974. $ ENDIF
  975. $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
  976. $!
  977. $! Show user the result
  978. $!
  979. $ WRITE SYS$OUTPUT "Main Compiling Command: ",CC
  980. $!
  981. $! Else The User Entered An Invalid Argument.
  982. $!
  983. $ ELSE
  984. $!
  985. $! Tell The User We Don't Know What They Want.
  986. $!
  987. $ WRITE SYS$OUTPUT ""
  988. $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
  989. $ WRITE SYS$OUTPUT ""
  990. $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
  991. $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
  992. $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
  993. $ WRITE SYS$OUTPUT ""
  994. $!
  995. $! Time To EXIT.
  996. $!
  997. $ EXIT
  998. $!
  999. $! End The P3 Check.
  1000. $!
  1001. $ ENDIF
  1002. $!
  1003. $! Time To RETURN...
  1004. $!
  1005. $ RETURN