comparison zlib/make_vms.com @ 111:04ced10e8804

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