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