Warning, /education/marble/src/3rdparty/zlib/make_vms.com is written in an unsupported language. File is not indexed.
0001 $! make libz under VMS written by 0002 $! Martin P.J. Zinser 0003 $! 0004 $! In case of problems with the install you might contact me at 0005 $! zinser@zinser.no-ip.info(preferred) or 0006 $! martin.zinser@eurexchange.com (work) 0007 $! 0008 $! Make procedure history for Zlib 0009 $! 0010 $!------------------------------------------------------------------------------ 0011 $! Version history 0012 $! 0.01 20060120 First version to receive a number 0013 $! 0.02 20061008 Adapt to new Makefile.in 0014 $! 0.03 20091224 Add support for large file check 0015 $! 0.04 20100110 Add new gzclose, gzlib, gzread, gzwrite 0016 $! 0.05 20100221 Exchange zlibdefs.h by zconf.h.in 0017 $! 0.06 20120111 Fix missing amiss_err, update zconf_h.in, fix new exmples 0018 $! subdir path, update module search in makefile.in 0019 $! 0.07 20120115 Triggered by work done by Alexey Chupahin completly redesigned 0020 $! shared image creation 0021 $! 0.08 20120219 Make it work on VAX again, pre-load missing symbols to shared 0022 $! image 0023 $! 0.09 20120305 SMS. P1 sets builder ("MMK", "MMS", " " (built-in)). 0024 $! "" -> automatic, preference: MMK, MMS, built-in. 0025 $! 0026 $ on error then goto err_exit 0027 $! 0028 $ true = 1 0029 $ false = 0 0030 $ tmpnam = "temp_" + f$getjpi("","pid") 0031 $ tt = tmpnam + ".txt" 0032 $ tc = tmpnam + ".c" 0033 $ th = tmpnam + ".h" 0034 $ define/nolog tconfig 'th' 0035 $ its_decc = false 0036 $ its_vaxc = false 0037 $ its_gnuc = false 0038 $ s_case = False 0039 $! 0040 $! Setup variables holding "config" information 0041 $! 0042 $ Make = "''p1'" 0043 $ name = "Zlib" 0044 $ version = "?.?.?" 0045 $ v_string = "ZLIB_VERSION" 0046 $ v_file = "zlib.h" 0047 $ ccopt = "/include = []" 0048 $ lopts = "" 0049 $ dnsrl = "" 0050 $ aconf_in_file = "zconf.h.in#zconf.h_in#zconf_h.in" 0051 $ conf_check_string = "" 0052 $ linkonly = false 0053 $ optfile = name + ".opt" 0054 $ mapfile = name + ".map" 0055 $ libdefs = "" 0056 $ vax = f$getsyi("HW_MODEL").lt.1024 0057 $ axp = f$getsyi("HW_MODEL").ge.1024 .and. f$getsyi("HW_MODEL").lt.4096 0058 $ ia64 = f$getsyi("HW_MODEL").ge.4096 0059 $! 0060 $! 2012-03-05 SMS. 0061 $! Why is this needed? And if it is needed, why not simply ".not. vax"? 0062 $! 0063 $!!! if axp .or. ia64 then set proc/parse=extended 0064 $! 0065 $ whoami = f$parse(f$environment("Procedure"),,,,"NO_CONCEAL") 0066 $ mydef = F$parse(whoami,,,"DEVICE") 0067 $ mydir = f$parse(whoami,,,"DIRECTORY") - "][" 0068 $ myproc = f$parse(whoami,,,"Name") + f$parse(whoami,,,"type") 0069 $! 0070 $! Check for MMK/MMS 0071 $! 0072 $ if (Make .eqs. "") 0073 $ then 0074 $ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS" 0075 $ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK" 0076 $ else 0077 $ Make = f$edit( Make, "trim") 0078 $ endif 0079 $! 0080 $ gosub find_version 0081 $! 0082 $ open/write topt tmp.opt 0083 $ open/write optf 'optfile' 0084 $! 0085 $ gosub check_opts 0086 $! 0087 $! Look for the compiler used 0088 $! 0089 $ gosub check_compiler 0090 $ close topt 0091 $ close optf 0092 $! 0093 $ if its_decc 0094 $ then 0095 $ ccopt = "/prefix=all" + ccopt 0096 $ if f$trnlnm("SYS") .eqs. "" 0097 $ then 0098 $ if axp 0099 $ then 0100 $ define sys sys$library: 0101 $ else 0102 $ ccopt = "/decc" + ccopt 0103 $ define sys decc$library_include: 0104 $ endif 0105 $ endif 0106 $! 0107 $! 2012-03-05 SMS. 0108 $! Why /NAMES = AS_IS? Why not simply ".not. vax"? And why not on VAX? 0109 $! 0110 $ if axp .or. ia64 0111 $ then 0112 $ ccopt = ccopt + "/name=as_is/opt=(inline=speed)" 0113 $ s_case = true 0114 $ endif 0115 $ endif 0116 $ if its_vaxc .or. its_gnuc 0117 $ then 0118 $ if f$trnlnm("SYS").eqs."" then define sys sys$library: 0119 $ endif 0120 $! 0121 $! Build a fake configure input header 0122 $! 0123 $ open/write conf_hin config.hin 0124 $ write conf_hin "#undef _LARGEFILE64_SOURCE" 0125 $ close conf_hin 0126 $! 0127 $! 0128 $ i = 0 0129 $FIND_ACONF: 0130 $ fname = f$element(i,"#",aconf_in_file) 0131 $ if fname .eqs. "#" then goto AMISS_ERR 0132 $ if f$search(fname) .eqs. "" 0133 $ then 0134 $ i = i + 1 0135 $ goto find_aconf 0136 $ endif 0137 $ open/read/err=aconf_err aconf_in 'fname' 0138 $ open/write aconf zconf.h 0139 $ACONF_LOOP: 0140 $ read/end_of_file=aconf_exit aconf_in line 0141 $ work = f$edit(line, "compress,trim") 0142 $ if f$extract(0,6,work) .nes. "#undef" 0143 $ then 0144 $ if f$extract(0,12,work) .nes. "#cmakedefine" 0145 $ then 0146 $ write aconf line 0147 $ endif 0148 $ else 0149 $ cdef = f$element(1," ",work) 0150 $ gosub check_config 0151 $ endif 0152 $ goto aconf_loop 0153 $ACONF_EXIT: 0154 $ write aconf "" 0155 $ write aconf "/* VMS specifics added by make_vms.com: */" 0156 $ write aconf "#define VMS 1" 0157 $ write aconf "#include <unistd.h>" 0158 $ write aconf "#include <unixio.h>" 0159 $ write aconf "#ifdef _LARGEFILE" 0160 $ write aconf "# define off64_t __off64_t" 0161 $ write aconf "# define fopen64 fopen" 0162 $ write aconf "# define fseeko64 fseeko" 0163 $ write aconf "# define lseek64 lseek" 0164 $ write aconf "# define ftello64 ftell" 0165 $ write aconf "#endif" 0166 $ write aconf "#if !defined( __VAX) && (__CRTL_VER >= 70312000)" 0167 $ write aconf "# define HAVE_VSNPRINTF" 0168 $ write aconf "#endif" 0169 $ close aconf_in 0170 $ close aconf 0171 $ if f$search("''th'") .nes. "" then delete 'th';* 0172 $! Build the thing plain or with mms 0173 $! 0174 $ write sys$output "Compiling Zlib sources ..." 0175 $ if make.eqs."" 0176 $ then 0177 $ if (f$search( "example.obj;*") .nes. "") then delete example.obj;* 0178 $ if (f$search( "minigzip.obj;*") .nes. "") then delete minigzip.obj;* 0179 $ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" - 0180 adler32.c zlib.h zconf.h 0181 $ CALL MAKE compress.OBJ "CC ''CCOPT' compress" - 0182 compress.c zlib.h zconf.h 0183 $ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" - 0184 crc32.c zlib.h zconf.h 0185 $ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" - 0186 deflate.c deflate.h zutil.h zlib.h zconf.h 0187 $ CALL MAKE gzclose.OBJ "CC ''CCOPT' gzclose" - 0188 gzclose.c zutil.h zlib.h zconf.h 0189 $ CALL MAKE gzlib.OBJ "CC ''CCOPT' gzlib" - 0190 gzlib.c zutil.h zlib.h zconf.h 0191 $ CALL MAKE gzread.OBJ "CC ''CCOPT' gzread" - 0192 gzread.c zutil.h zlib.h zconf.h 0193 $ CALL MAKE gzwrite.OBJ "CC ''CCOPT' gzwrite" - 0194 gzwrite.c zutil.h zlib.h zconf.h 0195 $ CALL MAKE infback.OBJ "CC ''CCOPT' infback" - 0196 infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h 0197 $ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" - 0198 inffast.c zutil.h zlib.h zconf.h inffast.h 0199 $ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" - 0200 inflate.c zutil.h zlib.h zconf.h infblock.h 0201 $ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" - 0202 inftrees.c zutil.h zlib.h zconf.h inftrees.h 0203 $ CALL MAKE trees.OBJ "CC ''CCOPT' trees" - 0204 trees.c deflate.h zutil.h zlib.h zconf.h 0205 $ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" - 0206 uncompr.c zlib.h zconf.h 0207 $ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" - 0208 zutil.c zutil.h zlib.h zconf.h 0209 $ write sys$output "Building Zlib ..." 0210 $ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ 0211 $ write sys$output "Building example..." 0212 $ CALL MAKE example.OBJ "CC ''CCOPT' [.test]example" - 0213 [.test]example.c zlib.h zconf.h 0214 $ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb 0215 $ write sys$output "Building minigzip..." 0216 $ CALL MAKE minigzip.OBJ "CC ''CCOPT' [.test]minigzip" - 0217 [.test]minigzip.c zlib.h zconf.h 0218 $ call make minigzip.exe - 0219 "LINK minigzip,libz.olb/lib" - 0220 minigzip.obj libz.olb 0221 $ else 0222 $ gosub crea_mms 0223 $ write sys$output "Make ''name' ''version' with ''Make' " 0224 $ 'make' 0225 $ endif 0226 $! 0227 $! Create shareable image 0228 $! 0229 $ gosub crea_olist 0230 $ write sys$output "Creating libzshr.exe" 0231 $ call map_2_shopt 'mapfile' 'optfile' 0232 $ LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,'optfile'/opt 0233 $ write sys$output "Zlib build completed" 0234 $ delete/nolog tmp.opt;* 0235 $ exit 0236 $AMISS_ERR: 0237 $ write sys$output "No source for config.hin found." 0238 $ write sys$output "Tried any of ''aconf_in_file'" 0239 $ goto err_exit 0240 $CC_ERR: 0241 $ write sys$output "C compiler required to build ''name'" 0242 $ goto err_exit 0243 $ERR_EXIT: 0244 $ set message/facil/ident/sever/text 0245 $ close/nolog optf 0246 $ close/nolog topt 0247 $ close/nolog aconf_in 0248 $ close/nolog aconf 0249 $ close/nolog out 0250 $ close/nolog min 0251 $ close/nolog mod 0252 $ close/nolog h_in 0253 $ write sys$output "Exiting..." 0254 $ exit 2 0255 $! 0256 $! 0257 $MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES 0258 $ V = 'F$Verify(0) 0259 $! P1 = What we are trying to make 0260 $! P2 = Command to make it 0261 $! P3 - P8 What it depends on 0262 $ 0263 $ If F$Search(P1) .Eqs. "" Then Goto Makeit 0264 $ Time = F$CvTime(F$File(P1,"RDT")) 0265 $arg=3 0266 $Loop: 0267 $ Argument = P'arg 0268 $ If Argument .Eqs. "" Then Goto Exit 0269 $ El=0 0270 $Loop2: 0271 $ File = F$Element(El," ",Argument) 0272 $ If File .Eqs. " " Then Goto Endl 0273 $ AFile = "" 0274 $Loop3: 0275 $ OFile = AFile 0276 $ AFile = F$Search(File) 0277 $ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl 0278 $ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit 0279 $ Goto Loop3 0280 $NextEL: 0281 $ El = El + 1 0282 $ Goto Loop2 0283 $EndL: 0284 $ arg=arg+1 0285 $ If arg .Le. 8 Then Goto Loop 0286 $ Goto Exit 0287 $ 0288 $Makeit: 0289 $ VV=F$VERIFY(0) 0290 $ write sys$output P2 0291 $ 'P2 0292 $ VV='F$Verify(VV) 0293 $Exit: 0294 $ If V Then Set Verify 0295 $ENDSUBROUTINE 0296 $!------------------------------------------------------------------------------ 0297 $! 0298 $! Check command line options and set symbols accordingly 0299 $! 0300 $!------------------------------------------------------------------------------ 0301 $! Version history 0302 $! 0.01 20041206 First version to receive a number 0303 $! 0.02 20060126 Add new "HELP" target 0304 $ CHECK_OPTS: 0305 $ i = 1 0306 $ OPT_LOOP: 0307 $ if i .lt. 9 0308 $ then 0309 $ cparm = f$edit(p'i',"upcase") 0310 $! 0311 $! Check if parameter actually contains something 0312 $! 0313 $ if f$edit(cparm,"trim") .nes. "" 0314 $ then 0315 $ if cparm .eqs. "DEBUG" 0316 $ then 0317 $ ccopt = ccopt + "/noopt/deb" 0318 $ lopts = lopts + "/deb" 0319 $ endif 0320 $ if f$locate("CCOPT=",cparm) .lt. f$length(cparm) 0321 $ then 0322 $ start = f$locate("=",cparm) + 1 0323 $ len = f$length(cparm) - start 0324 $ ccopt = ccopt + f$extract(start,len,cparm) 0325 $ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) - 0326 then s_case = true 0327 $ endif 0328 $ if cparm .eqs. "LINK" then linkonly = true 0329 $ if f$locate("LOPTS=",cparm) .lt. f$length(cparm) 0330 $ then 0331 $ start = f$locate("=",cparm) + 1 0332 $ len = f$length(cparm) - start 0333 $ lopts = lopts + f$extract(start,len,cparm) 0334 $ endif 0335 $ if f$locate("CC=",cparm) .lt. f$length(cparm) 0336 $ then 0337 $ start = f$locate("=",cparm) + 1 0338 $ len = f$length(cparm) - start 0339 $ cc_com = f$extract(start,len,cparm) 0340 if (cc_com .nes. "DECC") .and. - 0341 (cc_com .nes. "VAXC") .and. - 0342 (cc_com .nes. "GNUC") 0343 $ then 0344 $ write sys$output "Unsupported compiler choice ''cc_com' ignored" 0345 $ write sys$output "Use DECC, VAXC, or GNUC instead" 0346 $ else 0347 $ if cc_com .eqs. "DECC" then its_decc = true 0348 $ if cc_com .eqs. "VAXC" then its_vaxc = true 0349 $ if cc_com .eqs. "GNUC" then its_gnuc = true 0350 $ endif 0351 $ endif 0352 $ if f$locate("MAKE=",cparm) .lt. f$length(cparm) 0353 $ then 0354 $ start = f$locate("=",cparm) + 1 0355 $ len = f$length(cparm) - start 0356 $ mmks = f$extract(start,len,cparm) 0357 $ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS") 0358 $ then 0359 $ make = mmks 0360 $ else 0361 $ write sys$output "Unsupported make choice ''mmks' ignored" 0362 $ write sys$output "Use MMK or MMS instead" 0363 $ endif 0364 $ endif 0365 $ if cparm .eqs. "HELP" then gosub bhelp 0366 $ endif 0367 $ i = i + 1 0368 $ goto opt_loop 0369 $ endif 0370 $ return 0371 $!------------------------------------------------------------------------------ 0372 $! 0373 $! Look for the compiler used 0374 $! 0375 $! Version history 0376 $! 0.01 20040223 First version to receive a number 0377 $! 0.02 20040229 Save/set value of decc$no_rooted_search_lists 0378 $! 0.03 20060202 Extend handling of GNU C 0379 $! 0.04 20090402 Compaq -> hp 0380 $CHECK_COMPILER: 0381 $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc)) 0382 $ then 0383 $ its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "") 0384 $ its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "") 0385 $ its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "") 0386 $ endif 0387 $! 0388 $! Exit if no compiler available 0389 $! 0390 $ if (.not. (its_decc .or. its_vaxc .or. its_gnuc)) 0391 $ then goto CC_ERR 0392 $ else 0393 $ if its_decc 0394 $ then 0395 $ write sys$output "CC compiler check ... hp C" 0396 $ if f$trnlnm("decc$no_rooted_search_lists") .nes. "" 0397 $ then 0398 $ dnrsl = f$trnlnm("decc$no_rooted_search_lists") 0399 $ endif 0400 $ define/nolog decc$no_rooted_search_lists 1 0401 $ else 0402 $ if its_vaxc then write sys$output "CC compiler check ... VAX C" 0403 $ if its_gnuc 0404 $ then 0405 $ write sys$output "CC compiler check ... GNU C" 0406 $ if f$trnlnm(topt) then write topt "gnu_cc:[000000]gcclib.olb/lib" 0407 $ if f$trnlnm(optf) then write optf "gnu_cc:[000000]gcclib.olb/lib" 0408 $ cc = "gcc" 0409 $ endif 0410 $ if f$trnlnm(topt) then write topt "sys$share:vaxcrtl.exe/share" 0411 $ if f$trnlnm(optf) then write optf "sys$share:vaxcrtl.exe/share" 0412 $ endif 0413 $ endif 0414 $ return 0415 $!------------------------------------------------------------------------------ 0416 $! 0417 $! If MMS/MMK are available dump out the descrip.mms if required 0418 $! 0419 $CREA_MMS: 0420 $ write sys$output "Creating descrip.mms..." 0421 $ create descrip.mms 0422 $ open/append out descrip.mms 0423 $ copy sys$input: out 0424 $ deck 0425 # descrip.mms: MMS description file for building zlib on VMS 0426 # written by Martin P.J. Zinser 0427 # <zinser@zinser.no-ip.info or martin.zinser@eurexchange.com> 0428 0429 OBJS = adler32.obj, compress.obj, crc32.obj, gzclose.obj, gzlib.obj\ 0430 gzread.obj, gzwrite.obj, uncompr.obj, infback.obj\ 0431 deflate.obj, trees.obj, zutil.obj, inflate.obj, \ 0432 inftrees.obj, inffast.obj 0433 0434 $ eod 0435 $ write out "CFLAGS=", ccopt 0436 $ write out "LOPTS=", lopts 0437 $ write out "all : example.exe minigzip.exe libz.olb" 0438 $ copy sys$input: out 0439 $ deck 0440 @ write sys$output " Example applications available" 0441 0442 libz.olb : libz.olb($(OBJS)) 0443 @ write sys$output " libz available" 0444 0445 example.exe : example.obj libz.olb 0446 link $(LOPTS) example,libz.olb/lib 0447 0448 minigzip.exe : minigzip.obj libz.olb 0449 link $(LOPTS) minigzip,libz.olb/lib 0450 0451 clean : 0452 delete *.obj;*,libz.olb;*,*.opt;*,*.exe;* 0453 0454 0455 # Other dependencies. 0456 adler32.obj : adler32.c zutil.h zlib.h zconf.h 0457 compress.obj : compress.c zlib.h zconf.h 0458 crc32.obj : crc32.c zutil.h zlib.h zconf.h 0459 deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h 0460 example.obj : [.test]example.c zlib.h zconf.h 0461 gzclose.obj : gzclose.c zutil.h zlib.h zconf.h 0462 gzlib.obj : gzlib.c zutil.h zlib.h zconf.h 0463 gzread.obj : gzread.c zutil.h zlib.h zconf.h 0464 gzwrite.obj : gzwrite.c zutil.h zlib.h zconf.h 0465 inffast.obj : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h 0466 inflate.obj : inflate.c zutil.h zlib.h zconf.h 0467 inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h 0468 minigzip.obj : [.test]minigzip.c zlib.h zconf.h 0469 trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h 0470 uncompr.obj : uncompr.c zlib.h zconf.h 0471 zutil.obj : zutil.c zutil.h zlib.h zconf.h 0472 infback.obj : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h 0473 $ eod 0474 $ close out 0475 $ return 0476 $!------------------------------------------------------------------------------ 0477 $! 0478 $! Read list of core library sources from makefile.in and create options 0479 $! needed to build shareable image 0480 $! 0481 $CREA_OLIST: 0482 $ open/read min makefile.in 0483 $ open/write mod modules.opt 0484 $ src_check_list = "OBJZ =#OBJG =" 0485 $MRLOOP: 0486 $ read/end=mrdone min rec 0487 $ i = 0 0488 $SRC_CHECK_LOOP: 0489 $ src_check = f$element(i, "#", src_check_list) 0490 $ i = i+1 0491 $ if src_check .eqs. "#" then goto mrloop 0492 $ if (f$extract(0,6,rec) .nes. src_check) then goto src_check_loop 0493 $ rec = rec - src_check 0494 $ gosub extra_filnam 0495 $ if (f$element(1,"\",rec) .eqs. "\") then goto mrloop 0496 $MRSLOOP: 0497 $ read/end=mrdone min rec 0498 $ gosub extra_filnam 0499 $ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop 0500 $MRDONE: 0501 $ close min 0502 $ close mod 0503 $ return 0504 $!------------------------------------------------------------------------------ 0505 $! 0506 $! Take record extracted in crea_olist and split it into single filenames 0507 $! 0508 $EXTRA_FILNAM: 0509 $ myrec = f$edit(rec - "\", "trim,compress") 0510 $ i = 0 0511 $FELOOP: 0512 $ srcfil = f$element(i," ", myrec) 0513 $ if (srcfil .nes. " ") 0514 $ then 0515 $ write mod f$parse(srcfil,,,"NAME"), ".obj" 0516 $ i = i + 1 0517 $ goto feloop 0518 $ endif 0519 $ return 0520 $!------------------------------------------------------------------------------ 0521 $! 0522 $! Find current Zlib version number 0523 $! 0524 $FIND_VERSION: 0525 $ open/read h_in 'v_file' 0526 $hloop: 0527 $ read/end=hdone h_in rec 0528 $ rec = f$edit(rec,"TRIM") 0529 $ if (f$extract(0,1,rec) .nes. "#") then goto hloop 0530 $ rec = f$edit(rec - "#", "TRIM") 0531 $ if f$element(0," ",rec) .nes. "define" then goto hloop 0532 $ if f$element(1," ",rec) .eqs. v_string 0533 $ then 0534 $ version = 'f$element(2," ",rec)' 0535 $ goto hdone 0536 $ endif 0537 $ goto hloop 0538 $hdone: 0539 $ close h_in 0540 $ return 0541 $!------------------------------------------------------------------------------ 0542 $! 0543 $CHECK_CONFIG: 0544 $! 0545 $ in_ldef = f$locate(cdef,libdefs) 0546 $ if (in_ldef .lt. f$length(libdefs)) 0547 $ then 0548 $ write aconf "#define ''cdef' 1" 0549 $ libdefs = f$extract(0,in_ldef,libdefs) + - 0550 f$extract(in_ldef + f$length(cdef) + 1, - 0551 f$length(libdefs) - in_ldef - f$length(cdef) - 1, - 0552 libdefs) 0553 $ else 0554 $ if (f$type('cdef') .eqs. "INTEGER") 0555 $ then 0556 $ write aconf "#define ''cdef' ", 'cdef' 0557 $ else 0558 $ if (f$type('cdef') .eqs. "STRING") 0559 $ then 0560 $ write aconf "#define ''cdef' ", """", '''cdef'', """" 0561 $ else 0562 $ gosub check_cc_def 0563 $ endif 0564 $ endif 0565 $ endif 0566 $ return 0567 $!------------------------------------------------------------------------------ 0568 $! 0569 $! Check if this is a define relating to the properties of the C/C++ 0570 $! compiler 0571 $! 0572 $ CHECK_CC_DEF: 0573 $ if (cdef .eqs. "_LARGEFILE64_SOURCE") 0574 $ then 0575 $ copy sys$input: 'tc' 0576 $ deck 0577 #include "tconfig" 0578 #define _LARGEFILE 0579 #include <stdio.h> 0580 0581 int main(){ 0582 FILE *fp; 0583 fp = fopen("temp.txt","r"); 0584 fseeko(fp,1,SEEK_SET); 0585 fclose(fp); 0586 } 0587 0588 $ eod 0589 $ test_inv = false 0590 $ comm_h = false 0591 $ gosub cc_prop_check 0592 $ return 0593 $ endif 0594 $ write aconf "/* ", line, " */" 0595 $ return 0596 $!------------------------------------------------------------------------------ 0597 $! 0598 $! Check for properties of C/C++ compiler 0599 $! 0600 $! Version history 0601 $! 0.01 20031020 First version to receive a number 0602 $! 0.02 20031022 Added logic for defines with value 0603 $! 0.03 20040309 Make sure local config file gets not deleted 0604 $! 0.04 20041230 Also write include for configure run 0605 $! 0.05 20050103 Add processing of "comment defines" 0606 $CC_PROP_CHECK: 0607 $ cc_prop = true 0608 $ is_need = false 0609 $ is_need = (f$extract(0,4,cdef) .eqs. "NEED") .or. (test_inv .eq. true) 0610 $ if f$search(th) .eqs. "" then create 'th' 0611 $ set message/nofac/noident/nosever/notext 0612 $ on error then continue 0613 $ cc 'tmpnam' 0614 $ if .not. ($status) then cc_prop = false 0615 $ on error then continue 0616 $! The headers might lie about the capabilities of the RTL 0617 $ link 'tmpnam',tmp.opt/opt 0618 $ if .not. ($status) then cc_prop = false 0619 $ set message/fac/ident/sever/text 0620 $ on error then goto err_exit 0621 $ delete/nolog 'tmpnam'.*;*/exclude='th' 0622 $ if (cc_prop .and. .not. is_need) .or. - 0623 (.not. cc_prop .and. is_need) 0624 $ then 0625 $ write sys$output "Checking for ''cdef'... yes" 0626 $ if f$type('cdef_val'_yes) .nes. "" 0627 $ then 0628 $ if f$type('cdef_val'_yes) .eqs. "INTEGER" - 0629 then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_yes) 0630 $ if f$type('cdef_val'_yes) .eqs. "STRING" - 0631 then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_yes) 0632 $ else 0633 $ call write_config f$fao("#define !AS 1",cdef) 0634 $ endif 0635 $ if (cdef .eqs. "HAVE_FSEEKO") .or. (cdef .eqs. "_LARGE_FILES") .or. - 0636 (cdef .eqs. "_LARGEFILE64_SOURCE") then - 0637 call write_config f$string("#define _LARGEFILE 1") 0638 $ else 0639 $ write sys$output "Checking for ''cdef'... no" 0640 $ if (comm_h) 0641 $ then 0642 call write_config f$fao("/* !AS */",line) 0643 $ else 0644 $ if f$type('cdef_val'_no) .nes. "" 0645 $ then 0646 $ if f$type('cdef_val'_no) .eqs. "INTEGER" - 0647 then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_no) 0648 $ if f$type('cdef_val'_no) .eqs. "STRING" - 0649 then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_no) 0650 $ else 0651 $ call write_config f$fao("#undef !AS",cdef) 0652 $ endif 0653 $ endif 0654 $ endif 0655 $ return 0656 $!------------------------------------------------------------------------------ 0657 $! 0658 $! Check for properties of C/C++ compiler with multiple result values 0659 $! 0660 $! Version history 0661 $! 0.01 20040127 First version 0662 $! 0.02 20050103 Reconcile changes from cc_prop up to version 0.05 0663 $CC_MPROP_CHECK: 0664 $ cc_prop = true 0665 $ i = 1 0666 $ idel = 1 0667 $ MT_LOOP: 0668 $ if f$type(result_'i') .eqs. "STRING" 0669 $ then 0670 $ set message/nofac/noident/nosever/notext 0671 $ on error then continue 0672 $ cc 'tmpnam'_'i' 0673 $ if .not. ($status) then cc_prop = false 0674 $ on error then continue 0675 $! The headers might lie about the capabilities of the RTL 0676 $ link 'tmpnam'_'i',tmp.opt/opt 0677 $ if .not. ($status) then cc_prop = false 0678 $ set message/fac/ident/sever/text 0679 $ on error then goto err_exit 0680 $ delete/nolog 'tmpnam'_'i'.*;* 0681 $ if (cc_prop) 0682 $ then 0683 $ write sys$output "Checking for ''cdef'... ", mdef_'i' 0684 $ if f$type(mdef_'i') .eqs. "INTEGER" - 0685 then call write_config f$fao("#define !AS !UL",cdef,mdef_'i') 0686 $ if f$type('cdef_val'_yes) .eqs. "STRING" - 0687 then call write_config f$fao("#define !AS !AS",cdef,mdef_'i') 0688 $ goto msym_clean 0689 $ else 0690 $ i = i + 1 0691 $ goto mt_loop 0692 $ endif 0693 $ endif 0694 $ write sys$output "Checking for ''cdef'... no" 0695 $ call write_config f$fao("#undef !AS",cdef) 0696 $ MSYM_CLEAN: 0697 $ if (idel .le. msym_max) 0698 $ then 0699 $ delete/sym mdef_'idel' 0700 $ idel = idel + 1 0701 $ goto msym_clean 0702 $ endif 0703 $ return 0704 $!------------------------------------------------------------------------------ 0705 $! 0706 $! Write configuration to both permanent and temporary config file 0707 $! 0708 $! Version history 0709 $! 0.01 20031029 First version to receive a number 0710 $! 0711 $WRITE_CONFIG: SUBROUTINE 0712 $ write aconf 'p1' 0713 $ open/append confh 'th' 0714 $ write confh 'p1' 0715 $ close confh 0716 $ENDSUBROUTINE 0717 $!------------------------------------------------------------------------------ 0718 $! 0719 $! Analyze the project map file and create the symbol vector for a shareable 0720 $! image from it 0721 $! 0722 $! Version history 0723 $! 0.01 20120128 First version 0724 $! 0.02 20120226 Add pre-load logic 0725 $! 0726 $ MAP_2_SHOPT: Subroutine 0727 $! 0728 $ SAY := "WRITE_ SYS$OUTPUT" 0729 $! 0730 $ IF F$SEARCH("''P1'") .EQS. "" 0731 $ THEN 0732 $ SAY "MAP_2_SHOPT-E-NOSUCHFILE: Error, inputfile ''p1' not available" 0733 $ goto exit_m2s 0734 $ ENDIF 0735 $ IF "''P2'" .EQS. "" 0736 $ THEN 0737 $ SAY "MAP_2_SHOPT: Error, no output file provided" 0738 $ goto exit_m2s 0739 $ ENDIF 0740 $! 0741 $ module1 = "deflate#deflateEnd#deflateInit_#deflateParams#deflateSetDictionary" 0742 $ module2 = "gzclose#gzerror#gzgetc#gzgets#gzopen#gzprintf#gzputc#gzputs#gzread" 0743 $ module3 = "gzseek#gztell#inflate#inflateEnd#inflateInit_#inflateSetDictionary" 0744 $ module4 = "inflateSync#uncompress#zlibVersion#compress" 0745 $ open/read map 'p1 0746 $ if axp .or. ia64 0747 $ then 0748 $ open/write aopt a.opt 0749 $ open/write bopt b.opt 0750 $ write aopt " CASE_SENSITIVE=YES" 0751 $ write bopt "SYMBOL_VECTOR= (-" 0752 $ mod_sym_num = 1 0753 $ MOD_SYM_LOOP: 0754 $ if f$type(module'mod_sym_num') .nes. "" 0755 $ then 0756 $ mod_in = 0 0757 $ MOD_SYM_IN: 0758 $ shared_proc = f$element(mod_in, "#", module'mod_sym_num') 0759 $ if shared_proc .nes. "#" 0760 $ then 0761 $ write aopt f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)",- 0762 f$edit(shared_proc,"upcase"),shared_proc) 0763 $ write bopt f$fao("!AS=PROCEDURE,-",shared_proc) 0764 $ mod_in = mod_in + 1 0765 $ goto mod_sym_in 0766 $ endif 0767 $ mod_sym_num = mod_sym_num + 1 0768 $ goto mod_sym_loop 0769 $ endif 0770 $MAP_LOOP: 0771 $ read/end=map_end map line 0772 $ if (f$locate("{",line).lt. f$length(line)) .or. - 0773 (f$locate("global:", line) .lt. f$length(line)) 0774 $ then 0775 $ proc = true 0776 $ goto map_loop 0777 $ endif 0778 $ if f$locate("}",line).lt. f$length(line) then proc = false 0779 $ if f$locate("local:", line) .lt. f$length(line) then proc = false 0780 $ if proc 0781 $ then 0782 $ shared_proc = f$edit(line,"collapse") 0783 $ chop_semi = f$locate(";", shared_proc) 0784 $ if chop_semi .lt. f$length(shared_proc) then - 0785 shared_proc = f$extract(0, chop_semi, shared_proc) 0786 $ write aopt f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)",- 0787 f$edit(shared_proc,"upcase"),shared_proc) 0788 $ write bopt f$fao("!AS=PROCEDURE,-",shared_proc) 0789 $ endif 0790 $ goto map_loop 0791 $MAP_END: 0792 $ close/nolog aopt 0793 $ close/nolog bopt 0794 $ open/append libopt 'p2' 0795 $ open/read aopt a.opt 0796 $ open/read bopt b.opt 0797 $ALOOP: 0798 $ read/end=aloop_end aopt line 0799 $ write libopt line 0800 $ goto aloop 0801 $ALOOP_END: 0802 $ close/nolog aopt 0803 $ sv = "" 0804 $BLOOP: 0805 $ read/end=bloop_end bopt svn 0806 $ if (svn.nes."") 0807 $ then 0808 $ if (sv.nes."") then write libopt sv 0809 $ sv = svn 0810 $ endif 0811 $ goto bloop 0812 $BLOOP_END: 0813 $ write libopt f$extract(0,f$length(sv)-2,sv), "-" 0814 $ write libopt ")" 0815 $ close/nolog bopt 0816 $ delete/nolog/noconf a.opt;*,b.opt;* 0817 $ else 0818 $ if vax 0819 $ then 0820 $ open/append libopt 'p2' 0821 $ mod_sym_num = 1 0822 $ VMOD_SYM_LOOP: 0823 $ if f$type(module'mod_sym_num') .nes. "" 0824 $ then 0825 $ mod_in = 0 0826 $ VMOD_SYM_IN: 0827 $ shared_proc = f$element(mod_in, "#", module'mod_sym_num') 0828 $ if shared_proc .nes. "#" 0829 $ then 0830 $ write libopt f$fao("UNIVERSAL=!AS",- 0831 f$edit(shared_proc,"upcase")) 0832 $ mod_in = mod_in + 1 0833 $ goto vmod_sym_in 0834 $ endif 0835 $ mod_sym_num = mod_sym_num + 1 0836 $ goto vmod_sym_loop 0837 $ endif 0838 $VMAP_LOOP: 0839 $ read/end=vmap_end map line 0840 $ if (f$locate("{",line).lt. f$length(line)) .or. - 0841 (f$locate("global:", line) .lt. f$length(line)) 0842 $ then 0843 $ proc = true 0844 $ goto vmap_loop 0845 $ endif 0846 $ if f$locate("}",line).lt. f$length(line) then proc = false 0847 $ if f$locate("local:", line) .lt. f$length(line) then proc = false 0848 $ if proc 0849 $ then 0850 $ shared_proc = f$edit(line,"collapse") 0851 $ chop_semi = f$locate(";", shared_proc) 0852 $ if chop_semi .lt. f$length(shared_proc) then - 0853 shared_proc = f$extract(0, chop_semi, shared_proc) 0854 $ write libopt f$fao("UNIVERSAL=!AS",- 0855 f$edit(shared_proc,"upcase")) 0856 $ endif 0857 $ goto vmap_loop 0858 $VMAP_END: 0859 $ else 0860 $ write sys$output "Unknown Architecture (Not VAX, AXP, or IA64)" 0861 $ write sys$output "No options file created" 0862 $ endif 0863 $ endif 0864 $ EXIT_M2S: 0865 $ close/nolog map 0866 $ close/nolog libopt 0867 $ endsubroutine