maketests.com 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925
  1. $!
  2. $! MAKETESTS.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 all the various different
  11. $! "test" programs for the different types of encryption for OpenSSL.
  12. $! It was written so it would try to determine what "C" compiler to
  13. $! use or you can specify which "C" compiler to use.
  14. $!
  15. $! The test "executables" will be placed in a directory called
  16. $! [.xxx.EXE.TEST] where "xxx" denotes ALPHA, IA64, or VAX, depending
  17. $! on your machine architecture.
  18. $!
  19. $! Specify DEBUG or NODEBUG P1 to compile with or without debugger
  20. $! information.
  21. $!
  22. $! Specify which compiler at P2 to try to compile under.
  23. $!
  24. $! VAXC For VAX C.
  25. $! DECC For DEC C.
  26. $! GNUC For GNU C.
  27. $!
  28. $! If you don't speficy a compiler, it will try to determine which
  29. $! "C" compiler to use.
  30. $!
  31. $! P3, if defined, sets a TCP/IP library to use, through one of the following
  32. $! keywords:
  33. $!
  34. $! UCX for UCX
  35. $! SOCKETSHR for SOCKETSHR+NETLIB
  36. $!
  37. $! P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
  38. $!
  39. $!
  40. $! Define A TCP/IP Library That We Will Need To Link To.
  41. $! (That is, If Wee Need To Link To One.)
  42. $!
  43. $ TCPIP_LIB = ""
  44. $!
  45. $! Check Which Architecture We Are Using.
  46. $!
  47. $ if (f$getsyi( "HW_MODEL") .lt. 1024)
  48. $ then
  49. $ arch = "VAX"
  50. $ else
  51. $ arch = ""
  52. $ arch = arch+ f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
  53. $ if (arch .eqs. "") then arch = "UNK"
  54. $ endif
  55. $!
  56. $! Define The OBJ and EXE Directories (EXE before CHECK_OPTIONS).
  57. $!
  58. $ OBJ_DIR := SYS$DISK:[-.'ARCH'.OBJ.TEST]
  59. $ EXE_DIR := SYS$DISK:[-.'ARCH'.EXE.TEST]
  60. $!
  61. $! Check To Make Sure We Have Valid Command Line Parameters.
  62. $!
  63. $ GOSUB CHECK_OPTIONS
  64. $!
  65. $! Initialise logical names and such
  66. $!
  67. $ GOSUB INITIALISE
  68. $!
  69. $! Tell The User What Kind of Machine We Run On.
  70. $!
  71. $ WRITE SYS$OUTPUT "Compiling On ''ARCH'."
  72. $!
  73. $! Define The CRYPTO-LIB We Are To Use.
  74. $!
  75. $ CRYPTO_LIB := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO.OLB
  76. $!
  77. $! Define The SSL We Are To Use.
  78. $!
  79. $ SSL_LIB := SYS$DISK:[-.'ARCH'.EXE.SSL]LIBSSL.OLB
  80. $!
  81. $! Create the OBJ and EXE Directories, if needed.
  82. $!
  83. $ IF (F$PARSE(OBJ_DIR).EQS."") THEN -
  84. CREATE /DIRECTORY 'OBJ_DIR'
  85. $ IF (F$PARSE(EXE_DIR).EQS."") THEN -
  86. CREATE /DIRECTORY 'EXE_DIR'
  87. $!
  88. $! Check To See If We Have The Proper Libraries.
  89. $!
  90. $ GOSUB LIB_CHECK
  91. $!
  92. $! Check To See If We Have A Linker Option File.
  93. $!
  94. $ GOSUB CHECK_OPT_FILE
  95. $!
  96. $! Define The TEST Files.
  97. $! NOTE: Some might think this list ugly. However, it's made this way to
  98. $! reflect the EXE variable in Makefile as closely as possible,
  99. $! thereby making it fairly easy to verify that the lists are the same.
  100. $!
  101. $ TEST_FILES = "BNTEST,ECTEST,ECDSATEST,ECDHTEST,IDEATEST,"+ -
  102. "MD2TEST,MD4TEST,MD5TEST,HMACTEST,"+ -
  103. "RC2TEST,RC4TEST,RC5TEST,"+ -
  104. "DESTEST,SHATEST,SHA1TEST,SHA256T,SHA512T,"+ -
  105. "MDC2TEST,RMDTEST,"+ -
  106. "RANDTEST,DHTEST,ENGINETEST,"+ -
  107. "BFTEST,CASTTEST,SSLTEST,EXPTEST,DSATEST,RSA_TEST,"+ -
  108. "EVP_TEST,JPAKETEST,IGETEST"
  109. $! Should we add MTTEST,PQ_TEST,LH_TEST,DIVTEST,TABTEST as well?
  110. $
  111. $! Additional directory information.
  112. $ T_D_BNTEST := [-.crypto.bn]
  113. $ T_D_ECTEST := [-.crypto.ec]
  114. $ T_D_ECDSATEST := [-.crypto.ecdsa]
  115. $ T_D_ECDHTEST := [-.crypto.ecdh]
  116. $ T_D_IDEATEST := [-.crypto.idea]
  117. $ T_D_MD2TEST := [-.crypto.md2]
  118. $ T_D_MD4TEST := [-.crypto.md4]
  119. $ T_D_MD5TEST := [-.crypto.md5]
  120. $ T_D_HMACTEST := [-.crypto.hmac]
  121. $ T_D_RC2TEST := [-.crypto.rc2]
  122. $ T_D_RC4TEST := [-.crypto.rc4]
  123. $ T_D_RC5TEST := [-.crypto.rc5]
  124. $ T_D_DESTEST := [-.crypto.des]
  125. $ T_D_SHATEST := [-.crypto.sha]
  126. $ T_D_SHA1TEST := [-.crypto.sha]
  127. $ T_D_SHA256T := [-.crypto.sha]
  128. $ T_D_SHA512T := [-.crypto.sha]
  129. $ T_D_MDC2TEST := [-.crypto.mdc2]
  130. $ T_D_RMDTEST := [-.crypto.ripemd]
  131. $ T_D_RANDTEST := [-.crypto.rand]
  132. $ T_D_DHTEST := [-.crypto.dh]
  133. $ T_D_ENGINETEST := [-.crypto.engine]
  134. $ T_D_BFTEST := [-.crypto.bf]
  135. $ T_D_CASTTEST := [-.crypto.cast]
  136. $ T_D_SSLTEST := [-.ssl]
  137. $ T_D_EXPTEST := [-.crypto.bn]
  138. $ T_D_DSATEST := [-.crypto.dsa]
  139. $ T_D_RSA_TEST := [-.crypto.rsa]
  140. $ T_D_EVP_TEST := [-.crypto.evp]
  141. $ T_D_JPAKETEST := [-.crypto.jpake]
  142. $ T_D_IGETEST := [-.test]
  143. $!
  144. $ TCPIP_PROGRAMS = ",,"
  145. $ IF COMPILER .EQS. "VAXC" THEN -
  146. TCPIP_PROGRAMS = ",SSLTEST,"
  147. $!
  148. $! Define A File Counter And Set It To "0".
  149. $!
  150. $ FILE_COUNTER = 0
  151. $!
  152. $! Top Of The File Loop.
  153. $!
  154. $ NEXT_FILE:
  155. $!
  156. $! O.K, Extract The File Name From The File List.
  157. $!
  158. $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",TEST_FILES)
  159. $!
  160. $! Check To See If We Are At The End Of The File List.
  161. $!
  162. $ IF (FILE_NAME.EQS.",") THEN GOTO FILE_DONE
  163. $!
  164. $! Increment The Counter.
  165. $!
  166. $ FILE_COUNTER = FILE_COUNTER + 1
  167. $!
  168. $! Create The Source File Name.
  169. $!
  170. $ SOURCE_FILE = "SYS$DISK:" + T_D_'FILE_NAME' + FILE_NAME + ".C"
  171. $!
  172. $! Create The Object File Name.
  173. $!
  174. $ OBJECT_FILE = OBJ_DIR + FILE_NAME + ".OBJ"
  175. $!
  176. $! Create The Executable File Name.
  177. $!
  178. $ EXE_FILE = EXE_DIR + FILE_NAME + ".EXE"
  179. $ ON WARNING THEN GOTO NEXT_FILE
  180. $!
  181. $! Check To See If The File We Want To Compile Actually Exists.
  182. $!
  183. $ IF (F$SEARCH(SOURCE_FILE).EQS."")
  184. $ THEN
  185. $!
  186. $! Tell The User That The File Dosen't Exist.
  187. $!
  188. $ WRITE SYS$OUTPUT ""
  189. $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist."
  190. $ WRITE SYS$OUTPUT ""
  191. $!
  192. $! Exit The Build.
  193. $!
  194. $ GOTO EXIT
  195. $ ENDIF
  196. $!
  197. $! Tell The User What We Are Building.
  198. $!
  199. $ WRITE SYS$OUTPUT "Building The ",FILE_NAME," Test Program."
  200. $!
  201. $! Compile The File.
  202. $!
  203. $ ON ERROR THEN GOTO NEXT_FILE
  204. $ CC /OBJECT='OBJECT_FILE' 'SOURCE_FILE'
  205. $ ON WARNING THEN GOTO NEXT_FILE
  206. $!
  207. $! Check If What We Are About To Compile Works Without A TCP/IP Library.
  208. $!
  209. $ IF ((TCPIP_LIB.EQS."").AND.((TCPIP_PROGRAMS-FILE_NAME).NES.TCPIP_PROGRAMS))
  210. $ THEN
  211. $!
  212. $! Inform The User That A TCP/IP Library Is Needed To Compile This Program.
  213. $!
  214. $ WRITE SYS$OUTPUT -
  215. FILE_NAME," Needs A TCP/IP Library. Can't Link. Skipping..."
  216. $ GOTO NEXT_FILE
  217. $!
  218. $! End The TCP/IP Library Check.
  219. $!
  220. $ ENDIF
  221. $!
  222. $! Link The Program, Check To See If We Need To Link With RSAREF Or Not.
  223. $! Check To See If We Are To Link With A Specific TCP/IP Library.
  224. $!
  225. $ IF (TCPIP_LIB.NES."")
  226. $ THEN
  227. $!
  228. $! Don't Link With The RSAREF Routines And TCP/IP Library.
  229. $!
  230. $ LINK /'DEBUGGER' /'TRACEBACK' /EXECUTABLE = 'EXE_FILE' -
  231. 'OBJECT_FILE', -
  232. 'SSL_LIB' /LIBRARY, -
  233. 'CRYPTO_LIB' /LIBRARY, -
  234. 'TCPIP_LIB', -
  235. 'OPT_FILE' /OPTIONS
  236. $!
  237. $! Else...
  238. $!
  239. $ ELSE
  240. $!
  241. $! Don't Link With The RSAREF Routines And Link With A TCP/IP Library.
  242. $!
  243. $ LINK /'DEBUGGER' /'TRACEBACK' /EXECUTABLE = 'EXE_FILE' -
  244. 'OBJECT_FILE', -
  245. 'SSL_LIB' /LIBRARY, -
  246. 'CRYPTO_LIB' /LIBRARY, -
  247. 'OPT_FILE' /OPTIONS
  248. $!
  249. $! End The TCP/IP Library Check.
  250. $!
  251. $ ENDIF
  252. $!
  253. $! Go Back And Do It Again.
  254. $!
  255. $ GOTO NEXT_FILE
  256. $!
  257. $! All Done With This Library Part.
  258. $!
  259. $ FILE_DONE:
  260. $!
  261. $! All Done, Time To Exit.
  262. $!
  263. $ EXIT:
  264. $ GOSUB CLEANUP
  265. $ EXIT
  266. $!
  267. $! Check For The Link Option FIle.
  268. $!
  269. $ CHECK_OPT_FILE:
  270. $!
  271. $! Check To See If We Need To Make A VAX C Option File.
  272. $!
  273. $ IF (COMPILER.EQS."VAXC")
  274. $ THEN
  275. $!
  276. $! Check To See If We Already Have A VAX C Linker Option File.
  277. $!
  278. $ IF (F$SEARCH(OPT_FILE).EQS."")
  279. $ THEN
  280. $!
  281. $! We Need A VAX C Linker Option File.
  282. $!
  283. $ CREATE 'OPT_FILE'
  284. $DECK
  285. !
  286. ! Default System Options File To Link Against
  287. ! The Shareable VAX C Runtime Library.
  288. !
  289. SYS$SHARE:VAXCRTL.EXE /SHAREABLE
  290. $EOD
  291. $!
  292. $! End The Option File Check.
  293. $!
  294. $ ENDIF
  295. $!
  296. $! End The VAXC Check.
  297. $!
  298. $ ENDIF
  299. $!
  300. $! Check To See If We Need A GNU C Option File.
  301. $!
  302. $ IF (COMPILER.EQS."GNUC")
  303. $ THEN
  304. $!
  305. $! Check To See If We Already Have A GNU C Linker Option File.
  306. $!
  307. $ IF (F$SEARCH(OPT_FILE).EQS."")
  308. $ THEN
  309. $!
  310. $! We Need A GNU C Linker Option File.
  311. $!
  312. $ CREATE 'OPT_FILE'
  313. $DECK
  314. !
  315. ! Default System Options File To Link Against
  316. ! The Shareable C Runtime Library.
  317. !
  318. GNU_CC:[000000]GCCLIB.OLB /LIBRARY
  319. SYS$SHARE:VAXCRTL.EXE /SHAREABLE
  320. $EOD
  321. $!
  322. $! End The Option File Check.
  323. $!
  324. $ ENDIF
  325. $!
  326. $! End The GNU C Check.
  327. $!
  328. $ ENDIF
  329. $!
  330. $! Check To See If We Need A DEC C Option File.
  331. $!
  332. $ IF (COMPILER.EQS."DECC")
  333. $ THEN
  334. $!
  335. $! Check To See If We Already Have A DEC C Linker Option File.
  336. $!
  337. $ IF (F$SEARCH(OPT_FILE).EQS."")
  338. $ THEN
  339. $!
  340. $! Figure Out If We Need A non-VAX Or A VAX Linker Option File.
  341. $!
  342. $ IF (ARCH.EQS."VAX")
  343. $ THEN
  344. $!
  345. $! We Need A DEC C Linker Option File For VAX.
  346. $!
  347. $ CREATE 'OPT_FILE'
  348. $DECK
  349. !
  350. ! Default System Options File To Link Against
  351. ! The Shareable DEC C Runtime Library.
  352. !
  353. SYS$SHARE:DECC$SHR.EXE /SHAREABLE
  354. $EOD
  355. $!
  356. $! Else...
  357. $!
  358. $ ELSE
  359. $!
  360. $! Create The non-VAX Linker Option File.
  361. $!
  362. $ CREATE 'OPT_FILE'
  363. $DECK
  364. !
  365. ! Default System Options File For non-VAX To Link Against
  366. ! The Shareable C Runtime Library.
  367. !
  368. SYS$SHARE:CMA$OPEN_LIB_SHR.EXE /SHAREABLE
  369. SYS$SHARE:CMA$OPEN_RTL.EXE /SHAREABLE
  370. $EOD
  371. $!
  372. $! End The DEC C Option File Check.
  373. $!
  374. $ ENDIF
  375. $!
  376. $! End The Option File Search.
  377. $!
  378. $ ENDIF
  379. $!
  380. $! End The DEC C Check.
  381. $!
  382. $ ENDIF
  383. $!
  384. $! Tell The User What Linker Option File We Are Using.
  385. $!
  386. $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
  387. $!
  388. $! Time To RETURN.
  389. $!
  390. $ RETURN
  391. $!
  392. $! Check To See If We Have The Appropiate Libraries.
  393. $!
  394. $ LIB_CHECK:
  395. $!
  396. $! Look For The Library LIBCRYPTO.OLB.
  397. $!
  398. $ IF (F$SEARCH(CRYPTO_LIB).EQS."")
  399. $ THEN
  400. $!
  401. $! Tell The User We Can't Find The LIBCRYPTO.OLB Library.
  402. $!
  403. $ WRITE SYS$OUTPUT ""
  404. $ WRITE SYS$OUTPUT "Can't Find The Library ",CRYPTO_LIB,"."
  405. $ WRITE SYS$OUTPUT "We Can't Link Without It."
  406. $ WRITE SYS$OUTPUT ""
  407. $!
  408. $! Since We Can't Link Without It, Exit.
  409. $!
  410. $ EXIT
  411. $!
  412. $! End The Crypto Library Check.
  413. $!
  414. $ ENDIF
  415. $!
  416. $! Look For The Library LIBSSL.OLB.
  417. $!
  418. $ IF (F$SEARCH(SSL_LIB).EQS."")
  419. $ THEN
  420. $!
  421. $! Tell The User We Can't Find The LIBSSL.OLB Library.
  422. $!
  423. $ WRITE SYS$OUTPUT ""
  424. $ WRITE SYS$OUTPUT "Can't Find The Library ",SSL_LIB,"."
  425. $ WRITE SYS$OUTPUT "Some Of The Test Programs Need To Link To It."
  426. $ WRITE SYS$OUTPUT ""
  427. $!
  428. $! Since We Can't Link Without It, Exit.
  429. $!
  430. $ EXIT
  431. $!
  432. $! End The SSL Library Check.
  433. $!
  434. $ ENDIF
  435. $!
  436. $! Time To Return.
  437. $!
  438. $ RETURN
  439. $!
  440. $! Check The User's Options.
  441. $!
  442. $ CHECK_OPTIONS:
  443. $!
  444. $! Check To See If P1 Is Blank.
  445. $!
  446. $ IF (P1.EQS."NODEBUG")
  447. $ THEN
  448. $!
  449. $! P1 Is NODEBUG, So Compile Without Debugger Information.
  450. $!
  451. $ DEBUGGER = "NODEBUG"
  452. $ TRACEBACK = "NOTRACEBACK"
  453. $ GCC_OPTIMIZE = "OPTIMIZE"
  454. $ CC_OPTIMIZE = "OPTIMIZE"
  455. $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
  456. $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
  457. $!
  458. $! Else...
  459. $!
  460. $ ELSE
  461. $!
  462. $! Check To See If We Are To Compile With Debugger Information.
  463. $!
  464. $ IF (P1.EQS."DEBUG")
  465. $ THEN
  466. $!
  467. $! Compile With Debugger Information.
  468. $!
  469. $ DEBUGGER = "DEBUG"
  470. $ TRACEBACK = "TRACEBACK"
  471. $ GCC_OPTIMIZE = "NOOPTIMIZE"
  472. $ CC_OPTIMIZE = "NOOPTIMIZE"
  473. $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
  474. $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
  475. $!
  476. $! Else...
  477. $!
  478. $ ELSE
  479. $!
  480. $! Tell The User Entered An Invalid Option..
  481. $!
  482. $ WRITE SYS$OUTPUT ""
  483. $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
  484. $ WRITE SYS$OUTPUT ""
  485. $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
  486. $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
  487. $ WRITE SYS$OUTPUT ""
  488. $!
  489. $! Time To EXIT.
  490. $!
  491. $ EXIT
  492. $!
  493. $! End The Valid Arguement Check.
  494. $!
  495. $ ENDIF
  496. $!
  497. $! End The P2 Check.
  498. $!
  499. $ ENDIF
  500. $!
  501. $! Check To See If P2 Is Blank.
  502. $!
  503. $ IF (P2.EQS."")
  504. $ THEN
  505. $!
  506. $! O.K., The User Didn't Specify A Compiler, Let's Try To
  507. $! Find Out Which One To Use.
  508. $!
  509. $! Check To See If We Have GNU C.
  510. $!
  511. $ IF (F$TRNLNM("GNU_CC").NES."")
  512. $ THEN
  513. $!
  514. $! Looks Like GNUC, Set To Use GNUC.
  515. $!
  516. $ P2 = "GNUC"
  517. $!
  518. $! End The GNU C Compiler Check.
  519. $!
  520. $ ELSE
  521. $!
  522. $! Check To See If We Have VAXC Or DECC.
  523. $!
  524. $ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
  525. $ THEN
  526. $!
  527. $! Looks Like DECC, Set To Use DECC.
  528. $!
  529. $ P2 = "DECC"
  530. $!
  531. $! Else...
  532. $!
  533. $ ELSE
  534. $!
  535. $! Looks Like VAXC, Set To Use VAXC.
  536. $!
  537. $ P2 = "VAXC"
  538. $!
  539. $! End The VAXC Compiler Check.
  540. $!
  541. $ ENDIF
  542. $!
  543. $! End The DECC & VAXC Compiler Check.
  544. $!
  545. $ ENDIF
  546. $!
  547. $! End The Compiler Check.
  548. $!
  549. $ ENDIF
  550. $!
  551. $! Check To See If We Have A Option For P3.
  552. $!
  553. $ IF (P3.EQS."")
  554. $ THEN
  555. $!
  556. $! Find out what socket library we have available
  557. $!
  558. $ IF F$PARSE("SOCKETSHR:") .NES. ""
  559. $ THEN
  560. $!
  561. $! We have SOCKETSHR, and it is my opinion that it's the best to use.
  562. $!
  563. $ P3 = "SOCKETSHR"
  564. $!
  565. $! Tell the user
  566. $!
  567. $ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP"
  568. $!
  569. $! Else, let's look for something else
  570. $!
  571. $ ELSE
  572. $!
  573. $! Like UCX (the reason to do this before Multinet is that the UCX
  574. $! emulation is easier to use...)
  575. $!
  576. $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" -
  577. .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" -
  578. .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. ""
  579. $ THEN
  580. $!
  581. $! Last resort: a UCX or UCX-compatible library
  582. $!
  583. $ P3 = "UCX"
  584. $!
  585. $! Tell the user
  586. $!
  587. $ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP"
  588. $!
  589. $! That was all...
  590. $!
  591. $ ENDIF
  592. $ ENDIF
  593. $ ENDIF
  594. $!
  595. $! Set Up Initial CC Definitions, Possibly With User Ones
  596. $!
  597. $ CCDEFS = "TCPIP_TYPE_''P3'"
  598. $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
  599. $ CCEXTRAFLAGS = ""
  600. $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
  601. $ CCDISABLEWARNINGS = "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR"
  602. $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
  603. CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS
  604. $!
  605. $! Check To See If The User Entered A Valid Paramter.
  606. $!
  607. $ IF (P2.EQS."VAXC").OR.(P2.EQS."DECC").OR.(P2.EQS."GNUC")
  608. $ THEN
  609. $!
  610. $! Check To See If The User Wanted DECC.
  611. $!
  612. $ IF (P2.EQS."DECC")
  613. $ THEN
  614. $!
  615. $! Looks Like DECC, Set To Use DECC.
  616. $!
  617. $ COMPILER = "DECC"
  618. $!
  619. $! Tell The User We Are Using DECC.
  620. $!
  621. $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
  622. $!
  623. $! Use DECC...
  624. $!
  625. $ CC = "CC"
  626. $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
  627. THEN CC = "CC /DECC"
  628. $ CC = CC + "/''CC_OPTIMIZE' /''DEBUGGER' /STANDARD=ANSI89" + -
  629. "/NOLIST /PREFIX=ALL" + -
  630. "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS
  631. $!
  632. $! Define The Linker Options File Name.
  633. $!
  634. $ OPT_FILE = "''EXE_DIR'VAX_DECC_OPTIONS.OPT"
  635. $!
  636. $! End DECC Check.
  637. $!
  638. $ ENDIF
  639. $!
  640. $! Check To See If We Are To Use VAXC.
  641. $!
  642. $ IF (P2.EQS."VAXC")
  643. $ THEN
  644. $!
  645. $! Looks Like VAXC, Set To Use VAXC.
  646. $!
  647. $ COMPILER = "VAXC"
  648. $!
  649. $! Tell The User We Are Using VAX C.
  650. $!
  651. $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
  652. $!
  653. $! Compile Using VAXC.
  654. $!
  655. $ CC = "CC"
  656. $ IF ARCH.NES."VAX"
  657. $ THEN
  658. $ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!"
  659. $ EXIT
  660. $ ENDIF
  661. $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC /VAXC"
  662. $ CC = CC + "/''CC_OPTIMIZE' /''DEBUGGER' /NOLIST" + -
  663. "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS
  664. $ CCDEFS = CCDEFS + ",""VAXC"""
  665. $!
  666. $! Define <sys> As SYS$COMMON:[SYSLIB]
  667. $!
  668. $ DEFINE /NOLOG SYS SYS$COMMON:[SYSLIB]
  669. $!
  670. $! Define The Linker Options File Name.
  671. $!
  672. $ OPT_FILE = "''EXE_DIR'VAX_VAXC_OPTIONS.OPT"
  673. $!
  674. $! End VAXC Check
  675. $!
  676. $ ENDIF
  677. $!
  678. $! Check To See If We Are To Use GNU C.
  679. $!
  680. $ IF (P2.EQS."GNUC")
  681. $ THEN
  682. $!
  683. $! Looks Like GNUC, Set To Use GNUC.
  684. $!
  685. $ COMPILER = "GNUC"
  686. $!
  687. $! Tell The User We Are Using GNUC.
  688. $!
  689. $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
  690. $!
  691. $! Use GNU C...
  692. $!
  693. $ CC = "GCC /NOCASE_HACK /''GCC_OPTIMIZE' /''DEBUGGER' /NOLIST" + -
  694. "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS
  695. $!
  696. $! Define The Linker Options File Name.
  697. $!
  698. $ OPT_FILE = "''EXE_DIR'VAX_GNUC_OPTIONS.OPT"
  699. $!
  700. $! End The GNU C Check.
  701. $!
  702. $ ENDIF
  703. $!
  704. $! Set up default defines
  705. $!
  706. $ CCDEFS = """FLAT_INC=1""," + CCDEFS
  707. $!
  708. $! Finish up the definition of CC.
  709. $!
  710. $ IF COMPILER .EQS. "DECC"
  711. $ THEN
  712. $ IF CCDISABLEWARNINGS .EQS. ""
  713. $ THEN
  714. $ CC4DISABLEWARNINGS = "DOLLARID"
  715. $ ELSE
  716. $ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID"
  717. $ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
  718. $ ENDIF
  719. $ CC4DISABLEWARNINGS = "/WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))"
  720. $ ELSE
  721. $ CCDISABLEWARNINGS = ""
  722. $ CC4DISABLEWARNINGS = ""
  723. $ ENDIF
  724. $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
  725. $!
  726. $! Show user the result
  727. $!
  728. $ WRITE /SYMBOL SYS$OUTPUT "Main Compiling Command: ", CC
  729. $!
  730. $! Else The User Entered An Invalid Arguement.
  731. $!
  732. $ ELSE
  733. $!
  734. $! Tell The User We Don't Know What They Want.
  735. $!
  736. $ WRITE SYS$OUTPUT ""
  737. $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
  738. $ WRITE SYS$OUTPUT ""
  739. $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
  740. $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
  741. $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
  742. $ WRITE SYS$OUTPUT ""
  743. $!
  744. $! Time To EXIT.
  745. $!
  746. $ EXIT
  747. $ ENDIF
  748. $!
  749. $! Time to check the contents, and to make sure we get the correct library.
  750. $!
  751. $ IF P3.EQS."SOCKETSHR" .OR. P3.EQS."MULTINET" .OR. P3.EQS."UCX" -
  752. .OR. P3.EQS."TCPIP" .OR. P3.EQS."NONE"
  753. $ THEN
  754. $!
  755. $! Check to see if SOCKETSHR was chosen
  756. $!
  757. $ IF P3.EQS."SOCKETSHR"
  758. $ THEN
  759. $!
  760. $! Set the library to use SOCKETSHR
  761. $!
  762. $ TCPIP_LIB = "SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT /OPTIONS"
  763. $!
  764. $! Done with SOCKETSHR
  765. $!
  766. $ ENDIF
  767. $!
  768. $! Check to see if MULTINET was chosen
  769. $!
  770. $ IF P3.EQS."MULTINET"
  771. $ THEN
  772. $!
  773. $! Set the library to use UCX emulation.
  774. $!
  775. $ P3 = "UCX"
  776. $!
  777. $! Done with MULTINET
  778. $!
  779. $ ENDIF
  780. $!
  781. $! Check to see if UCX was chosen
  782. $!
  783. $ IF P3.EQS."UCX"
  784. $ THEN
  785. $!
  786. $! Set the library to use UCX.
  787. $!
  788. $ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT /OPTIONS"
  789. $ IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
  790. $ THEN
  791. $ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT /OPTIONS"
  792. $ ELSE
  793. $ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
  794. TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT /OPTIONS"
  795. $ ENDIF
  796. $!
  797. $! Done with UCX
  798. $!
  799. $ ENDIF
  800. $!
  801. $! Check to see if TCPIP was chosen
  802. $!
  803. $ IF P3.EQS."TCPIP"
  804. $ THEN
  805. $!
  806. $! Set the library to use TCPIP (post UCX).
  807. $!
  808. $ TCPIP_LIB = "SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT /OPTIONS"
  809. $!
  810. $! Done with TCPIP
  811. $!
  812. $ ENDIF
  813. $!
  814. $! Check to see if NONE was chosen
  815. $!
  816. $ IF P3.EQS."NONE"
  817. $ THEN
  818. $!
  819. $! Do not use a TCPIP library.
  820. $!
  821. $ TCPIP_LIB = ""
  822. $!
  823. $! Done with NONE
  824. $!
  825. $ ENDIF
  826. $!
  827. $! Print info
  828. $!
  829. $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB
  830. $!
  831. $! Else The User Entered An Invalid Arguement.
  832. $!
  833. $ ELSE
  834. $!
  835. $! Tell The User We Don't Know What They Want.
  836. $!
  837. $ WRITE SYS$OUTPUT ""
  838. $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
  839. $ WRITE SYS$OUTPUT ""
  840. $ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library."
  841. $ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library."
  842. $ WRITE SYS$OUTPUT " TCPIP : To link with TCPIP (post UCX) TCP/IP library."
  843. $ WRITE SYS$OUTPUT ""
  844. $!
  845. $! Time To EXIT.
  846. $!
  847. $ EXIT
  848. $!
  849. $! Done with TCP/IP libraries
  850. $!
  851. $ ENDIF
  852. $!
  853. $! Special Threads For OpenVMS v7.1 Or Later
  854. $!
  855. $! Written By: Richard Levitte
  856. $! richard@levitte.org
  857. $!
  858. $!
  859. $! Check To See If We Have A Option For P4.
  860. $!
  861. $ IF (P4.EQS."")
  862. $ THEN
  863. $!
  864. $! Get The Version Of VMS We Are Using.
  865. $!
  866. $ ISSEVEN :=
  867. $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
  868. $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
  869. $!
  870. $! Check To See If The VMS Version Is v7.1 Or Later.
  871. $!
  872. $ IF (TMP.GE.71)
  873. $ THEN
  874. $!
  875. $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
  876. $!
  877. $ ISSEVEN := ,PTHREAD_USE_D4
  878. $!
  879. $! End The VMS Version Check.
  880. $!
  881. $ ENDIF
  882. $!
  883. $! End The P4 Check.
  884. $!
  885. $ ENDIF
  886. $!
  887. $! Time To RETURN...
  888. $!
  889. $ RETURN
  890. $!
  891. $ INITIALISE:
  892. $!
  893. $! Save old value of the logical name OPENSSL
  894. $!
  895. $ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE")
  896. $!
  897. $! Save directory information
  898. $!
  899. $ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
  900. $ __HERE = F$EDIT(__HERE,"UPCASE")
  901. $ __TOP = __HERE - "TEST]"
  902. $ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
  903. $!
  904. $! Set up the logical name OPENSSL to point at the include directory
  905. $!
  906. $ DEFINE OPENSSL /NOLOG '__INCLUDE'
  907. $!
  908. $! Done
  909. $!
  910. $ RETURN
  911. $!
  912. $ CLEANUP:
  913. $!
  914. $! Restore the logical name OPENSSL if it had a value
  915. $!
  916. $ IF __SAVE_OPENSSL .EQS. ""
  917. $ THEN
  918. $ DEASSIGN OPENSSL
  919. $ ELSE
  920. $ DEFINE /NOLOG OPENSSL '__SAVE_OPENSSL'
  921. $ ENDIF
  922. $!
  923. $! Done
  924. $!
  925. $ RETURN