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