maketests.com 25 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  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 specify 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. $! P5, if defined, specifies the C pointer size. Ignored on VAX.
  41. $! ("64=ARGV" gives more efficient code with HP C V7.3 or newer.)
  42. $! Supported values are:
  43. $!
  44. $! "" Compile with default (/NOPOINTER_SIZE)
  45. $! 32 Compile with /POINTER_SIZE=32 (SHORT)
  46. $! 64 Compile with /POINTER_SIZE=64[=ARGV] (LONG[=ARGV])
  47. $! (Automatically select ARGV if compiler supports it.)
  48. $! 64= Compile with /POINTER_SIZE=64 (LONG).
  49. $! 64=ARGV Compile with /POINTER_SIZE=64=ARGV (LONG=ARGV).
  50. $!
  51. $! P6, if defined, specifies a directory where ZLIB files (zlib.h,
  52. $! libz.olb) may be found. Optionally, a non-default object library
  53. $! name may be included ("dev:[dir]libz_64.olb", for example).
  54. $!
  55. $!
  56. $! Announce/identify.
  57. $!
  58. $ proc = f$environment( "procedure")
  59. $ write sys$output "@@@ "+ -
  60. f$parse( proc, , , "name")+ f$parse( proc, , , "type")
  61. $!
  62. $! Define A TCP/IP Library That We Will Need To Link To.
  63. $! (That is, If We Need To Link To One.)
  64. $!
  65. $ TCPIP_LIB = ""
  66. $ ZLIB_LIB = ""
  67. $!
  68. $! Check Which Architecture We Are Using.
  69. $!
  70. $ if (f$getsyi( "cpu") .lt. 128)
  71. $ then
  72. $ ARCH = "VAX"
  73. $ else
  74. $ ARCH = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE")
  75. $ if (ARCH .eqs. "") then ARCH = "UNK"
  76. $ endif
  77. $!
  78. $ ARCHD = ARCH
  79. $ LIB32 = "32"
  80. $ OPT_FILE = ""
  81. $ POINTER_SIZE = ""
  82. $!
  83. $! Check To Make Sure We Have Valid Command Line Parameters.
  84. $!
  85. $ GOSUB CHECK_OPTIONS
  86. $!
  87. $! Define The OBJ and EXE Directories.
  88. $!
  89. $ OBJ_DIR := SYS$DISK:[-.'ARCHD'.OBJ.TEST]
  90. $ EXE_DIR := SYS$DISK:[-.'ARCHD'.EXE.TEST]
  91. $!
  92. $! Specify the destination directory in any /MAP option.
  93. $!
  94. $ if (LINKMAP .eqs. "MAP")
  95. $ then
  96. $ LINKMAP = LINKMAP+ "=''EXE_DIR'"
  97. $ endif
  98. $!
  99. $! Add the location prefix to the linker options file name.
  100. $!
  101. $ if (OPT_FILE .nes. "")
  102. $ then
  103. $ OPT_FILE = EXE_DIR+ OPT_FILE
  104. $ endif
  105. $!
  106. $! Initialise logical names and such
  107. $!
  108. $ GOSUB INITIALISE
  109. $!
  110. $! Tell The User What Kind of Machine We Run On.
  111. $!
  112. $ WRITE SYS$OUTPUT "Host system architecture: ''ARCHD'"
  113. $!
  114. $! Define The CRYPTO-LIB We Are To Use.
  115. $!
  116. $ CRYPTO_LIB := SYS$DISK:[-.'ARCHD'.EXE.CRYPTO]SSL_LIBCRYPTO'LIB32'.OLB
  117. $!
  118. $! Define The SSL We Are To Use.
  119. $!
  120. $ SSL_LIB := SYS$DISK:[-.'ARCHD'.EXE.SSL]SSL_LIBSSL'LIB32'.OLB
  121. $!
  122. $! Create the OBJ and EXE Directories, if needed.
  123. $!
  124. $ IF (F$PARSE(OBJ_DIR).EQS."") THEN -
  125. CREATE /DIRECTORY 'OBJ_DIR'
  126. $ IF (F$PARSE(EXE_DIR).EQS."") THEN -
  127. CREATE /DIRECTORY 'EXE_DIR'
  128. $!
  129. $! Check To See If We Have The Proper Libraries.
  130. $!
  131. $ GOSUB LIB_CHECK
  132. $!
  133. $! Check To See If We Have A Linker Option File.
  134. $!
  135. $ GOSUB CHECK_OPT_FILE
  136. $!
  137. $! Define The TEST Files.
  138. $! NOTE: Some might think this list ugly. However, it's made this way to
  139. $! reflect the EXE variable in Makefile as closely as possible,
  140. $! thereby making it fairly easy to verify that the lists are the same.
  141. $!
  142. $ TEST_FILES = "BNTEST,ECTEST,ECDSATEST,ECDHTEST,IDEATEST,"+ -
  143. "MD2TEST,MD4TEST,MD5TEST,HMACTEST,WP_TEST,"+ -
  144. "RC2TEST,RC4TEST,RC5TEST,"+ -
  145. "DESTEST,SHATEST,SHA1TEST,SHA256T,SHA512T,"+ -
  146. "MDC2TEST,RMDTEST,"+ -
  147. "RANDTEST,DHTEST,ENGINETEST,"+ -
  148. "BFTEST,CASTTEST,SSLTEST,EXPTEST,DSATEST,RSA_TEST,"+ -
  149. "EVP_TEST,IGETEST,JPAKETEST,SRPTEST"
  150. $! Should we add MTTEST,PQ_TEST,LH_TEST,DIVTEST,TABTEST as well?
  151. $!
  152. $! Additional directory information.
  153. $ T_D_BNTEST := [-.crypto.bn]
  154. $ T_D_ECTEST := [-.crypto.ec]
  155. $ T_D_ECDSATEST := [-.crypto.ecdsa]
  156. $ T_D_ECDHTEST := [-.crypto.ecdh]
  157. $ T_D_IDEATEST := [-.crypto.idea]
  158. $ T_D_MD2TEST := [-.crypto.md2]
  159. $ T_D_MD4TEST := [-.crypto.md4]
  160. $ T_D_MD5TEST := [-.crypto.md5]
  161. $ T_D_HMACTEST := [-.crypto.hmac]
  162. $ T_D_WP_TEST := [-.crypto.whrlpool]
  163. $ T_D_RC2TEST := [-.crypto.rc2]
  164. $ T_D_RC4TEST := [-.crypto.rc4]
  165. $ T_D_RC5TEST := [-.crypto.rc5]
  166. $ T_D_DESTEST := [-.crypto.des]
  167. $ T_D_SHATEST := [-.crypto.sha]
  168. $ T_D_SHA1TEST := [-.crypto.sha]
  169. $ T_D_SHA256T := [-.crypto.sha]
  170. $ T_D_SHA512T := [-.crypto.sha]
  171. $ T_D_MDC2TEST := [-.crypto.mdc2]
  172. $ T_D_RMDTEST := [-.crypto.ripemd]
  173. $ T_D_RANDTEST := [-.crypto.rand]
  174. $ T_D_DHTEST := [-.crypto.dh]
  175. $ T_D_ENGINETEST := [-.crypto.engine]
  176. $ T_D_BFTEST := [-.crypto.bf]
  177. $ T_D_CASTTEST := [-.crypto.cast]
  178. $ T_D_SSLTEST := [-.ssl]
  179. $ T_D_EXPTEST := [-.crypto.bn]
  180. $ T_D_DSATEST := [-.crypto.dsa]
  181. $ T_D_RSA_TEST := [-.crypto.rsa]
  182. $ T_D_EVP_TEST := [-.crypto.evp]
  183. $ T_D_IGETEST := [-.test]
  184. $ T_D_JPAKETEST := [-.crypto.jpake]
  185. $ T_D_SRPTEST := [-.crypto.srp]
  186. $!
  187. $ TCPIP_PROGRAMS = ",,"
  188. $ IF COMPILER .EQS. "VAXC" THEN -
  189. TCPIP_PROGRAMS = ",SSLTEST,"
  190. $!
  191. $! Define A File Counter And Set It To "0".
  192. $!
  193. $ FILE_COUNTER = 0
  194. $!
  195. $! Top Of The File Loop.
  196. $!
  197. $ NEXT_FILE:
  198. $!
  199. $! O.K, Extract The File Name From The File List.
  200. $!
  201. $ FILE_NAME = F$ELEMENT(FILE_COUNTER,",",TEST_FILES)
  202. $!
  203. $! Check To See If We Are At The End Of The File List.
  204. $!
  205. $ IF (FILE_NAME.EQS.",") THEN GOTO FILE_DONE
  206. $!
  207. $! Increment The Counter.
  208. $!
  209. $ FILE_COUNTER = FILE_COUNTER + 1
  210. $!
  211. $! Create The Source File Name.
  212. $!
  213. $ SOURCE_FILE = "SYS$DISK:" + T_D_'FILE_NAME' + FILE_NAME + ".C"
  214. $!
  215. $! Create The Object File Name.
  216. $!
  217. $ OBJECT_FILE = OBJ_DIR + FILE_NAME + ".OBJ"
  218. $!
  219. $! Create The Executable File Name.
  220. $!
  221. $ EXE_FILE = EXE_DIR + FILE_NAME + ".EXE"
  222. $ ON WARNING THEN GOTO NEXT_FILE
  223. $!
  224. $! Check To See If The File We Want To Compile Actually Exists.
  225. $!
  226. $ IF (F$SEARCH(SOURCE_FILE).EQS."")
  227. $ THEN
  228. $!
  229. $! Tell The User That The File Dosen't Exist.
  230. $!
  231. $ WRITE SYS$OUTPUT ""
  232. $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist."
  233. $ WRITE SYS$OUTPUT ""
  234. $!
  235. $! Exit The Build.
  236. $!
  237. $ GOTO EXIT
  238. $ ENDIF
  239. $!
  240. $! Tell The User What We Are Building.
  241. $!
  242. $ WRITE SYS$OUTPUT "Building The ",FILE_NAME," Test Program."
  243. $!
  244. $! Compile The File.
  245. $!
  246. $ ON ERROR THEN GOTO NEXT_FILE
  247. $ CC /OBJECT='OBJECT_FILE' 'SOURCE_FILE'
  248. $ ON WARNING THEN GOTO NEXT_FILE
  249. $!
  250. $! Check If What We Are About To Compile Works Without A TCP/IP Library.
  251. $!
  252. $ IF ((TCPIP_LIB.EQS."").AND.((TCPIP_PROGRAMS-FILE_NAME).NES.TCPIP_PROGRAMS))
  253. $ THEN
  254. $!
  255. $! Inform The User That A TCP/IP Library Is Needed To Compile This Program.
  256. $!
  257. $ WRITE SYS$OUTPUT -
  258. FILE_NAME," Needs A TCP/IP Library. Can't Link. Skipping..."
  259. $ GOTO NEXT_FILE
  260. $!
  261. $! End The TCP/IP Library Check.
  262. $!
  263. $ ENDIF
  264. $!
  265. $! Link The Program, Check To See If We Need To Link With RSAREF Or Not.
  266. $! Check To See If We Are To Link With A Specific TCP/IP Library.
  267. $!
  268. $! Don't Link With The RSAREF Routines And TCP/IP Library.
  269. $!
  270. $ LINK /'DEBUGGER' /'LINKMAP' /'TRACEBACK' /EXECTABLE = 'EXE_FILE' -
  271. 'OBJECT_FILE', -
  272. 'SSL_LIB' /LIBRARY, -
  273. 'CRYPTO_LIB' /LIBRARY -
  274. 'TCPIP_LIB' -
  275. 'ZLIB_LIB' -
  276. ,'OPT_FILE' /OPTIONS
  277. $!
  278. $! Go Back And Do It Again.
  279. $!
  280. $ GOTO NEXT_FILE
  281. $!
  282. $! All Done With This Library Part.
  283. $!
  284. $ FILE_DONE:
  285. $!
  286. $! All Done, Time To Exit.
  287. $!
  288. $ EXIT:
  289. $ GOSUB CLEANUP
  290. $ EXIT
  291. $!
  292. $! Check For The Link Option FIle.
  293. $!
  294. $ CHECK_OPT_FILE:
  295. $!
  296. $! Check To See If We Need To Make A VAX C Option File.
  297. $!
  298. $ IF (COMPILER.EQS."VAXC")
  299. $ THEN
  300. $!
  301. $! Check To See If We Already Have A VAX C Linker Option File.
  302. $!
  303. $ IF (F$SEARCH(OPT_FILE).EQS."")
  304. $ THEN
  305. $!
  306. $! We Need A VAX C Linker Option File.
  307. $!
  308. $ CREATE 'OPT_FILE'
  309. $DECK
  310. !
  311. ! Default System Options File To Link Against
  312. ! The Sharable VAX C Runtime Library.
  313. !
  314. SYS$SHARE:VAXCRTL.EXE /SHAREABLE
  315. $EOD
  316. $!
  317. $! End The Option File Check.
  318. $!
  319. $ ENDIF
  320. $!
  321. $! End The VAXC Check.
  322. $!
  323. $ ENDIF
  324. $!
  325. $! Check To See If We Need A GNU C Option File.
  326. $!
  327. $ IF (COMPILER.EQS."GNUC")
  328. $ THEN
  329. $!
  330. $! Check To See If We Already Have A GNU C Linker Option File.
  331. $!
  332. $ IF (F$SEARCH(OPT_FILE).EQS."")
  333. $ THEN
  334. $!
  335. $! We Need A GNU C Linker Option File.
  336. $!
  337. $ CREATE 'OPT_FILE'
  338. $DECK
  339. !
  340. ! Default System Options File To Link Against
  341. ! The Sharable C Runtime Library.
  342. !
  343. GNU_CC:[000000]GCCLIB.OLB /LIBRARY
  344. SYS$SHARE:VAXCRTL.EXE /SHAREABLE
  345. $EOD
  346. $!
  347. $! End The Option File Check.
  348. $!
  349. $ ENDIF
  350. $!
  351. $! End The GNU C Check.
  352. $!
  353. $ ENDIF
  354. $!
  355. $! Check To See If We Need A DEC C Option File.
  356. $!
  357. $ IF (COMPILER.EQS."DECC")
  358. $ THEN
  359. $!
  360. $! Check To See If We Already Have A DEC C Linker Option File.
  361. $!
  362. $ IF (F$SEARCH(OPT_FILE).EQS."")
  363. $ THEN
  364. $!
  365. $! Figure Out If We Need A non-VAX Or A VAX Linker Option File.
  366. $!
  367. $ IF (ARCH.EQS."VAX")
  368. $ THEN
  369. $!
  370. $! We Need A DEC C Linker Option File For VAX.
  371. $!
  372. $ CREATE 'OPT_FILE'
  373. $DECK
  374. !
  375. ! Default System Options File To Link Against
  376. ! The Sharable DEC C Runtime Library.
  377. !
  378. SYS$SHARE:DECC$SHR.EXE /SHAREABLE
  379. $EOD
  380. $!
  381. $! Else...
  382. $!
  383. $ ELSE
  384. $!
  385. $! Create The non-VAX Linker Option File.
  386. $!
  387. $ CREATE 'OPT_FILE'
  388. $DECK
  389. !
  390. ! Default System Options File For non-VAX To Link Against
  391. ! The Sharable C Runtime Library.
  392. !
  393. SYS$SHARE:CMA$OPEN_LIB_SHR.EXE /SHAREABLE
  394. SYS$SHARE:CMA$OPEN_RTL.EXE /SHAREABLE
  395. $EOD
  396. $!
  397. $! End The DEC C Option File Check.
  398. $!
  399. $ ENDIF
  400. $!
  401. $! End The Option File Search.
  402. $!
  403. $ ENDIF
  404. $!
  405. $! End The DEC C Check.
  406. $!
  407. $ ENDIF
  408. $!
  409. $! Tell The User What Linker Option File We Are Using.
  410. $!
  411. $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
  412. $!
  413. $! Time To RETURN.
  414. $!
  415. $ RETURN
  416. $!
  417. $! Check To See If We Have The Appropiate Libraries.
  418. $!
  419. $ LIB_CHECK:
  420. $!
  421. $! Look For The Library LIBCRYPTO.OLB.
  422. $!
  423. $ IF (F$SEARCH(CRYPTO_LIB).EQS."")
  424. $ THEN
  425. $!
  426. $! Tell The User We Can't Find The LIBCRYPTO.OLB Library.
  427. $!
  428. $ WRITE SYS$OUTPUT ""
  429. $ WRITE SYS$OUTPUT "Can't Find The Library ",CRYPTO_LIB,"."
  430. $ WRITE SYS$OUTPUT "We Can't Link Without It."
  431. $ WRITE SYS$OUTPUT ""
  432. $!
  433. $! Since We Can't Link Without It, Exit.
  434. $!
  435. $ EXIT
  436. $!
  437. $! End The Crypto Library Check.
  438. $!
  439. $ ENDIF
  440. $!
  441. $! Look For The Library LIBSSL.OLB.
  442. $!
  443. $ IF (F$SEARCH(SSL_LIB).EQS."")
  444. $ THEN
  445. $!
  446. $! Tell The User We Can't Find The LIBSSL.OLB Library.
  447. $!
  448. $ WRITE SYS$OUTPUT ""
  449. $ WRITE SYS$OUTPUT "Can't Find The Library ",SSL_LIB,"."
  450. $ WRITE SYS$OUTPUT "Some Of The Test Programs Need To Link To It."
  451. $ WRITE SYS$OUTPUT ""
  452. $!
  453. $! Since We Can't Link Without It, Exit.
  454. $!
  455. $ EXIT
  456. $!
  457. $! End The SSL Library Check.
  458. $!
  459. $ ENDIF
  460. $!
  461. $! Time To Return.
  462. $!
  463. $ RETURN
  464. $!
  465. $! Check The User's Options.
  466. $!
  467. $ CHECK_OPTIONS:
  468. $!
  469. $! Set basic C compiler /INCLUDE directories.
  470. $!
  471. $ CC_INCLUDES = "SYS$DISK:[-],SYS$DISK:[-.CRYPTO]"
  472. $!
  473. $! Check To See If P1 Is Blank.
  474. $!
  475. $ IF (P1.EQS."NODEBUG")
  476. $ THEN
  477. $!
  478. $! P1 Is NODEBUG, So Compile Without Debugger Information.
  479. $!
  480. $ DEBUGGER = "NODEBUG"
  481. $ LINKMAP = "NOMAP"
  482. $ TRACEBACK = "NOTRACEBACK"
  483. $ GCC_OPTIMIZE = "OPTIMIZE"
  484. $ CC_OPTIMIZE = "OPTIMIZE"
  485. $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
  486. $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
  487. $!
  488. $! Else...
  489. $!
  490. $ ELSE
  491. $!
  492. $! Check To See If We Are To Compile With Debugger Information.
  493. $!
  494. $ IF (P1.EQS."DEBUG")
  495. $ THEN
  496. $!
  497. $! Compile With Debugger Information.
  498. $!
  499. $ DEBUGGER = "DEBUG"
  500. $ LINKMAP = "MAP"
  501. $ TRACEBACK = "TRACEBACK"
  502. $ GCC_OPTIMIZE = "NOOPTIMIZE"
  503. $ CC_OPTIMIZE = "NOOPTIMIZE"
  504. $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
  505. $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
  506. $!
  507. $! Else...
  508. $!
  509. $ ELSE
  510. $!
  511. $! Tell The User Entered An Invalid Option.
  512. $!
  513. $ WRITE SYS$OUTPUT ""
  514. $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
  515. $ WRITE SYS$OUTPUT ""
  516. $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
  517. $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
  518. $ WRITE SYS$OUTPUT ""
  519. $!
  520. $! Time To EXIT.
  521. $!
  522. $ EXIT
  523. $!
  524. $! End The Valid Argument Check.
  525. $!
  526. $ ENDIF
  527. $!
  528. $! End The P1 Check.
  529. $!
  530. $ ENDIF
  531. $!
  532. $! Check P5 (POINTER_SIZE).
  533. $!
  534. $ IF (P5 .NES. "") .AND. (ARCH .NES. "VAX")
  535. $ THEN
  536. $!
  537. $ IF (P5 .EQS. "32")
  538. $ THEN
  539. $ POINTER_SIZE = " /POINTER_SIZE=32"
  540. $ ELSE
  541. $ POINTER_SIZE = F$EDIT( P5, "COLLAPSE, UPCASE")
  542. $ IF ((POINTER_SIZE .EQS. "64") .OR. -
  543. (POINTER_SIZE .EQS. "64=") .OR. -
  544. (POINTER_SIZE .EQS. "64=ARGV"))
  545. $ THEN
  546. $ ARCHD = ARCH+ "_64"
  547. $ LIB32 = ""
  548. $ IF (F$EXTRACT( 2, 1, POINTER_SIZE) .EQS. "=")
  549. $ THEN
  550. $! Explicit user choice: "64" or "64=ARGV".
  551. $ IF (POINTER_SIZE .EQS. "64=") THEN POINTER_SIZE = "64"
  552. $ ELSE
  553. $ SET NOON
  554. $ DEFINE /USER_MODE SYS$OUTPUT NL:
  555. $ DEFINE /USER_MODE SYS$ERROR NL:
  556. $ CC /NOLIST /NOOBJECT /POINTER_SIZE=64=ARGV NL:
  557. $ IF ($STATUS .AND. %X0FFF0000) .EQ. %X00030000
  558. $ THEN
  559. $ ! If we got here, it means DCL complained like this:
  560. $ ! %DCL-W-NOVALU, value not allowed - remove value specification
  561. $ ! \64=\
  562. $ !
  563. $ ! If the compiler was run, logicals defined in /USER would
  564. $ ! have been deassigned automatically. However, when DCL
  565. $ ! complains, they aren't, so we do it here (it might be
  566. $ ! unnecessary, but just in case there will be another error
  567. $ ! message further on that we don't want to miss)
  568. $ DEASSIGN /USER_MODE SYS$ERROR
  569. $ DEASSIGN /USER_MODE SYS$OUTPUT
  570. $ ELSE
  571. $ POINTER_SIZE = POINTER_SIZE + "=ARGV"
  572. $ ENDIF
  573. $ SET ON
  574. $ ENDIF
  575. $ POINTER_SIZE = " /POINTER_SIZE=''POINTER_SIZE'"
  576. $ ELSE
  577. $!
  578. $! Tell The User Entered An Invalid Option.
  579. $!
  580. $ WRITE SYS$OUTPUT ""
  581. $ WRITE SYS$OUTPUT "The Option ", P5, -
  582. " Is Invalid. The Valid Options Are:"
  583. $ WRITE SYS$OUTPUT ""
  584. $ WRITE SYS$OUTPUT -
  585. " """" : Compile with default (short) pointers."
  586. $ WRITE SYS$OUTPUT -
  587. " 32 : Compile with 32-bit (short) pointers."
  588. $ WRITE SYS$OUTPUT -
  589. " 64 : Compile with 64-bit (long) pointers (auto ARGV)."
  590. $ WRITE SYS$OUTPUT -
  591. " 64= : Compile with 64-bit (long) pointers (no ARGV)."
  592. $ WRITE SYS$OUTPUT -
  593. " 64=ARGV : Compile with 64-bit (long) pointers (ARGV)."
  594. $ WRITE SYS$OUTPUT ""
  595. $!
  596. $! Time To EXIT.
  597. $!
  598. $ EXIT
  599. $!
  600. $ ENDIF
  601. $!
  602. $ ENDIF
  603. $!
  604. $! End The P5 (POINTER_SIZE) Check.
  605. $!
  606. $ ENDIF
  607. $!
  608. $! Check To See If P2 Is Blank.
  609. $!
  610. $ IF (P2.EQS."")
  611. $ THEN
  612. $!
  613. $! O.K., The User Didn't Specify A Compiler, Let's Try To
  614. $! Find Out Which One To Use.
  615. $!
  616. $! Check To See If We Have GNU C.
  617. $!
  618. $ IF (F$TRNLNM("GNU_CC").NES."")
  619. $ THEN
  620. $!
  621. $! Looks Like GNUC, Set To Use GNUC.
  622. $!
  623. $ P2 = "GNUC"
  624. $!
  625. $! End The GNU C Compiler Check.
  626. $!
  627. $ ELSE
  628. $!
  629. $! Check To See If We Have VAXC Or DECC.
  630. $!
  631. $ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
  632. $ THEN
  633. $!
  634. $! Looks Like DECC, Set To Use DECC.
  635. $!
  636. $ P2 = "DECC"
  637. $!
  638. $! Else...
  639. $!
  640. $ ELSE
  641. $!
  642. $! Looks Like VAXC, Set To Use VAXC.
  643. $!
  644. $ P2 = "VAXC"
  645. $!
  646. $! End The VAXC Compiler Check.
  647. $!
  648. $ ENDIF
  649. $!
  650. $! End The DECC & VAXC Compiler Check.
  651. $!
  652. $ ENDIF
  653. $!
  654. $! End The Compiler Check.
  655. $!
  656. $ ENDIF
  657. $!
  658. $! Check To See If We Have A Option For P3.
  659. $!
  660. $ IF (P3.EQS."")
  661. $ THEN
  662. $!
  663. $! Find out what socket library we have available
  664. $!
  665. $ IF F$PARSE("SOCKETSHR:") .NES. ""
  666. $ THEN
  667. $!
  668. $! We have SOCKETSHR, and it is my opinion that it's the best to use.
  669. $!
  670. $ P3 = "SOCKETSHR"
  671. $!
  672. $! Tell the user
  673. $!
  674. $ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP"
  675. $!
  676. $! Else, let's look for something else
  677. $!
  678. $ ELSE
  679. $!
  680. $! Like UCX (the reason to do this before Multinet is that the UCX
  681. $! emulation is easier to use...)
  682. $!
  683. $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" -
  684. .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" -
  685. .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. ""
  686. $ THEN
  687. $!
  688. $! Last resort: a UCX or UCX-compatible library
  689. $!
  690. $ P3 = "UCX"
  691. $!
  692. $! Tell the user
  693. $!
  694. $ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP"
  695. $!
  696. $! That was all...
  697. $!
  698. $ ENDIF
  699. $ ENDIF
  700. $ ENDIF
  701. $!
  702. $! Set Up Initial CC Definitions, Possibly With User Ones
  703. $!
  704. $ CCDEFS = "TCPIP_TYPE_''P3'"
  705. $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
  706. $ CCEXTRAFLAGS = ""
  707. $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
  708. $ CCDISABLEWARNINGS = "" !!! "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR"
  709. $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
  710. CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS
  711. $!
  712. $! Check To See If We Have A ZLIB Option.
  713. $!
  714. $ ZLIB = P6
  715. $ IF (ZLIB .NES. "")
  716. $ THEN
  717. $!
  718. $! Check for expected ZLIB files.
  719. $!
  720. $ err = 0
  721. $ file1 = f$parse( "zlib.h", ZLIB, , , "SYNTAX_ONLY")
  722. $ if (f$search( file1) .eqs. "")
  723. $ then
  724. $ WRITE SYS$OUTPUT ""
  725. $ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid."
  726. $ WRITE SYS$OUTPUT " Can't find header: ''file1'"
  727. $ err = 1
  728. $ endif
  729. $ file1 = f$parse( "A.;", ZLIB)- "A.;"
  730. $!
  731. $ file2 = f$parse( ZLIB, "libz.olb", , , "SYNTAX_ONLY")
  732. $ if (f$search( file2) .eqs. "")
  733. $ then
  734. $ if (err .eq. 0)
  735. $ then
  736. $ WRITE SYS$OUTPUT ""
  737. $ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid."
  738. $ endif
  739. $ WRITE SYS$OUTPUT " Can't find library: ''file2'"
  740. $ WRITE SYS$OUTPUT ""
  741. $ err = err+ 2
  742. $ endif
  743. $ if (err .eq. 1)
  744. $ then
  745. $ WRITE SYS$OUTPUT ""
  746. $ endif
  747. $!
  748. $ if (err .ne. 0)
  749. $ then
  750. $ GOTO EXIT
  751. $ endif
  752. $!
  753. $ CCDEFS = """ZLIB=1"", "+ CCDEFS
  754. $ CC_INCLUDES = CC_INCLUDES+ ", "+ file1
  755. $ ZLIB_LIB = ", ''file2' /library"
  756. $!
  757. $! Print info
  758. $!
  759. $ WRITE SYS$OUTPUT "ZLIB library spec: ", file2
  760. $!
  761. $! End The P8 Check.
  762. $!
  763. $ ENDIF
  764. $!
  765. $! Check To See If The User Entered A Valid Parameter.
  766. $!
  767. $ IF (P2.EQS."VAXC").OR.(P2.EQS."DECC").OR.(P2.EQS."GNUC")
  768. $ THEN
  769. $!
  770. $! Check To See If The User Wanted DECC.
  771. $!
  772. $ IF (P2.EQS."DECC")
  773. $ THEN
  774. $!
  775. $! Looks Like DECC, Set To Use DECC.
  776. $!
  777. $ COMPILER = "DECC"
  778. $!
  779. $! Tell The User We Are Using DECC.
  780. $!
  781. $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
  782. $!
  783. $! Use DECC...
  784. $!
  785. $ CC = "CC"
  786. $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
  787. THEN CC = "CC /DECC"
  788. $ CC = CC + " /''CC_OPTIMIZE' /''DEBUGGER' /STANDARD=RELAXED"+ -
  789. "''POINTER_SIZE' /NOLIST /PREFIX=ALL" + -
  790. " /INCLUDE=(''CC_INCLUDES') " + CCEXTRAFLAGS
  791. $!
  792. $! Define The Linker Options File Name.
  793. $!
  794. $ OPT_FILE = "VAX_DECC_OPTIONS.OPT"
  795. $!
  796. $! End DECC Check.
  797. $!
  798. $ ENDIF
  799. $!
  800. $! Check To See If We Are To Use VAXC.
  801. $!
  802. $ IF (P2.EQS."VAXC")
  803. $ THEN
  804. $!
  805. $! Looks Like VAXC, Set To Use VAXC.
  806. $!
  807. $ COMPILER = "VAXC"
  808. $!
  809. $! Tell The User We Are Using VAX C.
  810. $!
  811. $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
  812. $!
  813. $! Compile Using VAXC.
  814. $!
  815. $ CC = "CC"
  816. $ IF ARCH.NES."VAX"
  817. $ THEN
  818. $ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!"
  819. $ EXIT
  820. $ ENDIF
  821. $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC /VAXC"
  822. $ CC = CC + "/''CC_OPTIMIZE' /''DEBUGGER' /NOLIST" + -
  823. "/INCLUDE=(''CC_INCLUDES')" + CCEXTRAFLAGS
  824. $ CCDEFS = CCDEFS + ",""VAXC"""
  825. $!
  826. $! Define <sys> As SYS$COMMON:[SYSLIB]
  827. $!
  828. $ DEFINE /NOLOG SYS SYS$COMMON:[SYSLIB]
  829. $!
  830. $! Define The Linker Options File Name.
  831. $!
  832. $ OPT_FILE = "VAX_VAXC_OPTIONS.OPT"
  833. $!
  834. $! End VAXC Check
  835. $!
  836. $ ENDIF
  837. $!
  838. $! Check To See If We Are To Use GNU C.
  839. $!
  840. $ IF (P2.EQS."GNUC")
  841. $ THEN
  842. $!
  843. $! Looks Like GNUC, Set To Use GNUC.
  844. $!
  845. $ COMPILER = "GNUC"
  846. $!
  847. $! Tell The User We Are Using GNUC.
  848. $!
  849. $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
  850. $!
  851. $! Use GNU C...
  852. $!
  853. $ CC = "GCC /NOCASE_HACK /''GCC_OPTIMIZE' /''DEBUGGER' /NOLIST" + -
  854. "/INCLUDE=(''CC_INCLUDES')" + CCEXTRAFLAGS
  855. $!
  856. $! Define The Linker Options File Name.
  857. $!
  858. $ OPT_FILE = "VAX_GNUC_OPTIONS.OPT"
  859. $!
  860. $! End The GNU C Check.
  861. $!
  862. $ ENDIF
  863. $!
  864. $! Set up default defines
  865. $!
  866. $ CCDEFS = """FLAT_INC=1""," + CCDEFS
  867. $!
  868. $! Finish up the definition of CC.
  869. $!
  870. $ IF COMPILER .EQS. "DECC"
  871. $ THEN
  872. $ IF CCDISABLEWARNINGS .EQS. ""
  873. $ THEN
  874. $ CC4DISABLEWARNINGS = "DOLLARID"
  875. $ ELSE
  876. $ CC4DISABLEWARNINGS = CCDISABLEWARNINGS + ",DOLLARID"
  877. $ CCDISABLEWARNINGS = " /WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
  878. $ ENDIF
  879. $ CC4DISABLEWARNINGS = " /WARNING=(DISABLE=(" + CC4DISABLEWARNINGS + "))"
  880. $ ELSE
  881. $ CCDISABLEWARNINGS = ""
  882. $ CC4DISABLEWARNINGS = ""
  883. $ ENDIF
  884. $ CC = CC + " /DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
  885. $!
  886. $! Show user the result
  887. $!
  888. $ WRITE /SYMBOL SYS$OUTPUT "Main Compiling Command: ", CC
  889. $!
  890. $! Else The User Entered An Invalid Argument.
  891. $!
  892. $ ELSE
  893. $!
  894. $! Tell The User We Don't Know What They Want.
  895. $!
  896. $ WRITE SYS$OUTPUT ""
  897. $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
  898. $ WRITE SYS$OUTPUT ""
  899. $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
  900. $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
  901. $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
  902. $ WRITE SYS$OUTPUT ""
  903. $!
  904. $! Time To EXIT.
  905. $!
  906. $ EXIT
  907. $ ENDIF
  908. $!
  909. $! Time to check the contents, and to make sure we get the correct library.
  910. $!
  911. $ IF P3.EQS."SOCKETSHR" .OR. P3.EQS."MULTINET" .OR. P3.EQS."UCX" -
  912. .OR. P3.EQS."TCPIP" .OR. P3.EQS."NONE"
  913. $ THEN
  914. $!
  915. $! Check to see if SOCKETSHR was chosen
  916. $!
  917. $ IF P3.EQS."SOCKETSHR"
  918. $ THEN
  919. $!
  920. $! Set the library to use SOCKETSHR
  921. $!
  922. $ TCPIP_LIB = ",SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT /OPTIONS"
  923. $!
  924. $! Done with SOCKETSHR
  925. $!
  926. $ ENDIF
  927. $!
  928. $! Check to see if MULTINET was chosen
  929. $!
  930. $ IF P3.EQS."MULTINET"
  931. $ THEN
  932. $!
  933. $! Set the library to use UCX emulation.
  934. $!
  935. $ P3 = "UCX"
  936. $!
  937. $! Done with MULTINET
  938. $!
  939. $ ENDIF
  940. $!
  941. $! Check to see if UCX was chosen
  942. $!
  943. $ IF P3.EQS."UCX"
  944. $ THEN
  945. $!
  946. $! Set the library to use UCX.
  947. $!
  948. $ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT /OPTIONS"
  949. $ IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
  950. $ THEN
  951. $ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT /OPTIONS"
  952. $ ELSE
  953. $ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
  954. TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT /OPTIONS"
  955. $ ENDIF
  956. $!
  957. $! Done with UCX
  958. $!
  959. $ ENDIF
  960. $!
  961. $! Check to see if TCPIP was chosen
  962. $!
  963. $ IF P3.EQS."TCPIP"
  964. $ THEN
  965. $!
  966. $! Set the library to use TCPIP (post UCX).
  967. $!
  968. $ TCPIP_LIB = ",SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT /OPTIONS"
  969. $!
  970. $! Done with TCPIP
  971. $!
  972. $ ENDIF
  973. $!
  974. $! Check to see if NONE was chosen
  975. $!
  976. $ IF P3.EQS."NONE"
  977. $ THEN
  978. $!
  979. $! Do not use a TCPIP library.
  980. $!
  981. $ TCPIP_LIB = ""
  982. $!
  983. $! Done with NONE
  984. $!
  985. $ ENDIF
  986. $!
  987. $! Print info
  988. $!
  989. $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB- ","
  990. $!
  991. $! Else The User Entered An Invalid Argument.
  992. $!
  993. $ ELSE
  994. $!
  995. $! Tell The User We Don't Know What They Want.
  996. $!
  997. $ WRITE SYS$OUTPUT ""
  998. $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
  999. $ WRITE SYS$OUTPUT ""
  1000. $ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library."
  1001. $ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library."
  1002. $ WRITE SYS$OUTPUT " TCPIP : To link with TCPIP (post UCX) TCP/IP library."
  1003. $ WRITE SYS$OUTPUT ""
  1004. $!
  1005. $! Time To EXIT.
  1006. $!
  1007. $ EXIT
  1008. $!
  1009. $! Done with TCP/IP libraries
  1010. $!
  1011. $ ENDIF
  1012. $!
  1013. $! Special Threads For OpenVMS v7.1 Or Later
  1014. $!
  1015. $! Written By: Richard Levitte
  1016. $! richard@levitte.org
  1017. $!
  1018. $!
  1019. $! Check To See If We Have A Option For P4.
  1020. $!
  1021. $ IF (P4.EQS."")
  1022. $ THEN
  1023. $!
  1024. $! Get The Version Of VMS We Are Using.
  1025. $!
  1026. $ ISSEVEN :=
  1027. $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
  1028. $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
  1029. $!
  1030. $! Check To See If The VMS Version Is v7.1 Or Later.
  1031. $!
  1032. $ IF (TMP.GE.71)
  1033. $ THEN
  1034. $!
  1035. $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
  1036. $!
  1037. $ ISSEVEN := ,PTHREAD_USE_D4
  1038. $!
  1039. $! End The VMS Version Check.
  1040. $!
  1041. $ ENDIF
  1042. $!
  1043. $! End The P4 Check.
  1044. $!
  1045. $ ENDIF
  1046. $!
  1047. $! Time To RETURN...
  1048. $!
  1049. $ RETURN
  1050. $!
  1051. $ INITIALISE:
  1052. $!
  1053. $! Save old value of the logical name OPENSSL
  1054. $!
  1055. $ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE")
  1056. $!
  1057. $! Save directory information
  1058. $!
  1059. $ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
  1060. $ __HERE = F$EDIT(__HERE,"UPCASE")
  1061. $ __TOP = __HERE - "TEST]"
  1062. $ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
  1063. $!
  1064. $! Set up the logical name OPENSSL to point at the include directory
  1065. $!
  1066. $ DEFINE OPENSSL /NOLOG '__INCLUDE'
  1067. $!
  1068. $! Done
  1069. $!
  1070. $ RETURN
  1071. $!
  1072. $ CLEANUP:
  1073. $!
  1074. $! Restore the logical name OPENSSL if it had a value
  1075. $!
  1076. $ IF __SAVE_OPENSSL .EQS. ""
  1077. $ THEN
  1078. $ DEASSIGN OPENSSL
  1079. $ ELSE
  1080. $ DEFINE /NOLOG OPENSSL '__SAVE_OPENSSL'
  1081. $ ENDIF
  1082. $!
  1083. $! Done
  1084. $!
  1085. $ RETURN