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