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