makeapps.com 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997
  1. $!
  2. $! MAKEAPPS.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. $! Zoltan Arpadffy <zoli@polarhome.com>
  10. $!
  11. $! This command files compiles and creates all the various different
  12. $! "application" programs for the different types of encryption for OpenSSL.
  13. $! The EXE's are placed in the directory [.xxx.EXE.APPS] where "xxx" denotes
  14. $! ALPHA, IA64 or VAX, depending on your machine architecture.
  15. $!
  16. $! It was written so it would try to determine what "C" compiler to
  17. $! use or you can specify which "C" compiler to use.
  18. $!
  19. $! Specify DEBUG or NODEBUG as 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. $! TCPIP for TCPIP (post UCX)
  37. $!
  38. $! P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
  39. $!
  40. $! P5, if defined, sets a choice of programs to compile.
  41. $!
  42. $!
  43. $! Define A TCP/IP Library That We Will Need To Link To.
  44. $! (That Is, If We Need To Link To One.)
  45. $!
  46. $ TCPIP_LIB = ""
  47. $!
  48. $! Check What Architecture We Are Using.
  49. $!
  50. $ IF (F$GETSYI("CPU").LT.128)
  51. $ THEN
  52. $!
  53. $! The Architecture Is VAX.
  54. $!
  55. $ ARCH := VAX
  56. $!
  57. $! Else...
  58. $!
  59. $ ELSE
  60. $!
  61. $! The Architecture Is Alpha, IA64 or whatever comes in the future.
  62. $!
  63. $ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE")
  64. $ IF (ARCH .EQS. "") THEN ARCH = "UNK"
  65. $!
  66. $! End The Architecture Check.
  67. $!
  68. $ ENDIF
  69. $!
  70. $! Define what programs should be compiled
  71. $!
  72. $ PROGRAMS := OPENSSL
  73. $!
  74. $! Define The CRYPTO Library.
  75. $!
  76. $ CRYPTO_LIB := SYS$DISK:[-.'ARCH'.EXE.CRYPTO]LIBCRYPTO.OLB
  77. $!
  78. $! Define The SSL Library.
  79. $!
  80. $ SSL_LIB := SYS$DISK:[-.'ARCH'.EXE.SSL]LIBSSL.OLB
  81. $!
  82. $! Define The OBJ Directory.
  83. $!
  84. $ OBJ_DIR := SYS$DISK:[-.'ARCH'.OBJ.APPS]
  85. $!
  86. $! Define The EXE Directory.
  87. $!
  88. $ EXE_DIR := SYS$DISK:[-.'ARCH'.EXE.APPS]
  89. $!
  90. $! Check To Make Sure We Have Valid Command Line Parameters.
  91. $!
  92. $ GOSUB CHECK_OPTIONS
  93. $!
  94. $! Initialise logical names and such
  95. $!
  96. $ GOSUB INITIALISE
  97. $!
  98. $! Tell The User What Kind of Machine We Run On.
  99. $!
  100. $ WRITE SYS$OUTPUT "Compiling On A ",ARCH," Machine."
  101. $!
  102. $! Check To See If The OBJ Directory Exists.
  103. $!
  104. $ IF (F$PARSE(OBJ_DIR).EQS."")
  105. $ THEN
  106. $!
  107. $! It Dosen't Exist, So Create It.
  108. $!
  109. $ CREATE/DIRECTORY 'OBJ_DIR'
  110. $!
  111. $! End The OBJ Directory Check.
  112. $!
  113. $ ENDIF
  114. $!
  115. $! Check To See If The EXE Directory Exists.
  116. $!
  117. $ IF (F$PARSE(EXE_DIR).EQS."")
  118. $ THEN
  119. $!
  120. $! It Dosen't Exist, So Create It.
  121. $!
  122. $ CREATE/DIRECTORY 'EXE_DIR'
  123. $!
  124. $! End The EXE Directory Check.
  125. $!
  126. $ ENDIF
  127. $!
  128. $! Check To See If We Have The Proper Libraries.
  129. $!
  130. $ GOSUB LIB_CHECK
  131. $!
  132. $! Check To See If We Have A Linker Option File.
  133. $!
  134. $ GOSUB CHECK_OPT_FILE
  135. $!
  136. $! Define The Application Files.
  137. $! NOTE: Some might think this list ugly. However, it's made this way to
  138. $! reflect the E_OBJ variable in Makefile as closely as possible, thereby
  139. $! making it fairly easy to verify that the lists are the same.
  140. $!
  141. $ LIB_OPENSSL = "VERIFY,ASN1PARS,REQ,DGST,DH,DHPARAM,ENC,PASSWD,GENDH,ERRSTR,"+-
  142. "CA,PKCS7,CRL2P7,CRL,"+-
  143. "RSA,RSAUTL,DSA,DSAPARAM,EC,ECPARAM,"+-
  144. "X509,GENRSA,GENDSA,S_SERVER,S_CLIENT,SPEED,"+-
  145. "S_TIME,APPS,S_CB,S_SOCKET,APP_RAND,VERSION,SESS_ID,"+-
  146. "CIPHERS,NSEQ,PKCS12,PKCS8,SPKAC,SMIME,RAND,ENGINE,"+-
  147. "OCSP,PRIME,CMS"
  148. $ TCPIP_PROGRAMS = ",,"
  149. $ IF COMPILER .EQS. "VAXC" THEN -
  150. TCPIP_PROGRAMS = ",OPENSSL,"
  151. $!
  152. $! Setup exceptional compilations
  153. $!
  154. $ COMPILEWITH_CC2 = ",S_SOCKET,S_SERVER,S_CLIENT,"
  155. $!
  156. $ PHASE := LIB
  157. $!
  158. $ RESTART:
  159. $!
  160. $! Define An App Counter And Set It To "0".
  161. $!
  162. $ APP_COUNTER = 0
  163. $!
  164. $! Top Of The App Loop.
  165. $!
  166. $ NEXT_APP:
  167. $!
  168. $! Make The Application File Name
  169. $!
  170. $ CURRENT_APP = F$EDIT(F$ELEMENT(APP_COUNTER,",",PROGRAMS),"TRIM")
  171. $!
  172. $! Create The Executable File Name.
  173. $!
  174. $ EXE_FILE = EXE_DIR + CURRENT_APP + ".EXE"
  175. $!
  176. $! Check To See If We Are At The End Of The File List.
  177. $!
  178. $ IF (CURRENT_APP.EQS.",")
  179. $ THEN
  180. $ IF (PHASE.EQS."LIB")
  181. $ THEN
  182. $ PHASE := APP
  183. $ GOTO RESTART
  184. $ ELSE
  185. $ GOTO APP_DONE
  186. $ ENDIF
  187. $ ENDIF
  188. $!
  189. $! Increment The Counter.
  190. $!
  191. $ APP_COUNTER = APP_COUNTER + 1
  192. $!
  193. $! Decide if we're building the object files or not.
  194. $!
  195. $ IF (PHASE.EQS."LIB")
  196. $ THEN
  197. $!
  198. $! Define A Library File Counter And Set It To "-1".
  199. $! -1 Means The Application File Name Is To Be Used.
  200. $!
  201. $ LIB_COUNTER = -1
  202. $!
  203. $! Create a .OPT file for the object files
  204. $!
  205. $ OPEN/WRITE OBJECTS 'EXE_DIR''CURRENT_APP'.OPT
  206. $!
  207. $! Top Of The File Loop.
  208. $!
  209. $ NEXT_LIB:
  210. $!
  211. $! O.K, Extract The File Name From The File List.
  212. $!
  213. $ IF LIB_COUNTER .GE. 0
  214. $ THEN
  215. $ FILE_NAME = F$EDIT(F$ELEMENT(LIB_COUNTER,",",LIB_'CURRENT_APP'),"TRIM")
  216. $ ELSE
  217. $ FILE_NAME = CURRENT_APP
  218. $ ENDIF
  219. $!
  220. $! Check To See If We Are At The End Of The File List.
  221. $!
  222. $ IF (FILE_NAME.EQS.",")
  223. $ THEN
  224. $ CLOSE OBJECTS
  225. $ GOTO NEXT_APP
  226. $ ENDIF
  227. $!
  228. $! Increment The Counter.
  229. $!
  230. $ LIB_COUNTER = LIB_COUNTER + 1
  231. $!
  232. $! Create The Source File Name.
  233. $!
  234. $ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME + ".C"
  235. $!
  236. $! Create The Object File Name.
  237. $!
  238. $ OBJECT_FILE = OBJ_DIR + FILE_NAME + ".OBJ"
  239. $ ON WARNING THEN GOTO NEXT_LIB
  240. $!
  241. $! Check To See If The File We Want To Compile Actually Exists.
  242. $!
  243. $ IF (F$SEARCH(SOURCE_FILE).EQS."")
  244. $ THEN
  245. $!
  246. $! Tell The User That The File Dosen't Exist.
  247. $!
  248. $ WRITE SYS$OUTPUT ""
  249. $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist."
  250. $ WRITE SYS$OUTPUT ""
  251. $!
  252. $! Exit The Build.
  253. $!
  254. $ GOTO EXIT
  255. $!
  256. $! End The File Exist Check.
  257. $!
  258. $ ENDIF
  259. $!
  260. $! Tell The User What We Are Building.
  261. $!
  262. $ IF (PHASE.EQS."LIB")
  263. $ THEN
  264. $ WRITE SYS$OUTPUT "Compiling The ",FILE_NAME,".C File."
  265. $ ELSE
  266. $ WRITE SYS$OUTPUT "Building The ",FILE_NAME," Application Program."
  267. $ ENDIF
  268. $!
  269. $! Compile The File.
  270. $!
  271. $ ON ERROR THEN GOTO NEXT_LIB
  272. $ IF COMPILEWITH_CC2 - FILE_NAME .NES. COMPILEWITH_CC2
  273. $ THEN
  274. $ CC2/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
  275. $ ELSE
  276. $ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
  277. $ ENDIF
  278. $ WRITE OBJECTS OBJECT_FILE
  279. $!
  280. $ GOTO NEXT_LIB
  281. $ ENDIF
  282. $!
  283. $! Check if this program works well without a TCPIP library
  284. $!
  285. $ IF TCPIP_LIB .EQS. "" .AND. TCPIP_PROGRAMS - CURRENT_APP .NES. TCPIP_PROGRAMS
  286. $ THEN
  287. $ WRITE SYS$OUTPUT CURRENT_APP," needs a TCP/IP library. Can't link. Skipping..."
  288. $ GOTO NEXT_APP
  289. $ ENDIF
  290. $!
  291. $! Link The Program.
  292. $! Check To See If We Are To Link With A Specific TCP/IP Library.
  293. $!
  294. $ ON WARNING THEN GOTO NEXT_APP
  295. $!
  296. $ IF (TCPIP_LIB.NES."")
  297. $ THEN
  298. $!
  299. $! Don't Link With The RSAREF Routines And TCP/IP Library.
  300. $!
  301. $ LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
  302. 'EXE_DIR''CURRENT_APP'.OPT/OPTION, -
  303. 'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
  304. 'TCPIP_LIB','OPT_FILE'/OPTION
  305. $!
  306. $! Else...
  307. $!
  308. $ ELSE
  309. $!
  310. $! Don't Link With The RSAREF Routines And Link With A TCP/IP Library.
  311. $!
  312. $ LINK/'DEBUGGER'/'TRACEBACK' /EXE='EXE_FILE' -
  313. 'EXE_DIR''CURRENT_APP'.OPT/OPTION, -
  314. 'SSL_LIB'/LIBRARY,'CRYPTO_LIB'/LIBRARY, -
  315. 'OPT_FILE'/OPTION
  316. $!
  317. $! End The TCP/IP Library Check.
  318. $!
  319. $ ENDIF
  320. $!
  321. $! Go Back And Do It Again.
  322. $!
  323. $ GOTO NEXT_APP
  324. $!
  325. $! All Done With This File.
  326. $!
  327. $ APP_DONE:
  328. $ EXIT:
  329. $!
  330. $! All Done, Time To Clean Up And Exit.
  331. $!
  332. $ GOSUB CLEANUP
  333. $ EXIT
  334. $!
  335. $! Check For The Link Option FIle.
  336. $!
  337. $ CHECK_OPT_FILE:
  338. $!
  339. $! Check To See If We Need To Make A VAX C Option File.
  340. $!
  341. $ IF (COMPILER.EQS."VAXC")
  342. $ THEN
  343. $!
  344. $! Check To See If We Already Have A VAX C Linker Option File.
  345. $!
  346. $ IF (F$SEARCH(OPT_FILE).EQS."")
  347. $ THEN
  348. $!
  349. $! We Need A VAX C Linker Option File.
  350. $!
  351. $ CREATE 'OPT_FILE'
  352. $DECK
  353. !
  354. ! Default System Options File To Link Agianst
  355. ! The Sharable VAX C Runtime Library.
  356. !
  357. SYS$SHARE:VAXCRTL.EXE/SHARE
  358. $EOD
  359. $!
  360. $! End The Option File Check.
  361. $!
  362. $ ENDIF
  363. $!
  364. $! End The VAXC Check.
  365. $!
  366. $ ENDIF
  367. $!
  368. $! Check To See If We Need A GNU C Option File.
  369. $!
  370. $ IF (COMPILER.EQS."GNUC")
  371. $ THEN
  372. $!
  373. $! Check To See If We Already Have A GNU C Linker Option File.
  374. $!
  375. $ IF (F$SEARCH(OPT_FILE).EQS."")
  376. $ THEN
  377. $!
  378. $! We Need A GNU C Linker Option File.
  379. $!
  380. $ CREATE 'OPT_FILE'
  381. $DECK
  382. !
  383. ! Default System Options File To Link Agianst
  384. ! The Sharable C Runtime Library.
  385. !
  386. GNU_CC:[000000]GCCLIB/LIBRARY
  387. SYS$SHARE:VAXCRTL/SHARE
  388. $EOD
  389. $!
  390. $! End The Option File Check.
  391. $!
  392. $ ENDIF
  393. $!
  394. $! End The GNU C Check.
  395. $!
  396. $ ENDIF
  397. $!
  398. $! Check To See If We Need A DEC C Option File.
  399. $!
  400. $ IF (COMPILER.EQS."DECC")
  401. $ THEN
  402. $!
  403. $! Check To See If We Already Have A DEC C Linker Option File.
  404. $!
  405. $ IF (F$SEARCH(OPT_FILE).EQS."")
  406. $ THEN
  407. $!
  408. $! Figure Out If We Need An AXP Or A VAX Linker Option File.
  409. $!
  410. $ IF ARCH.EQS."VAX"
  411. $ THEN
  412. $!
  413. $! We Need A DEC C Linker Option File For VAX.
  414. $!
  415. $ CREATE 'OPT_FILE'
  416. $DECK
  417. !
  418. ! Default System Options File To Link Agianst
  419. ! The Sharable DEC C Runtime Library.
  420. !
  421. SYS$SHARE:DECC$SHR.EXE/SHARE
  422. $EOD
  423. $!
  424. $! Else...
  425. $!
  426. $ ELSE
  427. $!
  428. $! Create The non-VAX Linker Option File.
  429. $!
  430. $ CREATE 'OPT_FILE'
  431. $DECK
  432. !
  433. ! Default System Options File For non-VAX To Link Agianst
  434. ! The Sharable C Runtime Library.
  435. !
  436. SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
  437. SYS$SHARE:CMA$OPEN_RTL/SHARE
  438. $EOD
  439. $!
  440. $! End The DEC C Option File Check.
  441. $!
  442. $ ENDIF
  443. $!
  444. $! End The Option File Search.
  445. $!
  446. $ ENDIF
  447. $!
  448. $! End The DEC C Check.
  449. $!
  450. $ ENDIF
  451. $!
  452. $! Tell The User What Linker Option File We Are Using.
  453. $!
  454. $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
  455. $!
  456. $! Time To RETURN.
  457. $!
  458. $ RETURN
  459. $!
  460. $! Check To See If We Have The Appropiate Libraries.
  461. $!
  462. $ LIB_CHECK:
  463. $!
  464. $! Look For The Library LIBCRYPTO.OLB.
  465. $!
  466. $ IF (F$SEARCH(CRYPTO_LIB).EQS."")
  467. $ THEN
  468. $!
  469. $! Tell The User We Can't Find The LIBCRYPTO.OLB Library.
  470. $!
  471. $ WRITE SYS$OUTPUT ""
  472. $ WRITE SYS$OUTPUT "Can't Find The Library ",CRYPTO_LIB,"."
  473. $ WRITE SYS$OUTPUT "We Can't Link Without It."
  474. $ WRITE SYS$OUTPUT ""
  475. $!
  476. $! Since We Can't Link Without It, Exit.
  477. $!
  478. $ EXIT
  479. $!
  480. $! End The Crypto Library Check.
  481. $!
  482. $ ENDIF
  483. $!
  484. $! Look For The Library LIBSSL.OLB.
  485. $!
  486. $ IF (F$SEARCH(SSL_LIB).EQS."")
  487. $ THEN
  488. $!
  489. $! Tell The User We Can't Find The LIBSSL.OLB Library.
  490. $!
  491. $ WRITE SYS$OUTPUT ""
  492. $ WRITE SYS$OUTPUT "Can't Find The Library ",SSL_LIB,"."
  493. $ WRITE SYS$OUTPUT "Some Of The Test Programs Need To Link To It."
  494. $ WRITE SYS$OUTPUT ""
  495. $!
  496. $! Since We Can't Link Without It, Exit.
  497. $!
  498. $ EXIT
  499. $!
  500. $! End The SSL Library Check.
  501. $!
  502. $ ENDIF
  503. $!
  504. $! Time To Return.
  505. $!
  506. $ RETURN
  507. $!
  508. $! Check The User's Options.
  509. $!
  510. $ CHECK_OPTIONS:
  511. $!
  512. $! Check To See If P1 Is Blank.
  513. $!
  514. $ IF (P1.EQS."NODEBUG")
  515. $ THEN
  516. $!
  517. $! P1 Is NODEBUG, So Compile Without Debugger Information.
  518. $!
  519. $ DEBUGGER = "NODEBUG"
  520. $ TRACEBACK = "NOTRACEBACK"
  521. $ GCC_OPTIMIZE = "OPTIMIZE"
  522. $ CC_OPTIMIZE = "OPTIMIZE"
  523. $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
  524. $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
  525. $!
  526. $! Else...
  527. $!
  528. $ ELSE
  529. $!
  530. $! Check To See If We Are To Compile With Debugger Information.
  531. $!
  532. $ IF (P1.EQS."DEBUG")
  533. $ THEN
  534. $!
  535. $! Compile With Debugger Information.
  536. $!
  537. $ DEBUGGER = "DEBUG"
  538. $ TRACEBACK = "TRACEBACK"
  539. $ GCC_OPTIMIZE = "NOOPTIMIZE"
  540. $ CC_OPTIMIZE = "NOOPTIMIZE"
  541. $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
  542. $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
  543. $ ELSE
  544. $!
  545. $! Tell The User Entered An Invalid Option..
  546. $!
  547. $ WRITE SYS$OUTPUT ""
  548. $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
  549. $ WRITE SYS$OUTPUT ""
  550. $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
  551. $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
  552. $ WRITE SYS$OUTPUT ""
  553. $!
  554. $! Time To EXIT.
  555. $!
  556. $ EXIT
  557. $!
  558. $! End The Valid Arguement Check.
  559. $!
  560. $ ENDIF
  561. $!
  562. $! End The P1 Check.
  563. $!
  564. $ ENDIF
  565. $!
  566. $! Check To See If P2 Is Blank.
  567. $!
  568. $ IF (P2.EQS."")
  569. $ THEN
  570. $!
  571. $! O.K., The User Didn't Specify A Compiler, Let's Try To
  572. $! Find Out Which One To Use.
  573. $!
  574. $! Check To See If We Have GNU C.
  575. $!
  576. $ IF (F$TRNLNM("GNU_CC").NES."")
  577. $ THEN
  578. $!
  579. $! Looks Like GNUC, Set To Use GNUC.
  580. $!
  581. $ P2 = "GNUC"
  582. $!
  583. $! Else...
  584. $!
  585. $ ELSE
  586. $!
  587. $! Check To See If We Have VAXC Or DECC.
  588. $!
  589. $ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
  590. $ THEN
  591. $!
  592. $! Looks Like DECC, Set To Use DECC.
  593. $!
  594. $ P2 = "DECC"
  595. $!
  596. $! Else...
  597. $!
  598. $ ELSE
  599. $!
  600. $! Looks Like VAXC, Set To Use VAXC.
  601. $!
  602. $ P2 = "VAXC"
  603. $!
  604. $! End The VAXC Compiler Check.
  605. $!
  606. $ ENDIF
  607. $!
  608. $! End The DECC & VAXC Compiler Check.
  609. $!
  610. $ ENDIF
  611. $!
  612. $! End The Compiler Check.
  613. $!
  614. $ ENDIF
  615. $!
  616. $! Check To See If We Have A Option For P3.
  617. $!
  618. $ IF (P3.EQS."")
  619. $ THEN
  620. $!
  621. $! Find out what socket library we have available
  622. $!
  623. $ IF F$PARSE("SOCKETSHR:") .NES. ""
  624. $ THEN
  625. $!
  626. $! We have SOCKETSHR, and it is my opinion that it's the best to use.
  627. $!
  628. $ P3 = "SOCKETSHR"
  629. $!
  630. $! Tell the user
  631. $!
  632. $ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP"
  633. $!
  634. $! Else, let's look for something else
  635. $!
  636. $ ELSE
  637. $!
  638. $! Like UCX (the reason to do this before Multinet is that the UCX
  639. $! emulation is easier to use...)
  640. $!
  641. $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" -
  642. .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" -
  643. .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. ""
  644. $ THEN
  645. $!
  646. $! Last resort: a UCX or UCX-compatible library
  647. $!
  648. $ P3 = "UCX"
  649. $!
  650. $! Tell the user
  651. $!
  652. $ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP"
  653. $!
  654. $! That was all...
  655. $!
  656. $ ENDIF
  657. $ ENDIF
  658. $ ENDIF
  659. $!
  660. $! Set Up Initial CC Definitions, Possibly With User Ones
  661. $!
  662. $ CCDEFS = "MONOLITH"
  663. $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
  664. $ CCEXTRAFLAGS = ""
  665. $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
  666. $ CCDISABLEWARNINGS = "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR"
  667. $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. "" THEN -
  668. CCDISABLEWARNINGS = CCDISABLEWARNINGS + "," + USER_CCDISABLEWARNINGS
  669. $!
  670. $! Check To See If The User Entered A Valid Paramter.
  671. $!
  672. $ IF (P2.EQS."VAXC").OR.(P2.EQS."DECC").OR.(P2.EQS."GNUC")
  673. $ THEN
  674. $!
  675. $! Check To See If The User Wanted DECC.
  676. $!
  677. $ IF (P2.EQS."DECC")
  678. $ THEN
  679. $!
  680. $! Looks Like DECC, Set To Use DECC.
  681. $!
  682. $ COMPILER = "DECC"
  683. $!
  684. $! Tell The User We Are Using DECC.
  685. $!
  686. $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
  687. $!
  688. $! Use DECC...
  689. $!
  690. $ CC = "CC"
  691. $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
  692. THEN CC = "CC/DECC"
  693. $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/STANDARD=ANSI89" + -
  694. "/NOLIST/PREFIX=ALL" + -
  695. "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS
  696. $!
  697. $! Define The Linker Options File Name.
  698. $!
  699. $ OPT_FILE = "''EXE_DIR'VAX_DECC_OPTIONS.OPT"
  700. $!
  701. $! End DECC Check.
  702. $!
  703. $ ENDIF
  704. $!
  705. $! Check To See If We Are To Use VAXC.
  706. $!
  707. $ IF (P2.EQS."VAXC")
  708. $ THEN
  709. $!
  710. $! Looks Like VAXC, Set To Use VAXC.
  711. $!
  712. $ COMPILER = "VAXC"
  713. $!
  714. $! Tell The User We Are Using VAX C.
  715. $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
  716. $!
  717. $! Compile Using VAXC.
  718. $!
  719. $ CC = "CC"
  720. $ IF ARCH.NES."VAX"
  721. $ THEN
  722. $ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!"
  723. $ EXIT
  724. $ ENDIF
  725. $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
  726. $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
  727. "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS
  728. $ CCDEFS = CCDEFS + ",""VAXC"""
  729. $!
  730. $! Define <sys> As SYS$COMMON:[SYSLIB]
  731. $!
  732. $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
  733. $!
  734. $! Define The Linker Options File Name.
  735. $!
  736. $ OPT_FILE = "''EXE_DIR'VAX_VAXC_OPTIONS.OPT"
  737. $!
  738. $! End VAXC Check
  739. $!
  740. $ ENDIF
  741. $!
  742. $! Check To See If We Are To Use GNU C.
  743. $!
  744. $ IF (P2.EQS."GNUC")
  745. $ THEN
  746. $!
  747. $! Looks Like GNUC, Set To Use GNUC.
  748. $!
  749. $ COMPILER = "GNUC"
  750. $!
  751. $! Tell The User We Are Using GNUC.
  752. $!
  753. $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
  754. $!
  755. $! Use GNU C...
  756. $!
  757. $ IF F$TYPE(GCC) .EQS. "" THEN GCC := GCC
  758. $ CC = GCC+"/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
  759. "/INCLUDE=(SYS$DISK:[-],SYS$DISK:[-.CRYPTO])" + CCEXTRAFLAGS
  760. $!
  761. $! Define The Linker Options File Name.
  762. $!
  763. $ OPT_FILE = "''EXE_DIR'VAX_GNUC_OPTIONS.OPT"
  764. $!
  765. $! End The GNU C Check.
  766. $!
  767. $ ENDIF
  768. $!
  769. $! Set up default defines
  770. $!
  771. $ CCDEFS = """FLAT_INC=1""," + CCDEFS
  772. $!
  773. $! Else The User Entered An Invalid Arguement.
  774. $!
  775. $ ELSE
  776. $!
  777. $! Tell The User We Don't Know What They Want.
  778. $!
  779. $ WRITE SYS$OUTPUT ""
  780. $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
  781. $ WRITE SYS$OUTPUT ""
  782. $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
  783. $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
  784. $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
  785. $ WRITE SYS$OUTPUT ""
  786. $!
  787. $! Time To EXIT.
  788. $!
  789. $ EXIT
  790. $ ENDIF
  791. $!
  792. $! Time to check the contents, and to make sure we get the correct library.
  793. $!
  794. $ IF P3.EQS."SOCKETSHR" .OR. P3.EQS."MULTINET" .OR. P3.EQS."UCX" -
  795. .OR. P3.EQS."TCPIP" .OR. P3.EQS."NONE"
  796. $ THEN
  797. $!
  798. $! Check to see if SOCKETSHR was chosen
  799. $!
  800. $ IF P3.EQS."SOCKETSHR"
  801. $ THEN
  802. $!
  803. $! Set the library to use SOCKETSHR
  804. $!
  805. $ TCPIP_LIB = "SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT/OPT"
  806. $!
  807. $! Done with SOCKETSHR
  808. $!
  809. $ ENDIF
  810. $!
  811. $! Check to see if MULTINET was chosen
  812. $!
  813. $ IF P3.EQS."MULTINET"
  814. $ THEN
  815. $!
  816. $! Set the library to use UCX emulation.
  817. $!
  818. $ P3 = "UCX"
  819. $!
  820. $! Done with MULTINET
  821. $!
  822. $ ENDIF
  823. $!
  824. $! Check to see if UCX was chosen
  825. $!
  826. $ IF P3.EQS."UCX"
  827. $ THEN
  828. $!
  829. $! Set the library to use UCX.
  830. $!
  831. $ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT/OPT"
  832. $ IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
  833. $ THEN
  834. $ TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT/OPT"
  835. $ ELSE
  836. $ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
  837. TCPIP_LIB = "SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT/OPT"
  838. $ ENDIF
  839. $!
  840. $! Done with UCX
  841. $!
  842. $ ENDIF
  843. $!
  844. $! Check to see if TCPIP (post UCX) was chosen
  845. $!
  846. $ IF P3.EQS."TCPIP"
  847. $ THEN
  848. $!
  849. $! Set the library to use TCPIP.
  850. $!
  851. $ TCPIP_LIB = "SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT/OPT"
  852. $!
  853. $! Done with TCPIP
  854. $!
  855. $ ENDIF
  856. $!
  857. $! Check to see if NONE was chosen
  858. $!
  859. $ IF P3.EQS."NONE"
  860. $ THEN
  861. $!
  862. $! Do not use TCPIP.
  863. $!
  864. $ TCPIP_LIB = ""
  865. $!
  866. $! Done with TCPIP
  867. $!
  868. $ ENDIF
  869. $!
  870. $! Add TCP/IP type to CC definitions.
  871. $!
  872. $ CCDEFS = CCDEFS + ",TCPIP_TYPE_''P3'"
  873. $!
  874. $! Print info
  875. $!
  876. $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB
  877. $!
  878. $! Else The User Entered An Invalid Arguement.
  879. $!
  880. $ ELSE
  881. $!
  882. $! Tell The User We Don't Know What They Want.
  883. $!
  884. $ WRITE SYS$OUTPUT ""
  885. $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
  886. $ WRITE SYS$OUTPUT ""
  887. $ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library."
  888. $ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library."
  889. $ WRITE SYS$OUTPUT " TCPIP : To link with TCPIP (post UCX) TCP/IP library."
  890. $ WRITE SYS$OUTPUT ""
  891. $!
  892. $! Time To EXIT.
  893. $!
  894. $ EXIT
  895. $!
  896. $! Done with TCP/IP libraries
  897. $!
  898. $ ENDIF
  899. $!
  900. $! Finish up the definition of CC.
  901. $!
  902. $ IF COMPILER .EQS. "DECC"
  903. $ THEN
  904. $ IF CCDISABLEWARNINGS .NES. ""
  905. $ THEN
  906. $ CCDISABLEWARNINGS = "/WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
  907. $ ENDIF
  908. $ ELSE
  909. $ CCDISABLEWARNINGS = ""
  910. $ ENDIF
  911. $ CC2 = CC + "/DEFINE=(" + CCDEFS + ",_POSIX_C_SOURCE)" + CCDISABLEWARNINGS
  912. $ CC = CC + "/DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
  913. $!
  914. $! Show user the result
  915. $!
  916. $ WRITE/SYMBOL SYS$OUTPUT "Main Compiling Command: ",CC
  917. $!
  918. $! Special Threads For OpenVMS v7.1 Or Later
  919. $!
  920. $! Written By: Richard Levitte
  921. $! richard@levitte.org
  922. $!
  923. $!
  924. $! Check To See If We Have A Option For P4.
  925. $!
  926. $ IF (P4.EQS."")
  927. $ THEN
  928. $!
  929. $! Get The Version Of VMS We Are Using.
  930. $!
  931. $ ISSEVEN :=
  932. $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
  933. $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
  934. $!
  935. $! Check To See If The VMS Version Is v7.1 Or Later.
  936. $!
  937. $ IF (TMP.GE.71)
  938. $ THEN
  939. $!
  940. $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
  941. $!
  942. $ ISSEVEN := ,PTHREAD_USE_D4
  943. $!
  944. $! End The VMS Version Check.
  945. $!
  946. $ ENDIF
  947. $!
  948. $! End The P4 Check.
  949. $!
  950. $ ENDIF
  951. $!
  952. $! Check if the user wanted to compile just a subset of all the programs.
  953. $!
  954. $ IF P5 .NES. ""
  955. $ THEN
  956. $ PROGRAMS = P5
  957. $ ENDIF
  958. $!
  959. $! Time To RETURN...
  960. $!
  961. $ RETURN
  962. $!
  963. $ INITIALISE:
  964. $!
  965. $! Save old value of the logical name OPENSSL
  966. $!
  967. $ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE")
  968. $!
  969. $! Save directory information
  970. $!
  971. $ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
  972. $ __HERE = F$EDIT(__HERE,"UPCASE")
  973. $ __TOP = __HERE - "APPS]"
  974. $ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
  975. $!
  976. $! Set up the logical name OPENSSL to point at the include directory
  977. $!
  978. $ DEFINE OPENSSL/NOLOG '__INCLUDE'
  979. $!
  980. $! Done
  981. $!
  982. $ RETURN
  983. $!
  984. $ CLEANUP:
  985. $!
  986. $! Restore the logical name OPENSSL if it had a value
  987. $!
  988. $ IF __SAVE_OPENSSL .EQS. ""
  989. $ THEN
  990. $ DEASSIGN OPENSSL
  991. $ ELSE
  992. $ DEFINE/NOLOG OPENSSL '__SAVE_OPENSSL'
  993. $ ENDIF
  994. $!
  995. $! Done
  996. $!
  997. $ RETURN