xref: /netbsd-src/external/gpl3/binutils.old/dist/zlib/make_vms.com (revision 75fd0b742a7e4a64301bc6c44e9bc5240c58bb92)
1*75fd0b74Schristos$! make libz under VMS written by
2*75fd0b74Schristos$! Martin P.J. Zinser
3*75fd0b74Schristos$!
4*75fd0b74Schristos$! In case of problems with the install you might contact me at
5*75fd0b74Schristos$! zinser@zinser.no-ip.info(preferred) or
6*75fd0b74Schristos$! martin.zinser@eurexchange.com (work)
7*75fd0b74Schristos$!
8*75fd0b74Schristos$! Make procedure history for Zlib
9*75fd0b74Schristos$!
10*75fd0b74Schristos$!------------------------------------------------------------------------------
11*75fd0b74Schristos$! Version history
12*75fd0b74Schristos$! 0.01 20060120 First version to receive a number
13*75fd0b74Schristos$! 0.02 20061008 Adapt to new Makefile.in
14*75fd0b74Schristos$! 0.03 20091224 Add support for large file check
15*75fd0b74Schristos$! 0.04 20100110 Add new gzclose, gzlib, gzread, gzwrite
16*75fd0b74Schristos$! 0.05 20100221 Exchange zlibdefs.h by zconf.h.in
17*75fd0b74Schristos$! 0.06 20120111 Fix missing amiss_err, update zconf_h.in, fix new exmples
18*75fd0b74Schristos$!               subdir path, update module search in makefile.in
19*75fd0b74Schristos$! 0.07 20120115 Triggered by work done by Alexey Chupahin completly redesigned
20*75fd0b74Schristos$!               shared image creation
21*75fd0b74Schristos$! 0.08 20120219 Make it work on VAX again, pre-load missing symbols to shared
22*75fd0b74Schristos$!               image
23*75fd0b74Schristos$! 0.09 20120305 SMS.  P1 sets builder ("MMK", "MMS", " " (built-in)).
24*75fd0b74Schristos$!               "" -> automatic, preference: MMK, MMS, built-in.
25*75fd0b74Schristos$!
26*75fd0b74Schristos$ on error then goto err_exit
27*75fd0b74Schristos$!
28*75fd0b74Schristos$ true  = 1
29*75fd0b74Schristos$ false = 0
30*75fd0b74Schristos$ tmpnam = "temp_" + f$getjpi("","pid")
31*75fd0b74Schristos$ tt = tmpnam + ".txt"
32*75fd0b74Schristos$ tc = tmpnam + ".c"
33*75fd0b74Schristos$ th = tmpnam + ".h"
34*75fd0b74Schristos$ define/nolog tconfig 'th'
35*75fd0b74Schristos$ its_decc = false
36*75fd0b74Schristos$ its_vaxc = false
37*75fd0b74Schristos$ its_gnuc = false
38*75fd0b74Schristos$ s_case   = False
39*75fd0b74Schristos$!
40*75fd0b74Schristos$! Setup variables holding "config" information
41*75fd0b74Schristos$!
42*75fd0b74Schristos$ Make    = "''p1'"
43*75fd0b74Schristos$ name     = "Zlib"
44*75fd0b74Schristos$ version  = "?.?.?"
45*75fd0b74Schristos$ v_string = "ZLIB_VERSION"
46*75fd0b74Schristos$ v_file   = "zlib.h"
47*75fd0b74Schristos$ ccopt   = "/include = []"
48*75fd0b74Schristos$ lopts   = ""
49*75fd0b74Schristos$ dnsrl   = ""
50*75fd0b74Schristos$ aconf_in_file = "zconf.h.in#zconf.h_in#zconf_h.in"
51*75fd0b74Schristos$ conf_check_string = ""
52*75fd0b74Schristos$ linkonly = false
53*75fd0b74Schristos$ optfile  = name + ".opt"
54*75fd0b74Schristos$ mapfile  = name + ".map"
55*75fd0b74Schristos$ libdefs  = ""
56*75fd0b74Schristos$ vax      = f$getsyi("HW_MODEL").lt.1024
57*75fd0b74Schristos$ axp      = f$getsyi("HW_MODEL").ge.1024 .and. f$getsyi("HW_MODEL").lt.4096
58*75fd0b74Schristos$ ia64     = f$getsyi("HW_MODEL").ge.4096
59*75fd0b74Schristos$!
60*75fd0b74Schristos$! 2012-03-05 SMS.
61*75fd0b74Schristos$! Why is this needed?  And if it is needed, why not simply ".not. vax"?
62*75fd0b74Schristos$!
63*75fd0b74Schristos$!!! if axp .or. ia64 then  set proc/parse=extended
64*75fd0b74Schristos$!
65*75fd0b74Schristos$ whoami = f$parse(f$environment("Procedure"),,,,"NO_CONCEAL")
66*75fd0b74Schristos$ mydef  = F$parse(whoami,,,"DEVICE")
67*75fd0b74Schristos$ mydir  = f$parse(whoami,,,"DIRECTORY") - "]["
68*75fd0b74Schristos$ myproc = f$parse(whoami,,,"Name") + f$parse(whoami,,,"type")
69*75fd0b74Schristos$!
70*75fd0b74Schristos$! Check for MMK/MMS
71*75fd0b74Schristos$!
72*75fd0b74Schristos$ if (Make .eqs. "")
73*75fd0b74Schristos$ then
74*75fd0b74Schristos$   If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS"
75*75fd0b74Schristos$   If F$Type (MMK) .eqs. "STRING" Then Make = "MMK"
76*75fd0b74Schristos$ else
77*75fd0b74Schristos$   Make = f$edit( Make, "trim")
78*75fd0b74Schristos$ endif
79*75fd0b74Schristos$!
80*75fd0b74Schristos$ gosub find_version
81*75fd0b74Schristos$!
82*75fd0b74Schristos$  open/write topt tmp.opt
83*75fd0b74Schristos$  open/write optf 'optfile'
84*75fd0b74Schristos$!
85*75fd0b74Schristos$ gosub check_opts
86*75fd0b74Schristos$!
87*75fd0b74Schristos$! Look for the compiler used
88*75fd0b74Schristos$!
89*75fd0b74Schristos$ gosub check_compiler
90*75fd0b74Schristos$ close topt
91*75fd0b74Schristos$ close optf
92*75fd0b74Schristos$!
93*75fd0b74Schristos$ if its_decc
94*75fd0b74Schristos$ then
95*75fd0b74Schristos$   ccopt = "/prefix=all" + ccopt
96*75fd0b74Schristos$   if f$trnlnm("SYS") .eqs. ""
97*75fd0b74Schristos$   then
98*75fd0b74Schristos$     if axp
99*75fd0b74Schristos$     then
100*75fd0b74Schristos$       define sys sys$library:
101*75fd0b74Schristos$     else
102*75fd0b74Schristos$       ccopt = "/decc" + ccopt
103*75fd0b74Schristos$       define sys decc$library_include:
104*75fd0b74Schristos$     endif
105*75fd0b74Schristos$   endif
106*75fd0b74Schristos$!
107*75fd0b74Schristos$! 2012-03-05 SMS.
108*75fd0b74Schristos$! Why /NAMES = AS_IS?  Why not simply ".not. vax"?  And why not on VAX?
109*75fd0b74Schristos$!
110*75fd0b74Schristos$   if axp .or. ia64
111*75fd0b74Schristos$   then
112*75fd0b74Schristos$       ccopt = ccopt + "/name=as_is/opt=(inline=speed)"
113*75fd0b74Schristos$       s_case = true
114*75fd0b74Schristos$   endif
115*75fd0b74Schristos$ endif
116*75fd0b74Schristos$ if its_vaxc .or. its_gnuc
117*75fd0b74Schristos$ then
118*75fd0b74Schristos$    if f$trnlnm("SYS").eqs."" then define sys sys$library:
119*75fd0b74Schristos$ endif
120*75fd0b74Schristos$!
121*75fd0b74Schristos$! Build a fake configure input header
122*75fd0b74Schristos$!
123*75fd0b74Schristos$ open/write conf_hin config.hin
124*75fd0b74Schristos$ write conf_hin "#undef _LARGEFILE64_SOURCE"
125*75fd0b74Schristos$ close conf_hin
126*75fd0b74Schristos$!
127*75fd0b74Schristos$!
128*75fd0b74Schristos$ i = 0
129*75fd0b74Schristos$FIND_ACONF:
130*75fd0b74Schristos$ fname = f$element(i,"#",aconf_in_file)
131*75fd0b74Schristos$ if fname .eqs. "#" then goto AMISS_ERR
132*75fd0b74Schristos$ if f$search(fname) .eqs. ""
133*75fd0b74Schristos$ then
134*75fd0b74Schristos$   i = i + 1
135*75fd0b74Schristos$   goto find_aconf
136*75fd0b74Schristos$ endif
137*75fd0b74Schristos$ open/read/err=aconf_err aconf_in 'fname'
138*75fd0b74Schristos$ open/write aconf zconf.h
139*75fd0b74Schristos$ACONF_LOOP:
140*75fd0b74Schristos$ read/end_of_file=aconf_exit aconf_in line
141*75fd0b74Schristos$ work = f$edit(line, "compress,trim")
142*75fd0b74Schristos$ if f$extract(0,6,work) .nes. "#undef"
143*75fd0b74Schristos$ then
144*75fd0b74Schristos$   if f$extract(0,12,work) .nes. "#cmakedefine"
145*75fd0b74Schristos$   then
146*75fd0b74Schristos$       write aconf line
147*75fd0b74Schristos$   endif
148*75fd0b74Schristos$ else
149*75fd0b74Schristos$   cdef = f$element(1," ",work)
150*75fd0b74Schristos$   gosub check_config
151*75fd0b74Schristos$ endif
152*75fd0b74Schristos$ goto aconf_loop
153*75fd0b74Schristos$ACONF_EXIT:
154*75fd0b74Schristos$ write aconf ""
155*75fd0b74Schristos$ write aconf "/* VMS specifics added by make_vms.com: */"
156*75fd0b74Schristos$ write aconf "#define VMS 1"
157*75fd0b74Schristos$ write aconf "#include <unistd.h>"
158*75fd0b74Schristos$ write aconf "#include <unixio.h>"
159*75fd0b74Schristos$ write aconf "#ifdef _LARGEFILE"
160*75fd0b74Schristos$ write aconf "# define off64_t __off64_t"
161*75fd0b74Schristos$ write aconf "# define fopen64 fopen"
162*75fd0b74Schristos$ write aconf "# define fseeko64 fseeko"
163*75fd0b74Schristos$ write aconf "# define lseek64 lseek"
164*75fd0b74Schristos$ write aconf "# define ftello64 ftell"
165*75fd0b74Schristos$ write aconf "#endif"
166*75fd0b74Schristos$ write aconf "#if !defined( __VAX) && (__CRTL_VER >= 70312000)"
167*75fd0b74Schristos$ write aconf "# define HAVE_VSNPRINTF"
168*75fd0b74Schristos$ write aconf "#endif"
169*75fd0b74Schristos$ close aconf_in
170*75fd0b74Schristos$ close aconf
171*75fd0b74Schristos$ if f$search("''th'") .nes. "" then delete 'th';*
172*75fd0b74Schristos$! Build the thing plain or with mms
173*75fd0b74Schristos$!
174*75fd0b74Schristos$ write sys$output "Compiling Zlib sources ..."
175*75fd0b74Schristos$ if make.eqs.""
176*75fd0b74Schristos$ then
177*75fd0b74Schristos$   if (f$search( "example.obj;*") .nes. "") then delete example.obj;*
178*75fd0b74Schristos$   if (f$search( "minigzip.obj;*") .nes. "") then delete minigzip.obj;*
179*75fd0b74Schristos$   CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" -
180*75fd0b74Schristos                adler32.c zlib.h zconf.h
181*75fd0b74Schristos$   CALL MAKE compress.OBJ "CC ''CCOPT' compress" -
182*75fd0b74Schristos                compress.c zlib.h zconf.h
183*75fd0b74Schristos$   CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" -
184*75fd0b74Schristos                crc32.c zlib.h zconf.h
185*75fd0b74Schristos$   CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" -
186*75fd0b74Schristos                deflate.c deflate.h zutil.h zlib.h zconf.h
187*75fd0b74Schristos$   CALL MAKE gzclose.OBJ "CC ''CCOPT' gzclose" -
188*75fd0b74Schristos                gzclose.c zutil.h zlib.h zconf.h
189*75fd0b74Schristos$   CALL MAKE gzlib.OBJ "CC ''CCOPT' gzlib" -
190*75fd0b74Schristos                gzlib.c zutil.h zlib.h zconf.h
191*75fd0b74Schristos$   CALL MAKE gzread.OBJ "CC ''CCOPT' gzread" -
192*75fd0b74Schristos                gzread.c zutil.h zlib.h zconf.h
193*75fd0b74Schristos$   CALL MAKE gzwrite.OBJ "CC ''CCOPT' gzwrite" -
194*75fd0b74Schristos                gzwrite.c zutil.h zlib.h zconf.h
195*75fd0b74Schristos$   CALL MAKE infback.OBJ "CC ''CCOPT' infback" -
196*75fd0b74Schristos                infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
197*75fd0b74Schristos$   CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" -
198*75fd0b74Schristos                inffast.c zutil.h zlib.h zconf.h inffast.h
199*75fd0b74Schristos$   CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" -
200*75fd0b74Schristos                inflate.c zutil.h zlib.h zconf.h infblock.h
201*75fd0b74Schristos$   CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" -
202*75fd0b74Schristos                inftrees.c zutil.h zlib.h zconf.h inftrees.h
203*75fd0b74Schristos$   CALL MAKE trees.OBJ "CC ''CCOPT' trees" -
204*75fd0b74Schristos                trees.c deflate.h zutil.h zlib.h zconf.h
205*75fd0b74Schristos$   CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" -
206*75fd0b74Schristos                uncompr.c zlib.h zconf.h
207*75fd0b74Schristos$   CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" -
208*75fd0b74Schristos                zutil.c zutil.h zlib.h zconf.h
209*75fd0b74Schristos$   write sys$output "Building Zlib ..."
210*75fd0b74Schristos$   CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ
211*75fd0b74Schristos$   write sys$output "Building example..."
212*75fd0b74Schristos$   CALL MAKE example.OBJ "CC ''CCOPT' [.test]example" -
213*75fd0b74Schristos                [.test]example.c zlib.h zconf.h
214*75fd0b74Schristos$   call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb
215*75fd0b74Schristos$   write sys$output "Building minigzip..."
216*75fd0b74Schristos$   CALL MAKE minigzip.OBJ "CC ''CCOPT' [.test]minigzip" -
217*75fd0b74Schristos              [.test]minigzip.c zlib.h zconf.h
218*75fd0b74Schristos$   call make minigzip.exe -
219*75fd0b74Schristos              "LINK minigzip,libz.olb/lib" -
220*75fd0b74Schristos              minigzip.obj libz.olb
221*75fd0b74Schristos$ else
222*75fd0b74Schristos$   gosub crea_mms
223*75fd0b74Schristos$   write sys$output "Make ''name' ''version' with ''Make' "
224*75fd0b74Schristos$   'make'
225*75fd0b74Schristos$ endif
226*75fd0b74Schristos$!
227*75fd0b74Schristos$! Create shareable image
228*75fd0b74Schristos$!
229*75fd0b74Schristos$ gosub crea_olist
230*75fd0b74Schristos$ write sys$output "Creating libzshr.exe"
231*75fd0b74Schristos$ call map_2_shopt 'mapfile' 'optfile'
232*75fd0b74Schristos$ LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,'optfile'/opt
233*75fd0b74Schristos$ write sys$output "Zlib build completed"
234*75fd0b74Schristos$ delete/nolog tmp.opt;*
235*75fd0b74Schristos$ exit
236*75fd0b74Schristos$AMISS_ERR:
237*75fd0b74Schristos$ write sys$output "No source for config.hin found."
238*75fd0b74Schristos$ write sys$output "Tried any of ''aconf_in_file'"
239*75fd0b74Schristos$ goto err_exit
240*75fd0b74Schristos$CC_ERR:
241*75fd0b74Schristos$ write sys$output "C compiler required to build ''name'"
242*75fd0b74Schristos$ goto err_exit
243*75fd0b74Schristos$ERR_EXIT:
244*75fd0b74Schristos$ set message/facil/ident/sever/text
245*75fd0b74Schristos$ close/nolog optf
246*75fd0b74Schristos$ close/nolog topt
247*75fd0b74Schristos$ close/nolog aconf_in
248*75fd0b74Schristos$ close/nolog aconf
249*75fd0b74Schristos$ close/nolog out
250*75fd0b74Schristos$ close/nolog min
251*75fd0b74Schristos$ close/nolog mod
252*75fd0b74Schristos$ close/nolog h_in
253*75fd0b74Schristos$ write sys$output "Exiting..."
254*75fd0b74Schristos$ exit 2
255*75fd0b74Schristos$!
256*75fd0b74Schristos$!
257*75fd0b74Schristos$MAKE: SUBROUTINE   !SUBROUTINE TO CHECK DEPENDENCIES
258*75fd0b74Schristos$ V = 'F$Verify(0)
259*75fd0b74Schristos$! P1 = What we are trying to make
260*75fd0b74Schristos$! P2 = Command to make it
261*75fd0b74Schristos$! P3 - P8  What it depends on
262*75fd0b74Schristos$
263*75fd0b74Schristos$ If F$Search(P1) .Eqs. "" Then Goto Makeit
264*75fd0b74Schristos$ Time = F$CvTime(F$File(P1,"RDT"))
265*75fd0b74Schristos$arg=3
266*75fd0b74Schristos$Loop:
267*75fd0b74Schristos$       Argument = P'arg
268*75fd0b74Schristos$       If Argument .Eqs. "" Then Goto Exit
269*75fd0b74Schristos$       El=0
270*75fd0b74Schristos$Loop2:
271*75fd0b74Schristos$       File = F$Element(El," ",Argument)
272*75fd0b74Schristos$       If File .Eqs. " " Then Goto Endl
273*75fd0b74Schristos$       AFile = ""
274*75fd0b74Schristos$Loop3:
275*75fd0b74Schristos$       OFile = AFile
276*75fd0b74Schristos$       AFile = F$Search(File)
277*75fd0b74Schristos$       If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl
278*75fd0b74Schristos$       If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit
279*75fd0b74Schristos$       Goto Loop3
280*75fd0b74Schristos$NextEL:
281*75fd0b74Schristos$       El = El + 1
282*75fd0b74Schristos$       Goto Loop2
283*75fd0b74Schristos$EndL:
284*75fd0b74Schristos$ arg=arg+1
285*75fd0b74Schristos$ If arg .Le. 8 Then Goto Loop
286*75fd0b74Schristos$ Goto Exit
287*75fd0b74Schristos$
288*75fd0b74Schristos$Makeit:
289*75fd0b74Schristos$ VV=F$VERIFY(0)
290*75fd0b74Schristos$ write sys$output P2
291*75fd0b74Schristos$ 'P2
292*75fd0b74Schristos$ VV='F$Verify(VV)
293*75fd0b74Schristos$Exit:
294*75fd0b74Schristos$ If V Then Set Verify
295*75fd0b74Schristos$ENDSUBROUTINE
296*75fd0b74Schristos$!------------------------------------------------------------------------------
297*75fd0b74Schristos$!
298*75fd0b74Schristos$! Check command line options and set symbols accordingly
299*75fd0b74Schristos$!
300*75fd0b74Schristos$!------------------------------------------------------------------------------
301*75fd0b74Schristos$! Version history
302*75fd0b74Schristos$! 0.01 20041206 First version to receive a number
303*75fd0b74Schristos$! 0.02 20060126 Add new "HELP" target
304*75fd0b74Schristos$ CHECK_OPTS:
305*75fd0b74Schristos$ i = 1
306*75fd0b74Schristos$ OPT_LOOP:
307*75fd0b74Schristos$ if i .lt. 9
308*75fd0b74Schristos$ then
309*75fd0b74Schristos$   cparm = f$edit(p'i',"upcase")
310*75fd0b74Schristos$!
311*75fd0b74Schristos$! Check if parameter actually contains something
312*75fd0b74Schristos$!
313*75fd0b74Schristos$   if f$edit(cparm,"trim") .nes. ""
314*75fd0b74Schristos$   then
315*75fd0b74Schristos$     if cparm .eqs. "DEBUG"
316*75fd0b74Schristos$     then
317*75fd0b74Schristos$       ccopt = ccopt + "/noopt/deb"
318*75fd0b74Schristos$       lopts = lopts + "/deb"
319*75fd0b74Schristos$     endif
320*75fd0b74Schristos$     if f$locate("CCOPT=",cparm) .lt. f$length(cparm)
321*75fd0b74Schristos$     then
322*75fd0b74Schristos$       start = f$locate("=",cparm) + 1
323*75fd0b74Schristos$       len   = f$length(cparm) - start
324*75fd0b74Schristos$       ccopt = ccopt + f$extract(start,len,cparm)
325*75fd0b74Schristos$       if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) -
326*75fd0b74Schristos          then s_case = true
327*75fd0b74Schristos$     endif
328*75fd0b74Schristos$     if cparm .eqs. "LINK" then linkonly = true
329*75fd0b74Schristos$     if f$locate("LOPTS=",cparm) .lt. f$length(cparm)
330*75fd0b74Schristos$     then
331*75fd0b74Schristos$       start = f$locate("=",cparm) + 1
332*75fd0b74Schristos$       len   = f$length(cparm) - start
333*75fd0b74Schristos$       lopts = lopts + f$extract(start,len,cparm)
334*75fd0b74Schristos$     endif
335*75fd0b74Schristos$     if f$locate("CC=",cparm) .lt. f$length(cparm)
336*75fd0b74Schristos$     then
337*75fd0b74Schristos$       start  = f$locate("=",cparm) + 1
338*75fd0b74Schristos$       len    = f$length(cparm) - start
339*75fd0b74Schristos$       cc_com = f$extract(start,len,cparm)
340*75fd0b74Schristos        if (cc_com .nes. "DECC") .and. -
341*75fd0b74Schristos           (cc_com .nes. "VAXC") .and. -
342*75fd0b74Schristos           (cc_com .nes. "GNUC")
343*75fd0b74Schristos$       then
344*75fd0b74Schristos$         write sys$output "Unsupported compiler choice ''cc_com' ignored"
345*75fd0b74Schristos$         write sys$output "Use DECC, VAXC, or GNUC instead"
346*75fd0b74Schristos$       else
347*75fd0b74Schristos$         if cc_com .eqs. "DECC" then its_decc = true
348*75fd0b74Schristos$         if cc_com .eqs. "VAXC" then its_vaxc = true
349*75fd0b74Schristos$         if cc_com .eqs. "GNUC" then its_gnuc = true
350*75fd0b74Schristos$       endif
351*75fd0b74Schristos$     endif
352*75fd0b74Schristos$     if f$locate("MAKE=",cparm) .lt. f$length(cparm)
353*75fd0b74Schristos$     then
354*75fd0b74Schristos$       start  = f$locate("=",cparm) + 1
355*75fd0b74Schristos$       len    = f$length(cparm) - start
356*75fd0b74Schristos$       mmks = f$extract(start,len,cparm)
357*75fd0b74Schristos$       if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS")
358*75fd0b74Schristos$       then
359*75fd0b74Schristos$         make = mmks
360*75fd0b74Schristos$       else
361*75fd0b74Schristos$         write sys$output "Unsupported make choice ''mmks' ignored"
362*75fd0b74Schristos$         write sys$output "Use MMK or MMS instead"
363*75fd0b74Schristos$       endif
364*75fd0b74Schristos$     endif
365*75fd0b74Schristos$     if cparm .eqs. "HELP" then gosub bhelp
366*75fd0b74Schristos$   endif
367*75fd0b74Schristos$   i = i + 1
368*75fd0b74Schristos$   goto opt_loop
369*75fd0b74Schristos$ endif
370*75fd0b74Schristos$ return
371*75fd0b74Schristos$!------------------------------------------------------------------------------
372*75fd0b74Schristos$!
373*75fd0b74Schristos$! Look for the compiler used
374*75fd0b74Schristos$!
375*75fd0b74Schristos$! Version history
376*75fd0b74Schristos$! 0.01 20040223 First version to receive a number
377*75fd0b74Schristos$! 0.02 20040229 Save/set value of decc$no_rooted_search_lists
378*75fd0b74Schristos$! 0.03 20060202 Extend handling of GNU C
379*75fd0b74Schristos$! 0.04 20090402 Compaq -> hp
380*75fd0b74Schristos$CHECK_COMPILER:
381*75fd0b74Schristos$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
382*75fd0b74Schristos$ then
383*75fd0b74Schristos$   its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "")
384*75fd0b74Schristos$   its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "")
385*75fd0b74Schristos$   its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "")
386*75fd0b74Schristos$ endif
387*75fd0b74Schristos$!
388*75fd0b74Schristos$! Exit if no compiler available
389*75fd0b74Schristos$!
390*75fd0b74Schristos$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc))
391*75fd0b74Schristos$ then goto CC_ERR
392*75fd0b74Schristos$ else
393*75fd0b74Schristos$   if its_decc
394*75fd0b74Schristos$   then
395*75fd0b74Schristos$     write sys$output "CC compiler check ... hp C"
396*75fd0b74Schristos$     if f$trnlnm("decc$no_rooted_search_lists") .nes. ""
397*75fd0b74Schristos$     then
398*75fd0b74Schristos$       dnrsl = f$trnlnm("decc$no_rooted_search_lists")
399*75fd0b74Schristos$     endif
400*75fd0b74Schristos$     define/nolog decc$no_rooted_search_lists 1
401*75fd0b74Schristos$   else
402*75fd0b74Schristos$     if its_vaxc then write sys$output "CC compiler check ... VAX C"
403*75fd0b74Schristos$     if its_gnuc
404*75fd0b74Schristos$     then
405*75fd0b74Schristos$         write sys$output "CC compiler check ... GNU C"
406*75fd0b74Schristos$         if f$trnlnm(topt) then write topt "gnu_cc:[000000]gcclib.olb/lib"
407*75fd0b74Schristos$         if f$trnlnm(optf) then write optf "gnu_cc:[000000]gcclib.olb/lib"
408*75fd0b74Schristos$         cc = "gcc"
409*75fd0b74Schristos$     endif
410*75fd0b74Schristos$     if f$trnlnm(topt) then write topt "sys$share:vaxcrtl.exe/share"
411*75fd0b74Schristos$     if f$trnlnm(optf) then write optf "sys$share:vaxcrtl.exe/share"
412*75fd0b74Schristos$   endif
413*75fd0b74Schristos$ endif
414*75fd0b74Schristos$ return
415*75fd0b74Schristos$!------------------------------------------------------------------------------
416*75fd0b74Schristos$!
417*75fd0b74Schristos$! If MMS/MMK are available dump out the descrip.mms if required
418*75fd0b74Schristos$!
419*75fd0b74Schristos$CREA_MMS:
420*75fd0b74Schristos$ write sys$output "Creating descrip.mms..."
421*75fd0b74Schristos$ create descrip.mms
422*75fd0b74Schristos$ open/append out descrip.mms
423*75fd0b74Schristos$ copy sys$input: out
424*75fd0b74Schristos$ deck
425*75fd0b74Schristos# descrip.mms: MMS description file for building zlib on VMS
426*75fd0b74Schristos# written by Martin P.J. Zinser
427*75fd0b74Schristos# <zinser@zinser.no-ip.info or martin.zinser@eurexchange.com>
428*75fd0b74Schristos
429*75fd0b74SchristosOBJS = adler32.obj, compress.obj, crc32.obj, gzclose.obj, gzlib.obj\
430*75fd0b74Schristos       gzread.obj, gzwrite.obj, uncompr.obj, infback.obj\
431*75fd0b74Schristos       deflate.obj, trees.obj, zutil.obj, inflate.obj, \
432*75fd0b74Schristos       inftrees.obj, inffast.obj
433*75fd0b74Schristos
434*75fd0b74Schristos$ eod
435*75fd0b74Schristos$ write out "CFLAGS=", ccopt
436*75fd0b74Schristos$ write out "LOPTS=", lopts
437*75fd0b74Schristos$ write out "all : example.exe minigzip.exe libz.olb"
438*75fd0b74Schristos$ copy sys$input: out
439*75fd0b74Schristos$ deck
440*75fd0b74Schristos        @ write sys$output " Example applications available"
441*75fd0b74Schristos
442*75fd0b74Schristoslibz.olb : libz.olb($(OBJS))
443*75fd0b74Schristos	@ write sys$output " libz available"
444*75fd0b74Schristos
445*75fd0b74Schristosexample.exe : example.obj libz.olb
446*75fd0b74Schristos              link $(LOPTS) example,libz.olb/lib
447*75fd0b74Schristos
448*75fd0b74Schristosminigzip.exe : minigzip.obj libz.olb
449*75fd0b74Schristos              link $(LOPTS) minigzip,libz.olb/lib
450*75fd0b74Schristos
451*75fd0b74Schristosclean :
452*75fd0b74Schristos	delete *.obj;*,libz.olb;*,*.opt;*,*.exe;*
453*75fd0b74Schristos
454*75fd0b74Schristos
455*75fd0b74Schristos# Other dependencies.
456*75fd0b74Schristosadler32.obj  : adler32.c zutil.h zlib.h zconf.h
457*75fd0b74Schristoscompress.obj : compress.c zlib.h zconf.h
458*75fd0b74Schristoscrc32.obj    : crc32.c zutil.h zlib.h zconf.h
459*75fd0b74Schristosdeflate.obj  : deflate.c deflate.h zutil.h zlib.h zconf.h
460*75fd0b74Schristosexample.obj  : [.test]example.c zlib.h zconf.h
461*75fd0b74Schristosgzclose.obj  : gzclose.c zutil.h zlib.h zconf.h
462*75fd0b74Schristosgzlib.obj    : gzlib.c zutil.h zlib.h zconf.h
463*75fd0b74Schristosgzread.obj   : gzread.c zutil.h zlib.h zconf.h
464*75fd0b74Schristosgzwrite.obj  : gzwrite.c zutil.h zlib.h zconf.h
465*75fd0b74Schristosinffast.obj  : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h
466*75fd0b74Schristosinflate.obj  : inflate.c zutil.h zlib.h zconf.h
467*75fd0b74Schristosinftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h
468*75fd0b74Schristosminigzip.obj : [.test]minigzip.c zlib.h zconf.h
469*75fd0b74Schristostrees.obj    : trees.c deflate.h zutil.h zlib.h zconf.h
470*75fd0b74Schristosuncompr.obj  : uncompr.c zlib.h zconf.h
471*75fd0b74Schristoszutil.obj    : zutil.c zutil.h zlib.h zconf.h
472*75fd0b74Schristosinfback.obj  : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h
473*75fd0b74Schristos$ eod
474*75fd0b74Schristos$ close out
475*75fd0b74Schristos$ return
476*75fd0b74Schristos$!------------------------------------------------------------------------------
477*75fd0b74Schristos$!
478*75fd0b74Schristos$! Read list of core library sources from makefile.in and create options
479*75fd0b74Schristos$! needed to build shareable image
480*75fd0b74Schristos$!
481*75fd0b74Schristos$CREA_OLIST:
482*75fd0b74Schristos$ open/read min makefile.in
483*75fd0b74Schristos$ open/write mod modules.opt
484*75fd0b74Schristos$ src_check_list = "OBJZ =#OBJG ="
485*75fd0b74Schristos$MRLOOP:
486*75fd0b74Schristos$ read/end=mrdone min rec
487*75fd0b74Schristos$ i = 0
488*75fd0b74Schristos$SRC_CHECK_LOOP:
489*75fd0b74Schristos$ src_check = f$element(i, "#", src_check_list)
490*75fd0b74Schristos$ i = i+1
491*75fd0b74Schristos$ if src_check .eqs. "#" then goto mrloop
492*75fd0b74Schristos$ if (f$extract(0,6,rec) .nes. src_check) then goto src_check_loop
493*75fd0b74Schristos$ rec = rec - src_check
494*75fd0b74Schristos$ gosub extra_filnam
495*75fd0b74Schristos$ if (f$element(1,"\",rec) .eqs. "\") then goto mrloop
496*75fd0b74Schristos$MRSLOOP:
497*75fd0b74Schristos$ read/end=mrdone min rec
498*75fd0b74Schristos$ gosub extra_filnam
499*75fd0b74Schristos$ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop
500*75fd0b74Schristos$MRDONE:
501*75fd0b74Schristos$ close min
502*75fd0b74Schristos$ close mod
503*75fd0b74Schristos$ return
504*75fd0b74Schristos$!------------------------------------------------------------------------------
505*75fd0b74Schristos$!
506*75fd0b74Schristos$! Take record extracted in crea_olist and split it into single filenames
507*75fd0b74Schristos$!
508*75fd0b74Schristos$EXTRA_FILNAM:
509*75fd0b74Schristos$ myrec = f$edit(rec - "\", "trim,compress")
510*75fd0b74Schristos$ i = 0
511*75fd0b74Schristos$FELOOP:
512*75fd0b74Schristos$ srcfil = f$element(i," ", myrec)
513*75fd0b74Schristos$ if (srcfil .nes. " ")
514*75fd0b74Schristos$ then
515*75fd0b74Schristos$   write mod f$parse(srcfil,,,"NAME"), ".obj"
516*75fd0b74Schristos$   i = i + 1
517*75fd0b74Schristos$   goto feloop
518*75fd0b74Schristos$ endif
519*75fd0b74Schristos$ return
520*75fd0b74Schristos$!------------------------------------------------------------------------------
521*75fd0b74Schristos$!
522*75fd0b74Schristos$! Find current Zlib version number
523*75fd0b74Schristos$!
524*75fd0b74Schristos$FIND_VERSION:
525*75fd0b74Schristos$ open/read h_in 'v_file'
526*75fd0b74Schristos$hloop:
527*75fd0b74Schristos$ read/end=hdone h_in rec
528*75fd0b74Schristos$ rec = f$edit(rec,"TRIM")
529*75fd0b74Schristos$ if (f$extract(0,1,rec) .nes. "#") then goto hloop
530*75fd0b74Schristos$ rec = f$edit(rec - "#", "TRIM")
531*75fd0b74Schristos$ if f$element(0," ",rec) .nes. "define" then goto hloop
532*75fd0b74Schristos$ if f$element(1," ",rec) .eqs. v_string
533*75fd0b74Schristos$ then
534*75fd0b74Schristos$   version = 'f$element(2," ",rec)'
535*75fd0b74Schristos$   goto hdone
536*75fd0b74Schristos$ endif
537*75fd0b74Schristos$ goto hloop
538*75fd0b74Schristos$hdone:
539*75fd0b74Schristos$ close h_in
540*75fd0b74Schristos$ return
541*75fd0b74Schristos$!------------------------------------------------------------------------------
542*75fd0b74Schristos$!
543*75fd0b74Schristos$CHECK_CONFIG:
544*75fd0b74Schristos$!
545*75fd0b74Schristos$ in_ldef = f$locate(cdef,libdefs)
546*75fd0b74Schristos$ if (in_ldef .lt. f$length(libdefs))
547*75fd0b74Schristos$ then
548*75fd0b74Schristos$   write aconf "#define ''cdef' 1"
549*75fd0b74Schristos$   libdefs = f$extract(0,in_ldef,libdefs) + -
550*75fd0b74Schristos              f$extract(in_ldef + f$length(cdef) + 1, -
551*75fd0b74Schristos                        f$length(libdefs) - in_ldef - f$length(cdef) - 1, -
552*75fd0b74Schristos                        libdefs)
553*75fd0b74Schristos$ else
554*75fd0b74Schristos$   if (f$type('cdef') .eqs. "INTEGER")
555*75fd0b74Schristos$   then
556*75fd0b74Schristos$     write aconf "#define ''cdef' ", 'cdef'
557*75fd0b74Schristos$   else
558*75fd0b74Schristos$     if (f$type('cdef') .eqs. "STRING")
559*75fd0b74Schristos$     then
560*75fd0b74Schristos$       write aconf "#define ''cdef' ", """", '''cdef'', """"
561*75fd0b74Schristos$     else
562*75fd0b74Schristos$       gosub check_cc_def
563*75fd0b74Schristos$     endif
564*75fd0b74Schristos$   endif
565*75fd0b74Schristos$ endif
566*75fd0b74Schristos$ return
567*75fd0b74Schristos$!------------------------------------------------------------------------------
568*75fd0b74Schristos$!
569*75fd0b74Schristos$! Check if this is a define relating to the properties of the C/C++
570*75fd0b74Schristos$! compiler
571*75fd0b74Schristos$!
572*75fd0b74Schristos$ CHECK_CC_DEF:
573*75fd0b74Schristos$ if (cdef .eqs. "_LARGEFILE64_SOURCE")
574*75fd0b74Schristos$ then
575*75fd0b74Schristos$   copy sys$input: 'tc'
576*75fd0b74Schristos$   deck
577*75fd0b74Schristos#include "tconfig"
578*75fd0b74Schristos#define _LARGEFILE
579*75fd0b74Schristos#include <stdio.h>
580*75fd0b74Schristos
581*75fd0b74Schristosint main(){
582*75fd0b74SchristosFILE *fp;
583*75fd0b74Schristos  fp = fopen("temp.txt","r");
584*75fd0b74Schristos  fseeko(fp,1,SEEK_SET);
585*75fd0b74Schristos  fclose(fp);
586*75fd0b74Schristos}
587*75fd0b74Schristos
588*75fd0b74Schristos$   eod
589*75fd0b74Schristos$   test_inv = false
590*75fd0b74Schristos$   comm_h = false
591*75fd0b74Schristos$   gosub cc_prop_check
592*75fd0b74Schristos$   return
593*75fd0b74Schristos$ endif
594*75fd0b74Schristos$ write aconf "/* ", line, " */"
595*75fd0b74Schristos$ return
596*75fd0b74Schristos$!------------------------------------------------------------------------------
597*75fd0b74Schristos$!
598*75fd0b74Schristos$! Check for properties of C/C++ compiler
599*75fd0b74Schristos$!
600*75fd0b74Schristos$! Version history
601*75fd0b74Schristos$! 0.01 20031020 First version to receive a number
602*75fd0b74Schristos$! 0.02 20031022 Added logic for defines with value
603*75fd0b74Schristos$! 0.03 20040309 Make sure local config file gets not deleted
604*75fd0b74Schristos$! 0.04 20041230 Also write include for configure run
605*75fd0b74Schristos$! 0.05 20050103 Add processing of "comment defines"
606*75fd0b74Schristos$CC_PROP_CHECK:
607*75fd0b74Schristos$ cc_prop = true
608*75fd0b74Schristos$ is_need = false
609*75fd0b74Schristos$ is_need = (f$extract(0,4,cdef) .eqs. "NEED") .or. (test_inv .eq. true)
610*75fd0b74Schristos$ if f$search(th) .eqs. "" then create 'th'
611*75fd0b74Schristos$ set message/nofac/noident/nosever/notext
612*75fd0b74Schristos$ on error then continue
613*75fd0b74Schristos$ cc 'tmpnam'
614*75fd0b74Schristos$ if .not. ($status)  then cc_prop = false
615*75fd0b74Schristos$ on error then continue
616*75fd0b74Schristos$! The headers might lie about the capabilities of the RTL
617*75fd0b74Schristos$ link 'tmpnam',tmp.opt/opt
618*75fd0b74Schristos$ if .not. ($status)  then cc_prop = false
619*75fd0b74Schristos$ set message/fac/ident/sever/text
620*75fd0b74Schristos$ on error then goto err_exit
621*75fd0b74Schristos$ delete/nolog 'tmpnam'.*;*/exclude='th'
622*75fd0b74Schristos$ if (cc_prop .and. .not. is_need) .or. -
623*75fd0b74Schristos     (.not. cc_prop .and. is_need)
624*75fd0b74Schristos$ then
625*75fd0b74Schristos$   write sys$output "Checking for ''cdef'... yes"
626*75fd0b74Schristos$   if f$type('cdef_val'_yes) .nes. ""
627*75fd0b74Schristos$   then
628*75fd0b74Schristos$     if f$type('cdef_val'_yes) .eqs. "INTEGER" -
629*75fd0b74Schristos         then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_yes)
630*75fd0b74Schristos$     if f$type('cdef_val'_yes) .eqs. "STRING" -
631*75fd0b74Schristos         then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_yes)
632*75fd0b74Schristos$   else
633*75fd0b74Schristos$     call write_config f$fao("#define !AS 1",cdef)
634*75fd0b74Schristos$   endif
635*75fd0b74Schristos$   if (cdef .eqs. "HAVE_FSEEKO") .or. (cdef .eqs. "_LARGE_FILES") .or. -
636*75fd0b74Schristos       (cdef .eqs. "_LARGEFILE64_SOURCE") then -
637*75fd0b74Schristos      call write_config f$string("#define _LARGEFILE 1")
638*75fd0b74Schristos$ else
639*75fd0b74Schristos$   write sys$output "Checking for ''cdef'... no"
640*75fd0b74Schristos$   if (comm_h)
641*75fd0b74Schristos$   then
642*75fd0b74Schristos      call write_config f$fao("/* !AS */",line)
643*75fd0b74Schristos$   else
644*75fd0b74Schristos$     if f$type('cdef_val'_no) .nes. ""
645*75fd0b74Schristos$     then
646*75fd0b74Schristos$       if f$type('cdef_val'_no) .eqs. "INTEGER" -
647*75fd0b74Schristos           then call write_config f$fao("#define !AS !UL",cdef,'cdef_val'_no)
648*75fd0b74Schristos$       if f$type('cdef_val'_no) .eqs. "STRING" -
649*75fd0b74Schristos           then call write_config f$fao("#define !AS !AS",cdef,'cdef_val'_no)
650*75fd0b74Schristos$     else
651*75fd0b74Schristos$       call write_config f$fao("#undef !AS",cdef)
652*75fd0b74Schristos$     endif
653*75fd0b74Schristos$   endif
654*75fd0b74Schristos$ endif
655*75fd0b74Schristos$ return
656*75fd0b74Schristos$!------------------------------------------------------------------------------
657*75fd0b74Schristos$!
658*75fd0b74Schristos$! Check for properties of C/C++ compiler with multiple result values
659*75fd0b74Schristos$!
660*75fd0b74Schristos$! Version history
661*75fd0b74Schristos$! 0.01 20040127 First version
662*75fd0b74Schristos$! 0.02 20050103 Reconcile changes from cc_prop up to version 0.05
663*75fd0b74Schristos$CC_MPROP_CHECK:
664*75fd0b74Schristos$ cc_prop = true
665*75fd0b74Schristos$ i    = 1
666*75fd0b74Schristos$ idel = 1
667*75fd0b74Schristos$ MT_LOOP:
668*75fd0b74Schristos$ if f$type(result_'i') .eqs. "STRING"
669*75fd0b74Schristos$ then
670*75fd0b74Schristos$   set message/nofac/noident/nosever/notext
671*75fd0b74Schristos$   on error then continue
672*75fd0b74Schristos$   cc 'tmpnam'_'i'
673*75fd0b74Schristos$   if .not. ($status)  then cc_prop = false
674*75fd0b74Schristos$   on error then continue
675*75fd0b74Schristos$! The headers might lie about the capabilities of the RTL
676*75fd0b74Schristos$   link 'tmpnam'_'i',tmp.opt/opt
677*75fd0b74Schristos$   if .not. ($status)  then cc_prop = false
678*75fd0b74Schristos$   set message/fac/ident/sever/text
679*75fd0b74Schristos$   on error then goto err_exit
680*75fd0b74Schristos$   delete/nolog 'tmpnam'_'i'.*;*
681*75fd0b74Schristos$   if (cc_prop)
682*75fd0b74Schristos$   then
683*75fd0b74Schristos$     write sys$output "Checking for ''cdef'... ", mdef_'i'
684*75fd0b74Schristos$     if f$type(mdef_'i') .eqs. "INTEGER" -
685*75fd0b74Schristos         then call write_config f$fao("#define !AS !UL",cdef,mdef_'i')
686*75fd0b74Schristos$     if f$type('cdef_val'_yes) .eqs. "STRING" -
687*75fd0b74Schristos         then call write_config f$fao("#define !AS !AS",cdef,mdef_'i')
688*75fd0b74Schristos$     goto msym_clean
689*75fd0b74Schristos$   else
690*75fd0b74Schristos$     i = i + 1
691*75fd0b74Schristos$     goto mt_loop
692*75fd0b74Schristos$   endif
693*75fd0b74Schristos$ endif
694*75fd0b74Schristos$ write sys$output "Checking for ''cdef'... no"
695*75fd0b74Schristos$ call write_config f$fao("#undef !AS",cdef)
696*75fd0b74Schristos$ MSYM_CLEAN:
697*75fd0b74Schristos$ if (idel .le. msym_max)
698*75fd0b74Schristos$ then
699*75fd0b74Schristos$   delete/sym mdef_'idel'
700*75fd0b74Schristos$   idel = idel + 1
701*75fd0b74Schristos$   goto msym_clean
702*75fd0b74Schristos$ endif
703*75fd0b74Schristos$ return
704*75fd0b74Schristos$!------------------------------------------------------------------------------
705*75fd0b74Schristos$!
706*75fd0b74Schristos$! Write configuration to both permanent and temporary config file
707*75fd0b74Schristos$!
708*75fd0b74Schristos$! Version history
709*75fd0b74Schristos$! 0.01 20031029 First version to receive a number
710*75fd0b74Schristos$!
711*75fd0b74Schristos$WRITE_CONFIG: SUBROUTINE
712*75fd0b74Schristos$  write aconf 'p1'
713*75fd0b74Schristos$  open/append confh 'th'
714*75fd0b74Schristos$  write confh 'p1'
715*75fd0b74Schristos$  close confh
716*75fd0b74Schristos$ENDSUBROUTINE
717*75fd0b74Schristos$!------------------------------------------------------------------------------
718*75fd0b74Schristos$!
719*75fd0b74Schristos$! Analyze the project map file and create the symbol vector for a shareable
720*75fd0b74Schristos$! image from it
721*75fd0b74Schristos$!
722*75fd0b74Schristos$! Version history
723*75fd0b74Schristos$! 0.01 20120128 First version
724*75fd0b74Schristos$! 0.02 20120226 Add pre-load logic
725*75fd0b74Schristos$!
726*75fd0b74Schristos$ MAP_2_SHOPT: Subroutine
727*75fd0b74Schristos$!
728*75fd0b74Schristos$ SAY := "WRITE_ SYS$OUTPUT"
729*75fd0b74Schristos$!
730*75fd0b74Schristos$ IF F$SEARCH("''P1'") .EQS. ""
731*75fd0b74Schristos$ THEN
732*75fd0b74Schristos$    SAY "MAP_2_SHOPT-E-NOSUCHFILE:  Error, inputfile ''p1' not available"
733*75fd0b74Schristos$    goto exit_m2s
734*75fd0b74Schristos$ ENDIF
735*75fd0b74Schristos$ IF "''P2'" .EQS. ""
736*75fd0b74Schristos$ THEN
737*75fd0b74Schristos$    SAY "MAP_2_SHOPT:  Error, no output file provided"
738*75fd0b74Schristos$    goto exit_m2s
739*75fd0b74Schristos$ ENDIF
740*75fd0b74Schristos$!
741*75fd0b74Schristos$ module1 = "deflate#deflateEnd#deflateInit_#deflateParams#deflateSetDictionary"
742*75fd0b74Schristos$ module2 = "gzclose#gzerror#gzgetc#gzgets#gzopen#gzprintf#gzputc#gzputs#gzread"
743*75fd0b74Schristos$ module3 = "gzseek#gztell#inflate#inflateEnd#inflateInit_#inflateSetDictionary"
744*75fd0b74Schristos$ module4 = "inflateSync#uncompress#zlibVersion#compress"
745*75fd0b74Schristos$ open/read map 'p1
746*75fd0b74Schristos$ if axp .or. ia64
747*75fd0b74Schristos$ then
748*75fd0b74Schristos$     open/write aopt a.opt
749*75fd0b74Schristos$     open/write bopt b.opt
750*75fd0b74Schristos$     write aopt " CASE_SENSITIVE=YES"
751*75fd0b74Schristos$     write bopt "SYMBOL_VECTOR= (-"
752*75fd0b74Schristos$     mod_sym_num = 1
753*75fd0b74Schristos$ MOD_SYM_LOOP:
754*75fd0b74Schristos$     if f$type(module'mod_sym_num') .nes. ""
755*75fd0b74Schristos$     then
756*75fd0b74Schristos$         mod_in = 0
757*75fd0b74Schristos$ MOD_SYM_IN:
758*75fd0b74Schristos$         shared_proc = f$element(mod_in, "#", module'mod_sym_num')
759*75fd0b74Schristos$         if shared_proc .nes. "#"
760*75fd0b74Schristos$         then
761*75fd0b74Schristos$             write aopt f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)",-
762*75fd0b74Schristos        		       f$edit(shared_proc,"upcase"),shared_proc)
763*75fd0b74Schristos$             write bopt f$fao("!AS=PROCEDURE,-",shared_proc)
764*75fd0b74Schristos$             mod_in = mod_in + 1
765*75fd0b74Schristos$             goto mod_sym_in
766*75fd0b74Schristos$         endif
767*75fd0b74Schristos$         mod_sym_num = mod_sym_num + 1
768*75fd0b74Schristos$         goto mod_sym_loop
769*75fd0b74Schristos$     endif
770*75fd0b74Schristos$MAP_LOOP:
771*75fd0b74Schristos$     read/end=map_end map line
772*75fd0b74Schristos$     if (f$locate("{",line).lt. f$length(line)) .or. -
773*75fd0b74Schristos         (f$locate("global:", line) .lt. f$length(line))
774*75fd0b74Schristos$     then
775*75fd0b74Schristos$         proc = true
776*75fd0b74Schristos$         goto map_loop
777*75fd0b74Schristos$     endif
778*75fd0b74Schristos$     if f$locate("}",line).lt. f$length(line) then proc = false
779*75fd0b74Schristos$     if f$locate("local:", line) .lt. f$length(line) then proc = false
780*75fd0b74Schristos$     if proc
781*75fd0b74Schristos$     then
782*75fd0b74Schristos$         shared_proc = f$edit(line,"collapse")
783*75fd0b74Schristos$         chop_semi = f$locate(";", shared_proc)
784*75fd0b74Schristos$         if chop_semi .lt. f$length(shared_proc) then -
785*75fd0b74Schristos              shared_proc = f$extract(0, chop_semi, shared_proc)
786*75fd0b74Schristos$         write aopt f$fao(" symbol_vector=(!AS/!AS=PROCEDURE)",-
787*75fd0b74Schristos        			 f$edit(shared_proc,"upcase"),shared_proc)
788*75fd0b74Schristos$         write bopt f$fao("!AS=PROCEDURE,-",shared_proc)
789*75fd0b74Schristos$     endif
790*75fd0b74Schristos$     goto map_loop
791*75fd0b74Schristos$MAP_END:
792*75fd0b74Schristos$     close/nolog aopt
793*75fd0b74Schristos$     close/nolog bopt
794*75fd0b74Schristos$     open/append libopt 'p2'
795*75fd0b74Schristos$     open/read aopt a.opt
796*75fd0b74Schristos$     open/read bopt b.opt
797*75fd0b74Schristos$ALOOP:
798*75fd0b74Schristos$     read/end=aloop_end aopt line
799*75fd0b74Schristos$     write libopt line
800*75fd0b74Schristos$     goto aloop
801*75fd0b74Schristos$ALOOP_END:
802*75fd0b74Schristos$     close/nolog aopt
803*75fd0b74Schristos$     sv = ""
804*75fd0b74Schristos$BLOOP:
805*75fd0b74Schristos$     read/end=bloop_end bopt svn
806*75fd0b74Schristos$     if (svn.nes."")
807*75fd0b74Schristos$     then
808*75fd0b74Schristos$        if (sv.nes."") then write libopt sv
809*75fd0b74Schristos$        sv = svn
810*75fd0b74Schristos$     endif
811*75fd0b74Schristos$     goto bloop
812*75fd0b74Schristos$BLOOP_END:
813*75fd0b74Schristos$     write libopt f$extract(0,f$length(sv)-2,sv), "-"
814*75fd0b74Schristos$     write libopt ")"
815*75fd0b74Schristos$     close/nolog bopt
816*75fd0b74Schristos$     delete/nolog/noconf a.opt;*,b.opt;*
817*75fd0b74Schristos$ else
818*75fd0b74Schristos$     if vax
819*75fd0b74Schristos$     then
820*75fd0b74Schristos$     open/append libopt 'p2'
821*75fd0b74Schristos$     mod_sym_num = 1
822*75fd0b74Schristos$ VMOD_SYM_LOOP:
823*75fd0b74Schristos$     if f$type(module'mod_sym_num') .nes. ""
824*75fd0b74Schristos$     then
825*75fd0b74Schristos$         mod_in = 0
826*75fd0b74Schristos$ VMOD_SYM_IN:
827*75fd0b74Schristos$         shared_proc = f$element(mod_in, "#", module'mod_sym_num')
828*75fd0b74Schristos$         if shared_proc .nes. "#"
829*75fd0b74Schristos$         then
830*75fd0b74Schristos$     	      write libopt f$fao("UNIVERSAL=!AS",-
831*75fd0b74Schristos      	  			     f$edit(shared_proc,"upcase"))
832*75fd0b74Schristos$             mod_in = mod_in + 1
833*75fd0b74Schristos$             goto vmod_sym_in
834*75fd0b74Schristos$         endif
835*75fd0b74Schristos$         mod_sym_num = mod_sym_num + 1
836*75fd0b74Schristos$         goto vmod_sym_loop
837*75fd0b74Schristos$     endif
838*75fd0b74Schristos$VMAP_LOOP:
839*75fd0b74Schristos$     	  read/end=vmap_end map line
840*75fd0b74Schristos$     	  if (f$locate("{",line).lt. f$length(line)) .or. -
841*75fd0b74Schristos   	      (f$locate("global:", line) .lt. f$length(line))
842*75fd0b74Schristos$     	  then
843*75fd0b74Schristos$     	      proc = true
844*75fd0b74Schristos$     	      goto vmap_loop
845*75fd0b74Schristos$     	  endif
846*75fd0b74Schristos$     	  if f$locate("}",line).lt. f$length(line) then proc = false
847*75fd0b74Schristos$     	  if f$locate("local:", line) .lt. f$length(line) then proc = false
848*75fd0b74Schristos$     	  if proc
849*75fd0b74Schristos$     	  then
850*75fd0b74Schristos$     	      shared_proc = f$edit(line,"collapse")
851*75fd0b74Schristos$     	      chop_semi = f$locate(";", shared_proc)
852*75fd0b74Schristos$     	      if chop_semi .lt. f$length(shared_proc) then -
853*75fd0b74Schristos      	  	  shared_proc = f$extract(0, chop_semi, shared_proc)
854*75fd0b74Schristos$     	      write libopt f$fao("UNIVERSAL=!AS",-
855*75fd0b74Schristos      	  			     f$edit(shared_proc,"upcase"))
856*75fd0b74Schristos$     	  endif
857*75fd0b74Schristos$     	  goto vmap_loop
858*75fd0b74Schristos$VMAP_END:
859*75fd0b74Schristos$     else
860*75fd0b74Schristos$         write sys$output "Unknown Architecture (Not VAX, AXP, or IA64)"
861*75fd0b74Schristos$         write sys$output "No options file created"
862*75fd0b74Schristos$     endif
863*75fd0b74Schristos$ endif
864*75fd0b74Schristos$ EXIT_M2S:
865*75fd0b74Schristos$ close/nolog map
866*75fd0b74Schristos$ close/nolog libopt
867*75fd0b74Schristos$ endsubroutine
868