make_vms.com
Upload User: shengde
Upload Date: 2021-02-21
Package Size: 638k
Code Size: 23k
Development Platform:

Visual C++

  1. $! make libz under VMS written by
  2. $! Martin P.J. Zinser
  3. $!
  4. $! In case of problems with the install you might contact me at
  5. $! zinser@zinser.no-ip.info(preferred) or
  6. $! zinser@sysdev.deutsche-boerse.com (work)
  7. $!
  8. $! Make procedure history for Zlib
  9. $!
  10. $!------------------------------------------------------------------------------
  11. $! Version history
  12. $! 0.01 20060120 First version to receive a number
  13. $! 0.02 20061008 Adapt to new Makefile.in
  14. $! 0.03 20091224 Add support for large file check
  15. $! 0.04 20100110 Add new gzclose, gzlib, gzread, gzwrite
  16. $! 0.05 20100221 Exchange zlibdefs.h by zconf.h.in
  17. $!
  18. $ on error then goto err_exit
  19. $ set proc/parse=ext
  20. $!
  21. $ true  = 1
  22. $ false = 0
  23. $ tmpnam = "temp_" + f$getjpi("","pid")
  24. $ tt = tmpnam + ".txt"
  25. $ tc = tmpnam + ".c"
  26. $ th = tmpnam + ".h"
  27. $ define/nolog tconfig 'th'
  28. $ its_decc = false
  29. $ its_vaxc = false
  30. $ its_gnuc = false
  31. $ s_case   = False
  32. $!
  33. $! Setup variables holding "config" information
  34. $!
  35. $ Make    = ""
  36. $ name     = "Zlib"
  37. $ version  = "?.?.?"
  38. $ v_string = "ZLIB_VERSION"
  39. $ v_file   = "zlib.h"
  40. $ ccopt   = ""
  41. $ lopts   = ""
  42. $ dnsrl   = ""
  43. $ aconf_in_file = "zconf.h.in#zconf.h_in"
  44. $ conf_check_string = ""
  45. $ linkonly = false
  46. $ optfile  = name + ".opt"
  47. $ libdefs  = ""
  48. $ axp      = f$getsyi("HW_MODEL").ge.1024 .and. f$getsyi("HW_MODEL").lt.4096
  49. $!
  50. $ whoami = f$parse(f$enviornment("Procedure"),,,,"NO_CONCEAL")
  51. $ mydef  = F$parse(whoami,,,"DEVICE")
  52. $ mydir  = f$parse(whoami,,,"DIRECTORY") - "]["
  53. $ myproc = f$parse(whoami,,,"Name") + f$parse(whoami,,,"type")
  54. $!
  55. $! Check for MMK/MMS
  56. $!
  57. $ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"
  58. $ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK"
  59. $!
  60. $!
  61. $ gosub find_version
  62. $!
  63. $  open/write topt tmp.opt
  64. $  open/write optf 'optfile'
  65. $!
  66. $ gosub check_opts
  67. $!
  68. $! Look for the compiler used
  69. $!
  70. $ gosub check_compiler
  71. $ close topt
  72. $!
  73. $ if its_decc
  74. $ then
  75. $   ccopt = "/prefix=all" + ccopt
  76. $   if f$trnlnm("SYS") .eqs. ""
  77. $   then
  78. $     if axp
  79. $     then
  80. $       define sys sys$library:
  81. $     else
  82. $       ccopt = "/decc" + ccopt
  83. $       define sys decc$library_include:
  84. $     endif
  85. $   endif
  86. $ endif
  87. $ if its_vaxc .or. its_gnuc
  88. $ then
  89. $    if f$trnlnm("SYS").eqs."" then define sys sys$library:
  90. $ endif
  91. $!
  92. $! Build a fake configure input header
  93. $!
  94. $ open/write conf_hin config.hin
  95. $ write conf_hin "#undef _LARGEFILE64_SOURCE"
  96. $ close conf_hin
  97. $!
  98. $!
  99. $ i = 0
  100. $FIND_ACONF:
  101. $ fname = f$element(i,"#",aconf_in_file)
  102. $ if fname .eqs. "#" then goto AMISS_ERR
  103. $ if f$search(fname) .eqs. ""
  104. $ then
  105. $   i = i + 1
  106. $   goto find_aconf
  107. $ endif
  108. $ open/read/err=aconf_err aconf_in 'fname'
  109. $ open/write aconf zconf.h
  110. $ACONF_LOOP:
  111. $ read/end_of_file=aconf_exit aconf_in line
  112. $ work = f$edit(line, "compress,trim")
  113. $ if f$extract(0,6,work) .nes. "#undef"
  114. $ then
  115. $   if f$extract(0,12,work) .nes. "#cmakedefine"
  116. $   then
  117. $       write aconf line
  118. $   endif
  119. $ else
  120. $   cdef = f$element(1," ",work)
  121. $   gosub check_config
  122. $ endif
  123. $ goto aconf_loop
  124. $ACONF_EXIT:
  125. $ write aconf "#define VMS 1"
  126. $ write aconf "#include <unistd.h>"
  127. $ write aconf "#include <unixio.h>"
  128. $ write aconf "#ifdef _LARGEFILE"
  129. $ write aconf "#define off64_t __off64_t"
  130. $ write aconf "#define fopen64 fopen"
  131. $ write aconf "#define fseeko64 fseeko"
  132. $ write aconf "#define lseek64 lseek"
  133. $ write aconf "#define ftello64 ftell"
  134. $ write aconf "#endif"
  135. $ close aconf_in
  136. $ close aconf
  137. $ if f$search("''th'") .nes. "" then delete 'th';*
  138. $! Build the thing plain or with mms
  139. $!
  140. $ write sys$output "Compiling Zlib sources ..."
  141. $ if make.eqs.""
  142. $  then
  143. $   dele example.obj;*,minigzip.obj;*
  144. $   CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" -
  145.                 adler32.c zlib.h zconf.h
  146. $   CALL MAKE compress.OBJ "CC ''CCOPT' compress" -
  147.                 compress.c zlib.h zconf.h
  148. $   CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" -
  149.                 crc32.c zlib.h zconf.h
  150. $   CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" -
  151.                 deflate.c deflate.h zutil.h zlib.h zconf.h
  152. $   CALL MAKE gzclose.OBJ "CC ''CCOPT' gzclose" -
  153.                 gzclose.c zutil.h zlib.h zconf.h
  154. $   CALL MAKE gzlib.OBJ "CC ''CCOPT' gzlib" -
  155.                 gzlib.c zutil.h zlib.h zconf.h
  156. $   CALL MAKE gzread.OBJ "CC ''CCOPT' gzread" -
  157.                 gzread.c zutil.h zlib.h zconf.h
  158. $   CALL MAKE gzwrite.OBJ "CC ''CCOPT' gzwrite" -
  159.                 gzwrite.c zutil.h zlib.h zconf.h
  160. $   CALL MAKE infback.OBJ "CC ''CCOPT' infback" -
  161.                 infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
  162. $   CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" -
  163.                 inffast.c zutil.h zlib.h zconf.h inffast.h
  164. $   CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" -
  165.                 inflate.c zutil.h zlib.h zconf.h infblock.h
  166. $   CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" -
  167.                 inftrees.c zutil.h zlib.h zconf.h inftrees.h
  168. $   CALL MAKE trees.OBJ "CC ''CCOPT' trees" -
  169.                 trees.c deflate.h zutil.h zlib.h zconf.h
  170. $   CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" -
  171.                 uncompr.c zlib.h zconf.h
  172. $   CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -
  173.                 zutil.c zutil.h zlib.h zconf.h
  174. $   write sys$output "Building Zlib ..."
  175. $   CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ
  176. $   write sys$output "Building example..."
  177. $   CALL MAKE example.OBJ "CC ''CCOPT' example" -
  178.                 example.c zlib.h zconf.h
  179. $   call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb
  180. $   if f$search("x11vms:xvmsutils.olb") .nes. ""
  181. $   then
  182. $     write sys$output "Building minigzip..."
  183. $     CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" -
  184.                 minigzip.c zlib.h zconf.h
  185. $     call make minigzip.exe -
  186.                 "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" -
  187.                 minigzip.obj libz.olb
  188. $   endif
  189. $  else
  190. $   gosub crea_mms
  191. $   write sys$output "Make ''name' ''version' with ''Make' "
  192. $   'make'
  193. $  endif
  194. $!
  195. $! Alpha gets a shareable image
  196. $!
  197. $ If axp
  198. $ Then
  199. $   gosub crea_olist
  200. $   write sys$output "Creating libzshr.exe"
  201. $   call anal_obj_axp modules.opt _link.opt
  202. $   if s_case
  203. $   then
  204. $      open/append optf modules.opt
  205. $      write optf "case_sensitive=YES"
  206. $      close optf
  207. $   endif
  208. $   LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,_link.opt/opt
  209. $ endif
  210. $ write sys$output "Zlib build completed"
  211. $ exit
  212. $CC_ERR:
  213. $ write sys$output "C compiler required to build ''name'"
  214. $ goto err_exit
  215. $ERR_EXIT:
  216. $ set message/facil/ident/sever/text
  217. $ close/nolog optf
  218. $ close/nolog topt
  219. $ close/nolog conf_hin
  220. $ close/nolog aconf_in
  221. $ close/nolog aconf
  222. $ close/nolog out
  223. $ close/nolog min
  224. $ close/nolog mod
  225. $ close/nolog h_in
  226. $ write sys$output "Exiting..."
  227. $ exit 2
  228. $!
  229. $!
  230. $MAKE: SUBROUTINE   !SUBROUTINE TO CHECK DEPENDENCIES
  231. $ V = 'F$Verify(0)
  232. $! P1 = What we are trying to make
  233. $! P2 = Command to make it
  234. $! P3 - P8  What it depends on
  235. $
  236. $ If F$Search(P1) .Eqs. "" Then Goto Makeit
  237. $ Time = F$CvTime(F$File(P1,"RDT"))
  238. $arg=3
  239. $Loop:
  240. $       Argument = P'arg
  241. $       If Argument .Eqs. "" Then Goto Exit
  242. $       El=0
  243. $Loop2:
  244. $       File = F$Element(El," ",Argument)
  245. $       If File .Eqs. " " Then Goto Endl
  246. $       AFile = ""
  247. $Loop3:
  248. $       OFile = AFile
  249. $       AFile = F$Search(File)
  250. $       If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
  251. $       If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
  252. $       Goto Loop3
  253. $NextEL:
  254. $       El = El + 1
  255. $       Goto Loop2
  256. $EndL:
  257. $ arg=arg+1
  258. $ If arg .Le. 8 Then Goto Loop
  259. $ Goto Exit
  260. $
  261. $Makeit:
  262. $ VV=F$VERIFY(0)
  263. $ write sys$output P2
  264. $ 'P2
  265. $ VV='F$Verify(VV)
  266. $Exit:
  267. $ If V Then Set Verify
  268. $ENDSUBROUTINE
  269. $!------------------------------------------------------------------------------
  270. $!
  271. $! Check command line options and set symbols accordingly
  272. $!
  273. $!------------------------------------------------------------------------------
  274. $! Version history
  275. $! 0.01 20041206 First version to receive a number
  276. $! 0.02 20060126 Add new "HELP" target
  277. $ CHECK_OPTS:
  278. $ i = 1
  279. $ OPT_LOOP:
  280. $ if i .lt. 9
  281. $ then
  282. $   cparm = f$edit(p'i',"upcase")
  283. $!
  284. $! Check if parameter actually contains something
  285. $!
  286. $   if f$edit(cparm,"trim") .nes. ""
  287. $   then
  288. $     if cparm .eqs. "DEBUG"
  289. $     then
  290. $       ccopt = ccopt + "/noopt/deb"
  291. $       lopts = lopts + "/deb"
  292. $     endif
  293. $     if f$locate("CCOPT=",cparm) .lt. f$length(cparm)
  294. $     then
  295. $       start = f$locate("=",cparm) + 1
  296. $       len   = f$length(cparm) - start
  297. $       ccopt = ccopt + f$extract(start,len,cparm)
  298. $       if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) -
  299.           then s_case = true
  300. $     endif
  301. $     if cparm .eqs. "LINK" then linkonly = true
  302. $     if f$locate("LOPTS=",cparm) .lt. f$length(cparm)
  303. $     then
  304. $       start = f$locate("=",cparm) + 1
  305. $       len   = f$length(cparm) - start
  306. $       lopts = lopts + f$extract(start,len,cparm)
  307. $     endif
  308. $     if f$locate("CC=",cparm) .lt. f$length(cparm)
  309. $     then
  310. $       start  = f$locate("=",cparm) + 1
  311. $       len    = f$length(cparm) - start
  312. $       cc_com = f$extract(start,len,cparm)
  313.         if (cc_com .nes. "DECC") .and. -
  314.            (cc_com .nes. "VAXC") .and. -
  315.            (cc_com .nes. "GNUC")
  316. $       then
  317. $         write sys$output "Unsupported compiler choice ''cc_com' ignored"
  318. $         write sys$output "Use DECC, VAXC, or GNUC instead"
  319. $       else
  320. $         if cc_com .eqs. "DECC" then its_decc = true
  321. $         if cc_com .eqs. "VAXC" then its_vaxc = true
  322. $         if cc_com .eqs. "GNUC" then its_gnuc = true
  323. $       endif
  324. $     endif
  325. $     if f$locate("MAKE=",cparm) .lt. f$length(cparm)
  326. $     then
  327. $       start  = f$locate("=",cparm) + 1
  328. $       len    = f$length(cparm) - start
  329. $       mmks = f$extract(start,len,cparm)
  330. $       if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS")
  331. $       then
  332. $         make = mmks
  333. $       else
  334. $         write sys$output "Unsupported make choice ''mmks' ignored"
  335. $         write sys$output "Use MMK or MMS instead"
  336. $       endif
  337. $     endif
  338. $     if cparm .eqs. "HELP" then gosub bhelp
  339. $   endif
  340. $   i = i + 1
  341. $   goto opt_loop
  342. $ endif
  343. $ return
  344. $!------------------------------------------------------------------------------
  345. $!
  346. $! Look for the compiler used
  347. $!
  348. $! Version history
  349. $! 0.01 20040223 First version to receive a number
  350. $! 0.02 20040229 Save/set value of decc$no_rooted_search_lists
  351. $! 0.03 20060202 Extend handling of GNU C
  352. $! 0.04 20090402 Compaq -> hp
  353. $CHECK_COMPILER:
  354. $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
  355. $ then
  356. $   its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "")
  357. $   its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "")
  358. $   its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "")
  359. $ endif
  360. $!
  361. $! Exit if no compiler available
  362. $!
  363. $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
  364. $ then goto CC_ERR
  365. $ else
  366. $   if its_decc
  367. $   then
  368. $     write sys$output "CC compiler check ... hp C"
  369. $     if f$trnlnm("decc$no_rooted_search_lists") .nes. ""
  370. $     then
  371. $       dnrsl = f$trnlnm("decc$no_rooted_search_lists")
  372. $     endif
  373. $     define/nolog decc$no_rooted_search_lists 1
  374. $   else
  375. $     if its_vaxc then write sys$output "CC compiler check ... VAX C"
  376. $     if its_gnuc
  377. $     then
  378. $         write sys$output "CC compiler check ... GNU C"
  379. $         if f$trnlnm(topt) then write topt "gnu_cc:[000000]gcclib.olb/lib"
  380. $         if f$trnlnm(optf) then write optf "gnu_cc:[000000]gcclib.olb/lib"
  381. $         cc = "gcc"
  382. $     endif
  383. $     if f$trnlnm(topt) then write topt "sys$share:vaxcrtl.exe/share"
  384. $     if f$trnlnm(optf) then write optf "sys$share:vaxcrtl.exe/share"
  385. $   endif
  386. $ endif
  387. $ return
  388. $!------------------------------------------------------------------------------
  389. $!
  390. $! If MMS/MMK are available dump out the descrip.mms if required
  391. $!
  392. $CREA_MMS:
  393. $ write sys$output "Creating descrip.mms..."
  394. $ create descrip.mms
  395. $ open/append out descrip.mms
  396. $ copy sys$input: out
  397. $ deck
  398. # descrip.mms: MMS description file for building zlib on VMS
  399. # written by Martin P.J. Zinser
  400. # <zinser@zinser.no-ip.info or zinser@sysdev.deutsche-boerse.com>
  401. OBJS = adler32.obj, compress.obj, crc32.obj, gzclose.obj, gzlib.obj
  402.        gzread.obj, gzwrite.obj, uncompr.obj, infback.obj
  403.        deflate.obj, trees.obj, zutil.obj, inflate.obj, 
  404.        inftrees.obj, inffast.obj
  405. $ eod
  406. $ write out "CFLAGS=", ccopt
  407. $ write out "LOPTS=", lopts
  408. $ copy sys$input: out
  409. $ deck
  410. all : example.exe minigzip.exe libz.olb
  411.         @ write sys$output " Example applications available"
  412. libz.olb : libz.olb($(OBJS))
  413. @ write sys$output " libz available"
  414. example.exe : example.obj libz.olb
  415.               link $(LOPTS) example,libz.olb/lib
  416. minigzip.exe : minigzip.obj libz.olb
  417.               link $(LOPTS) minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib
  418. clean :
  419. delete *.obj;*,libz.olb;*,*.opt;*,*.exe;*
  420. # Other dependencies.
  421. adler32.obj  : adler32.c zutil.h zlib.h zconf.h
  422. compress.obj : compress.c zlib.h zconf.h
  423. crc32.obj    : crc32.c zutil.h zlib.h zconf.h
  424. deflate.obj  : deflate.c deflate.h zutil.h zlib.h zconf.h
  425. example.obj  : example.c zlib.h zconf.h
  426. gzclose.obj  : gzclose.c zutil.h zlib.h zconf.h
  427. gzlib.obj    : gzlib.c zutil.h zlib.h zconf.h
  428. gzread.obj   : gzread.c zutil.h zlib.h zconf.h
  429. gzwrite.obj  : gzwrite.c zutil.h zlib.h zconf.h
  430. inffast.obj  : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h
  431. inflate.obj  : inflate.c zutil.h zlib.h zconf.h
  432. inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h
  433. minigzip.obj : minigzip.c zlib.h zconf.h
  434. trees.obj    : trees.c deflate.h zutil.h zlib.h zconf.h
  435. uncompr.obj  : uncompr.c zlib.h zconf.h
  436. zutil.obj    : zutil.c zutil.h zlib.h zconf.h
  437. infback.obj  : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
  438. $ eod
  439. $ close out
  440. $ return
  441. $!------------------------------------------------------------------------------
  442. $!
  443. $! Read list of core library sources from makefile.in and create options
  444. $! needed to build shareable image
  445. $!
  446. $CREA_OLIST:
  447. $ open/read min makefile.in
  448. $ open/write mod modules.opt
  449. $ src_check = "OBJC ="
  450. $MRLOOP:
  451. $ read/end=mrdone min rec
  452. $ if (f$extract(0,6,rec) .nes. src_check) then goto mrloop
  453. $ rec = rec - src_check
  454. $ gosub extra_filnam
  455. $ if (f$element(1,"",rec) .eqs. "") then goto mrdone
  456. $MRSLOOP:
  457. $ read/end=mrdone min rec
  458. $ gosub extra_filnam
  459. $ if (f$element(1,"",rec) .nes. "") then goto mrsloop
  460. $MRDONE:
  461. $ close min
  462. $ close mod
  463. $ return
  464. $!------------------------------------------------------------------------------
  465. $!
  466. $! Take record extracted in crea_olist and split it into single filenames
  467. $!
  468. $EXTRA_FILNAM:
  469. $ myrec = f$edit(rec - "", "trim,compress")
  470. $ i = 0
  471. $FELOOP:
  472. $ srcfil = f$element(i," ", myrec)
  473. $ if (srcfil .nes. " ")
  474. $ then
  475. $   write mod f$parse(srcfil,,,"NAME"), ".obj"
  476. $   i = i + 1
  477. $   goto feloop
  478. $ endif
  479. $ return
  480. $!------------------------------------------------------------------------------
  481. $!
  482. $! Find current Zlib version number
  483. $!
  484. $FIND_VERSION:
  485. $ open/read h_in 'v_file'
  486. $hloop:
  487. $ read/end=hdone h_in rec
  488. $ rec = f$edit(rec,"TRIM")
  489. $ if (f$extract(0,1,rec) .nes. "#") then goto hloop
  490. $ rec = f$edit(rec - "#", "TRIM")
  491. $ if f$element(0," ",rec) .nes. "define" then goto hloop
  492. $ if f$element(1," ",rec) .eqs. v_string
  493. $ then
  494. $   version = 'f$element(2," ",rec)'
  495. $   goto hdone
  496. $ endif
  497. $ goto hloop
  498. $hdone:
  499. $ close h_in
  500. $ return
  501. $!------------------------------------------------------------------------------
  502. $!
  503. $CHECK_CONFIG:
  504. $!
  505. $ in_ldef = f$locate(cdef,libdefs)
  506. $ if (in_ldef .lt. f$length(libdefs))
  507. $ then
  508. $   write aconf "#define ''cdef' 1"
  509. $   libdefs = f$extract(0,in_ldef,libdefs) + -
  510.               f$extract(in_ldef + f$length(cdef) + 1, -
  511.                         f$length(libdefs) - in_ldef - f$length(cdef) - 1, -
  512.                         libdefs)
  513. $ else
  514. $   if (f$type('cdef') .eqs. "INTEGER")
  515. $   then
  516. $     write aconf "#define ''cdef' ", 'cdef'
  517. $   else
  518. $     if (f$type('cdef') .eqs. "STRING")
  519. $     then
  520. $       write aconf "#define ''cdef' ", """", '''cdef'', """"
  521. $     else
  522. $       gosub check_cc_def
  523. $     endif
  524. $   endif
  525. $ endif
  526. $ return
  527. $!------------------------------------------------------------------------------
  528. $!
  529. $! Check if this is a define relating to the properties of the C/C++
  530. $! compiler
  531. $!
  532. $ CHECK_CC_DEF:
  533. $ if (cdef .eqs. "_LARGEFILE64_SOURCE")
  534. $ then
  535. $   copy sys$input: 'tc'
  536. $   deck
  537. #include "tconfig"
  538. #define _LARGEFILE
  539. #include <stdio.h>
  540. int main(){
  541. FILE *fp;
  542.   fp = fopen("temp.txt","r");
  543.   fseeko(fp,1,SEEK_SET);
  544.   fclose(fp);
  545. }
  546. $   eod
  547. $   test_inv = false
  548. $   comm_h = false
  549. $   gosub cc_prop_check
  550. $   return
  551. $ endif
  552. $ write aconf "/* ", line, " */"
  553. $ return
  554. $!------------------------------------------------------------------------------
  555. $!
  556. $! Check for properties of C/C++ compiler
  557. $!
  558. $! Version history
  559. $! 0.01 20031020 First version to receive a number
  560. $! 0.02 20031022 Added logic for defines with value
  561. $! 0.03 20040309 Make sure local config file gets not deleted
  562. $! 0.04 20041230 Also write include for configure run
  563. $! 0.05 20050103 Add processing of "comment defines"
  564. $CC_PROP_CHECK:
  565. $ cc_prop = true
  566. $ is_need = false
  567. $ is_need = (f$extract(0,4,cdef) .eqs. "NEED") .or. (test_inv .eq. true)
  568. $ if f$search(th) .eqs. "" then create 'th'
  569. $ set message/nofac/noident/nosever/notext
  570. $ on error then continue
  571. $ cc 'tmpnam'
  572. $ if .not. ($status)  then cc_prop = false
  573. $ on error then continue
  574. $! The headers might lie about the capabilities of the RTL
  575. $ link 'tmpnam',tmp.opt/opt
  576. $ if .not. ($status)  then cc_prop = false
  577. $ set message/fac/ident/sever/text
  578. $ on error then goto err_exit
  579. $ delete/nolog 'tmpnam'.*;*/exclude='th'
  580. $ if (cc_prop .and. .not. is_need) .or. -
  581.      (.not. cc_prop .and. is_need)
  582. $ then
  583. $   write sys$output "Checking for ''cdef'... yes"
  584. $   if f$type('cdef_val'_yes) .nes. ""
  585. $   then
  586. $     if f$type('cdef_val'_yes) .eqs. "INTEGER" -
  587.          then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_yes)
  588. $     if f$type('cdef_val'_yes) .eqs. "STRING" -
  589.          then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_yes)
  590. $   else
  591. $     call write_config f$fao("#define !AS 1",cdef)
  592. $   endif
  593. $   if (cdef .eqs. "HAVE_FSEEKO") .or. (cdef .eqs. "_LARGE_FILES") .or. -
  594.        (cdef .eqs. "_LARGEFILE64_SOURCE") then -
  595.       call write_config f$string("#define _LARGEFILE 1")
  596. $ else
  597. $   write sys$output "Checking for ''cdef'... no"
  598. $   if (comm_h)
  599. $   then
  600.       call write_config f$fao("/* !AS */",line)
  601. $   else
  602. $     if f$type('cdef_val'_no) .nes. ""
  603. $     then
  604. $       if f$type('cdef_val'_no) .eqs. "INTEGER" -
  605.            then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_no)
  606. $       if f$type('cdef_val'_no) .eqs. "STRING" -
  607.            then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_no)
  608. $     else
  609. $       call write_config f$fao("#undef !AS",cdef)
  610. $     endif
  611. $   endif
  612. $ endif
  613. $ return
  614. $!------------------------------------------------------------------------------
  615. $!
  616. $! Check for properties of C/C++ compiler with multiple result values
  617. $!
  618. $! Version history
  619. $! 0.01 20040127 First version
  620. $! 0.02 20050103 Reconcile changes from cc_prop up to version 0.05
  621. $CC_MPROP_CHECK:
  622. $ cc_prop = true
  623. $ i    = 1
  624. $ idel = 1
  625. $ MT_LOOP:
  626. $ if f$type(result_'i') .eqs. "STRING"
  627. $ then
  628. $   set message/nofac/noident/nosever/notext
  629. $   on error then continue
  630. $   cc 'tmpnam'_'i'
  631. $   if .not. ($status)  then cc_prop = false
  632. $   on error then continue
  633. $! The headers might lie about the capabilities of the RTL
  634. $   link 'tmpnam'_'i',tmp.opt/opt
  635. $   if .not. ($status)  then cc_prop = false
  636. $   set message/fac/ident/sever/text
  637. $   on error then goto err_exit
  638. $   delete/nolog 'tmpnam'_'i'.*;*
  639. $   if (cc_prop)
  640. $   then
  641. $     write sys$output "Checking for ''cdef'... ", mdef_'i'
  642. $     if f$type(mdef_'i') .eqs. "INTEGER" -
  643.          then call write_config f$fao("#define !AS !UL",cdef,mdef_'i')
  644. $     if f$type('cdef_val'_yes) .eqs. "STRING" -
  645.          then call write_config f$fao("#define !AS !AS",cdef,mdef_'i')
  646. $     goto msym_clean
  647. $   else
  648. $     i = i + 1
  649. $     goto mt_loop
  650. $   endif
  651. $ endif
  652. $ write sys$output "Checking for ''cdef'... no"
  653. $ call write_config f$fao("#undef !AS",cdef)
  654. $ MSYM_CLEAN:
  655. $ if (idel .le. msym_max)
  656. $ then
  657. $   delete/sym mdef_'idel'
  658. $   idel = idel + 1
  659. $   goto msym_clean
  660. $ endif
  661. $ return
  662. $!------------------------------------------------------------------------------
  663. $!
  664. $! Analyze Object files for OpenVMS AXP to extract Procedure and Data
  665. $! information to build a symbol vector for a shareable image
  666. $! All the "brains" of this logic was suggested by Hartmut Becker
  667. $! (Hartmut.Becker@compaq.com). All the bugs were introduced by me
  668. $! (zinser@zinser.no-ip.info), so if you do have problem reports please do not
  669. $! bother Hartmut/HP, but get in touch with me
  670. $!
  671. $! Version history
  672. $! 0.01 20040406 Skip over shareable images in option file
  673. $! 0.02 20041109 Fix option file for shareable images with case_sensitive=YES
  674. $! 0.03 20050107 Skip over Identification labels in option file
  675. $! 0.04 20060117 Add uppercase alias to code compiled with /name=as_is
  676. $!
  677. $ ANAL_OBJ_AXP: Subroutine
  678. $ V = 'F$Verify(0)
  679. $ SAY := "WRITE_ SYS$OUTPUT"
  680. $
  681. $ IF F$SEARCH("''P1'") .EQS. ""
  682. $ THEN
  683. $    SAY "ANAL_OBJ_AXP-E-NOSUCHFILE:  Error, inputfile ''p1' not available"
  684. $    goto exit_aa
  685. $ ENDIF
  686. $ IF "''P2'" .EQS. ""
  687. $ THEN
  688. $    SAY "ANAL_OBJ_AXP:  Error, no output file provided"
  689. $    goto exit_aa
  690. $ ENDIF
  691. $
  692. $ open/read in 'p1
  693. $ create a.tmp
  694. $ open/append atmp a.tmp
  695. $ loop:
  696. $ read/end=end_loop in line
  697. $ if f$locate("/SHARE",f$edit(line,"upcase")) .lt. f$length(line)
  698. $ then
  699. $   write sys$output "ANAL_SKP_SHR-i-skipshare, ''line'"
  700. $   goto loop
  701. $ endif
  702. $ if f$locate("IDENTIFICATION=",f$edit(line,"upcase")) .lt. f$length(line)
  703. $ then
  704. $   write sys$output "ANAL_OBJ_AXP-i-ident: Identification ", -
  705.                      f$element(1,"=",line)
  706. $   goto loop
  707. $ endif
  708. $ f= f$search(line)
  709. $ if f .eqs. ""
  710. $ then
  711. $ write sys$output "ANAL_OBJ_AXP-w-nosuchfile, ''line'"
  712. $ goto loop
  713. $ endif
  714. $ define/user sys$output nl:
  715. $ define/user sys$error nl:
  716. $ anal/obj/gsd 'f /out=x.tmp
  717. $ open/read xtmp x.tmp
  718. $ XLOOP:
  719. $ read/end=end_xloop xtmp xline
  720. $ xline = f$edit(xline,"compress")
  721. $ write atmp xline
  722. $ goto xloop
  723. $ END_XLOOP:
  724. $ close xtmp
  725. $ goto loop
  726. $ end_loop:
  727. $ close in
  728. $ close atmp
  729. $ if f$search("a.tmp") .eqs. "" -
  730. then $ exit
  731. $ ! all global definitions
  732. $ search a.tmp "symbol:","EGSY$V_DEF 1","EGSY$V_NORM 1"/out=b.tmp
  733. $ ! all procedures
  734. $ search b.tmp "EGSY$V_NORM 1"/wind=(0,1) /out=c.tmp
  735. $ search c.tmp "symbol:"/out=d.tmp
  736. $ define/user sys$output nl:
  737. $ edito/edt/command=sys$input d.tmp
  738. sub/symbol: "/symbol_vector=(/whole
  739. sub/"/=PROCEDURE)/whole
  740. exit
  741. $ ! all data
  742. $ search b.tmp "EGSY$V_DEF 1"/wind=(0,1) /out=e.tmp
  743. $ search e.tmp "symbol:"/out=f.tmp
  744. $ define/user sys$output nl:
  745. $ edito/edt/command=sys$input f.tmp
  746. sub/symbol: "/symbol_vector=(/whole
  747. sub/"/=DATA)/whole
  748. exit
  749. $ sort/nodupl d.tmp,f.tmp g.tmp
  750. $ open/read raw_vector g.tmp
  751. $ open/write case_vector 'p2'
  752. $ RAWLOOP:
  753. $ read/end=end_rawloop raw_vector raw_element
  754. $ write case_vector raw_element
  755. $ if f$locate("=PROCEDURE)",raw_element) .lt. f$length(raw_element)
  756. $ then
  757. $     name = f$element(1,"=",raw_element) - "("
  758. $     if f$edit(name,"UPCASE") .nes. name then -
  759.           write case_vector f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)", -
  760.                           f$edit(name,"UPCASE"), name)
  761. $ endif
  762. $ if f$locate("=DATA)",raw_element) .lt. f$length(raw_element)
  763. $ then
  764. $     name = f$element(1,"=",raw_element) - "("
  765. $     if f$edit(name,"UPCASE") .nes. name then -
  766.           write case_vector f$fao(" symbol_vector=(!AS/!AS=DATA)", -
  767.                           f$edit(name,"UPCASE"), name)
  768. $ endif
  769. $ goto rawloop
  770. $ END_RAWLOOP:
  771. $ close raw_vector
  772. $ close case_vector
  773. $ delete a.tmp;*,b.tmp;*,c.tmp;*,d.tmp;*,e.tmp;*,f.tmp;*,g.tmp;*
  774. $ if f$search("x.tmp") .nes. "" -
  775. then $ delete x.tmp;*
  776. $!
  777. $ EXIT_AA:
  778. $ if V then set verify
  779. $ endsubroutine
  780. $!------------------------------------------------------------------------------
  781. $!
  782. $! Write configuration to both permanent and temporary config file
  783. $!
  784. $! Version history
  785. $! 0.01 20031029 First version to receive a number
  786. $!
  787. $WRITE_CONFIG: SUBROUTINE
  788. $  write aconf 'p1'
  789. $  open/append confh 'th'
  790. $  write confh 'p1'
  791. $  close confh
  792. $ENDSUBROUTINE
  793. $!------------------------------------------------------------------------------