VirtualBox

source: vbox/trunk/src/libs/zlib-1.2.6/make_vms.com@ 47147

Last change on this file since 47147 was 40354, checked in by vboxsync, 13 years ago

libs/zlib-1.2.6: fix OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 23.5 KB
Line 
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 test/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 test/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
402OBJS = adler32.obj, compress.obj, crc32.obj, gzclose.obj, gzlib.obj\
403 gzread.obj, gzwrite.obj, uncompr.obj, infback.obj\
404 deflate.obj, trees.obj, zutil.obj, inflate.obj, \
405 inftrees.obj, inffast.obj
406
407$ eod
408$ write out "CFLAGS=", ccopt
409$ write out "LOPTS=", lopts
410$ copy sys$input: out
411$ deck
412
413all : example.exe minigzip.exe libz.olb
414 @ write sys$output " Example applications available"
415
416libz.olb : libz.olb($(OBJS))
417 @ write sys$output " libz available"
418
419example.exe : example.obj libz.olb
420 link $(LOPTS) example,libz.olb/lib
421
422minigzip.exe : minigzip.obj libz.olb
423 link $(LOPTS) minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib
424
425clean :
426 delete *.obj;*,libz.olb;*,*.opt;*,*.exe;*
427
428
429# Other dependencies.
430adler32.obj : adler32.c zutil.h zlib.h zconf.h
431compress.obj : compress.c zlib.h zconf.h
432crc32.obj : crc32.c zutil.h zlib.h zconf.h
433deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h
434example.obj : test/example.c zlib.h zconf.h
435gzclose.obj : gzclose.c zutil.h zlib.h zconf.h
436gzlib.obj : gzlib.c zutil.h zlib.h zconf.h
437gzread.obj : gzread.c zutil.h zlib.h zconf.h
438gzwrite.obj : gzwrite.c zutil.h zlib.h zconf.h
439inffast.obj : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h
440inflate.obj : inflate.c zutil.h zlib.h zconf.h
441inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h
442minigzip.obj : test/minigzip.c zlib.h zconf.h
443trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h
444uncompr.obj : uncompr.c zlib.h zconf.h
445zutil.obj : zutil.c zutil.h zlib.h zconf.h
446infback.obj : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
447$ eod
448$ close out
449$ return
450$!------------------------------------------------------------------------------
451$!
452$! Read list of core library sources from makefile.in and create options
453$! needed to build shareable image
454$!
455$CREA_OLIST:
456$ open/read min makefile.in
457$ open/write mod modules.opt
458$ src_check = "OBJC ="
459$MRLOOP:
460$ read/end=mrdone min rec
461$ if (f$extract(0,6,rec) .nes. src_check) then goto mrloop
462$ rec = rec - src_check
463$ gosub extra_filnam
464$ if (f$element(1,"\",rec) .eqs. "\") then goto mrdone
465$MRSLOOP:
466$ read/end=mrdone min rec
467$ gosub extra_filnam
468$ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop
469$MRDONE:
470$ close min
471$ close mod
472$ return
473$!------------------------------------------------------------------------------
474$!
475$! Take record extracted in crea_olist and split it into single filenames
476$!
477$EXTRA_FILNAM:
478$ myrec = f$edit(rec - "\", "trim,compress")
479$ i = 0
480$FELOOP:
481$ srcfil = f$element(i," ", myrec)
482$ if (srcfil .nes. " ")
483$ then
484$ write mod f$parse(srcfil,,,"NAME"), ".obj"
485$ i = i + 1
486$ goto feloop
487$ endif
488$ return
489$!------------------------------------------------------------------------------
490$!
491$! Find current Zlib version number
492$!
493$FIND_VERSION:
494$ open/read h_in 'v_file'
495$hloop:
496$ read/end=hdone h_in rec
497$ rec = f$edit(rec,"TRIM")
498$ if (f$extract(0,1,rec) .nes. "#") then goto hloop
499$ rec = f$edit(rec - "#", "TRIM")
500$ if f$element(0," ",rec) .nes. "define" then goto hloop
501$ if f$element(1," ",rec) .eqs. v_string
502$ then
503$ version = 'f$element(2," ",rec)'
504$ goto hdone
505$ endif
506$ goto hloop
507$hdone:
508$ close h_in
509$ return
510$!------------------------------------------------------------------------------
511$!
512$CHECK_CONFIG:
513$!
514$ in_ldef = f$locate(cdef,libdefs)
515$ if (in_ldef .lt. f$length(libdefs))
516$ then
517$ write aconf "#define ''cdef' 1"
518$ libdefs = f$extract(0,in_ldef,libdefs) + -
519 f$extract(in_ldef + f$length(cdef) + 1, -
520 f$length(libdefs) - in_ldef - f$length(cdef) - 1, -
521 libdefs)
522$ else
523$ if (f$type('cdef') .eqs. "INTEGER")
524$ then
525$ write aconf "#define ''cdef' ", 'cdef'
526$ else
527$ if (f$type('cdef') .eqs. "STRING")
528$ then
529$ write aconf "#define ''cdef' ", """", '''cdef'', """"
530$ else
531$ gosub check_cc_def
532$ endif
533$ endif
534$ endif
535$ return
536$!------------------------------------------------------------------------------
537$!
538$! Check if this is a define relating to the properties of the C/C++
539$! compiler
540$!
541$ CHECK_CC_DEF:
542$ if (cdef .eqs. "_LARGEFILE64_SOURCE")
543$ then
544$ copy sys$input: 'tc'
545$ deck
546#include "tconfig"
547#define _LARGEFILE
548#include <stdio.h>
549
550int main(){
551FILE *fp;
552 fp = fopen("temp.txt","r");
553 fseeko(fp,1,SEEK_SET);
554 fclose(fp);
555}
556
557$ eod
558$ test_inv = false
559$ comm_h = false
560$ gosub cc_prop_check
561$ return
562$ endif
563$ write aconf "/* ", line, " */"
564$ return
565$!------------------------------------------------------------------------------
566$!
567$! Check for properties of C/C++ compiler
568$!
569$! Version history
570$! 0.01 20031020 First version to receive a number
571$! 0.02 20031022 Added logic for defines with value
572$! 0.03 20040309 Make sure local config file gets not deleted
573$! 0.04 20041230 Also write include for configure run
574$! 0.05 20050103 Add processing of "comment defines"
575$CC_PROP_CHECK:
576$ cc_prop = true
577$ is_need = false
578$ is_need = (f$extract(0,4,cdef) .eqs. "NEED") .or. (test_inv .eq. true)
579$ if f$search(th) .eqs. "" then create 'th'
580$ set message/nofac/noident/nosever/notext
581$ on error then continue
582$ cc 'tmpnam'
583$ if .not. ($status) then cc_prop = false
584$ on error then continue
585$! The headers might lie about the capabilities of the RTL
586$ link 'tmpnam',tmp.opt/opt
587$ if .not. ($status) then cc_prop = false
588$ set message/fac/ident/sever/text
589$ on error then goto err_exit
590$ delete/nolog 'tmpnam'.*;*/exclude='th'
591$ if (cc_prop .and. .not. is_need) .or. -
592 (.not. cc_prop .and. is_need)
593$ then
594$ write sys$output "Checking for ''cdef'... yes"
595$ if f$type('cdef_val'_yes) .nes. ""
596$ then
597$ if f$type('cdef_val'_yes) .eqs. "INTEGER" -
598 then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_yes)
599$ if f$type('cdef_val'_yes) .eqs. "STRING" -
600 then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_yes)
601$ else
602$ call write_config f$fao("#define !AS 1",cdef)
603$ endif
604$ if (cdef .eqs. "HAVE_FSEEKO") .or. (cdef .eqs. "_LARGE_FILES") .or. -
605 (cdef .eqs. "_LARGEFILE64_SOURCE") then -
606 call write_config f$string("#define _LARGEFILE 1")
607$ else
608$ write sys$output "Checking for ''cdef'... no"
609$ if (comm_h)
610$ then
611 call write_config f$fao("/* !AS */",line)
612$ else
613$ if f$type('cdef_val'_no) .nes. ""
614$ then
615$ if f$type('cdef_val'_no) .eqs. "INTEGER" -
616 then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_no)
617$ if f$type('cdef_val'_no) .eqs. "STRING" -
618 then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_no)
619$ else
620$ call write_config f$fao("#undef !AS",cdef)
621$ endif
622$ endif
623$ endif
624$ return
625$!------------------------------------------------------------------------------
626$!
627$! Check for properties of C/C++ compiler with multiple result values
628$!
629$! Version history
630$! 0.01 20040127 First version
631$! 0.02 20050103 Reconcile changes from cc_prop up to version 0.05
632$CC_MPROP_CHECK:
633$ cc_prop = true
634$ i = 1
635$ idel = 1
636$ MT_LOOP:
637$ if f$type(result_'i') .eqs. "STRING"
638$ then
639$ set message/nofac/noident/nosever/notext
640$ on error then continue
641$ cc 'tmpnam'_'i'
642$ if .not. ($status) then cc_prop = false
643$ on error then continue
644$! The headers might lie about the capabilities of the RTL
645$ link 'tmpnam'_'i',tmp.opt/opt
646$ if .not. ($status) then cc_prop = false
647$ set message/fac/ident/sever/text
648$ on error then goto err_exit
649$ delete/nolog 'tmpnam'_'i'.*;*
650$ if (cc_prop)
651$ then
652$ write sys$output "Checking for ''cdef'... ", mdef_'i'
653$ if f$type(mdef_'i') .eqs. "INTEGER" -
654 then call write_config f$fao("#define !AS !UL",cdef,mdef_'i')
655$ if f$type('cdef_val'_yes) .eqs. "STRING" -
656 then call write_config f$fao("#define !AS !AS",cdef,mdef_'i')
657$ goto msym_clean
658$ else
659$ i = i + 1
660$ goto mt_loop
661$ endif
662$ endif
663$ write sys$output "Checking for ''cdef'... no"
664$ call write_config f$fao("#undef !AS",cdef)
665$ MSYM_CLEAN:
666$ if (idel .le. msym_max)
667$ then
668$ delete/sym mdef_'idel'
669$ idel = idel + 1
670$ goto msym_clean
671$ endif
672$ return
673$!------------------------------------------------------------------------------
674$!
675$! Analyze Object files for OpenVMS AXP to extract Procedure and Data
676$! information to build a symbol vector for a shareable image
677$! All the "brains" of this logic was suggested by Hartmut Becker
678$! (Hartmut.Becker@compaq.com). All the bugs were introduced by me
679$! (zinser@zinser.no-ip.info), so if you do have problem reports please do not
680$! bother Hartmut/HP, but get in touch with me
681$!
682$! Version history
683$! 0.01 20040406 Skip over shareable images in option file
684$! 0.02 20041109 Fix option file for shareable images with case_sensitive=YES
685$! 0.03 20050107 Skip over Identification labels in option file
686$! 0.04 20060117 Add uppercase alias to code compiled with /name=as_is
687$!
688$ ANAL_OBJ_AXP: Subroutine
689$ V = 'F$Verify(0)
690$ SAY := "WRITE_ SYS$OUTPUT"
691$
692$ IF F$SEARCH("''P1'") .EQS. ""
693$ THEN
694$ SAY "ANAL_OBJ_AXP-E-NOSUCHFILE: Error, inputfile ''p1' not available"
695$ goto exit_aa
696$ ENDIF
697$ IF "''P2'" .EQS. ""
698$ THEN
699$ SAY "ANAL_OBJ_AXP: Error, no output file provided"
700$ goto exit_aa
701$ ENDIF
702$
703$ open/read in 'p1
704$ create a.tmp
705$ open/append atmp a.tmp
706$ loop:
707$ read/end=end_loop in line
708$ if f$locate("/SHARE",f$edit(line,"upcase")) .lt. f$length(line)
709$ then
710$ write sys$output "ANAL_SKP_SHR-i-skipshare, ''line'"
711$ goto loop
712$ endif
713$ if f$locate("IDENTIFICATION=",f$edit(line,"upcase")) .lt. f$length(line)
714$ then
715$ write sys$output "ANAL_OBJ_AXP-i-ident: Identification ", -
716 f$element(1,"=",line)
717$ goto loop
718$ endif
719$ f= f$search(line)
720$ if f .eqs. ""
721$ then
722$ write sys$output "ANAL_OBJ_AXP-w-nosuchfile, ''line'"
723$ goto loop
724$ endif
725$ define/user sys$output nl:
726$ define/user sys$error nl:
727$ anal/obj/gsd 'f /out=x.tmp
728$ open/read xtmp x.tmp
729$ XLOOP:
730$ read/end=end_xloop xtmp xline
731$ xline = f$edit(xline,"compress")
732$ write atmp xline
733$ goto xloop
734$ END_XLOOP:
735$ close xtmp
736$ goto loop
737$ end_loop:
738$ close in
739$ close atmp
740$ if f$search("a.tmp") .eqs. "" -
741 then $ exit
742$ ! all global definitions
743$ search a.tmp "symbol:","EGSY$V_DEF 1","EGSY$V_NORM 1"/out=b.tmp
744$ ! all procedures
745$ search b.tmp "EGSY$V_NORM 1"/wind=(0,1) /out=c.tmp
746$ search c.tmp "symbol:"/out=d.tmp
747$ define/user sys$output nl:
748$ edito/edt/command=sys$input d.tmp
749sub/symbol: "/symbol_vector=(/whole
750sub/"/=PROCEDURE)/whole
751exit
752$ ! all data
753$ search b.tmp "EGSY$V_DEF 1"/wind=(0,1) /out=e.tmp
754$ search e.tmp "symbol:"/out=f.tmp
755$ define/user sys$output nl:
756$ edito/edt/command=sys$input f.tmp
757sub/symbol: "/symbol_vector=(/whole
758sub/"/=DATA)/whole
759exit
760$ sort/nodupl d.tmp,f.tmp g.tmp
761$ open/read raw_vector g.tmp
762$ open/write case_vector 'p2'
763$ RAWLOOP:
764$ read/end=end_rawloop raw_vector raw_element
765$ write case_vector raw_element
766$ if f$locate("=PROCEDURE)",raw_element) .lt. f$length(raw_element)
767$ then
768$ name = f$element(1,"=",raw_element) - "("
769$ if f$edit(name,"UPCASE") .nes. name then -
770 write case_vector f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)", -
771 f$edit(name,"UPCASE"), name)
772$ endif
773$ if f$locate("=DATA)",raw_element) .lt. f$length(raw_element)
774$ then
775$ name = f$element(1,"=",raw_element) - "("
776$ if f$edit(name,"UPCASE") .nes. name then -
777 write case_vector f$fao(" symbol_vector=(!AS/!AS=DATA)", -
778 f$edit(name,"UPCASE"), name)
779$ endif
780$ goto rawloop
781$ END_RAWLOOP:
782$ close raw_vector
783$ close case_vector
784$ delete a.tmp;*,b.tmp;*,c.tmp;*,d.tmp;*,e.tmp;*,f.tmp;*,g.tmp;*
785$ if f$search("x.tmp") .nes. "" -
786 then $ delete x.tmp;*
787$!
788$ EXIT_AA:
789$ if V then set verify
790$ endsubroutine
791$!------------------------------------------------------------------------------
792$!
793$! Write configuration to both permanent and temporary config file
794$!
795$! Version history
796$! 0.01 20031029 First version to receive a number
797$!
798$WRITE_CONFIG: SUBROUTINE
799$ write aconf 'p1'
800$ open/append confh 'th'
801$ write confh 'p1'
802$ close confh
803$ENDSUBROUTINE
804$!------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette