quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

config_h.com (65326B)


      1 $! File: config_h.com
      2 $!
      3 $! This procedure attempts to figure out how to build a config.h file
      4 $! for the current project.
      5 $!
      6 $! P1 specifies the config.h.in file or equivalent.  If it is not specified
      7 $! then this procedure will search for several common names of the file.
      8 $!
      9 $! The CONFIGURE shell script will be examined for hints and a few symbols
     10 $! but most of the tests will not produce valid results on OpenVMS.  Some
     11 $! will produce false positives and some will produce false negatives.
     12 $!
     13 $! It is easier to just read the config.h_in file and make up tests based
     14 $! on what is in it!
     15 $!
     16 $! This file will create an empty config_vms.h file if one does not exist.
     17 $! The config_vms.h is intended for manual edits to handle things that
     18 $! this procedure can not.
     19 $!
     20 $! The config_vms.h will be invoked by the resulting config.h file.
     21 $!
     22 $! This procedure knows about the DEC C RTL on the system it is on.
     23 $! Future versions may be handle the GNV, the OpenVMS porting library,
     24 $! and others.
     25 $!
     26 $! This procedure may not guess the options correctly for all architectures,
     27 $! and is a work in progress.
     28 $!
     29 $! Copyright (C) John Malmberg
     30 $!
     31 $! Permission to use, copy, modify, and/or distribute this software for any
     32 $! purpose with or without fee is hereby granted, provided that the above
     33 $! copyright notice and this permission notice appear in all copies.
     34 $!
     35 $! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     36 $! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     37 $! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     38 $! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     39 $! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     40 $! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
     41 $! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     42 $!
     43 $! SPDX-License-Identifier: ISC
     44 $!
     45 $!============================================================================
     46 $!
     47 $ss_normal = 1
     48 $ss_abort = 44
     49 $ss_control_y = 1556
     50 $status = ss_normal
     51 $on control_y then goto control_y
     52 $on warning then goto general_error
     53 $!on warning then set ver
     54 $!
     55 $! Some information for writing timestamps to created files
     56 $!----------------------------------------------------------
     57 $my_proc = f$environment("PROCEDURE")
     58 $my_proc_file = f$parse(my_proc,,,"NAME") + f$parse(my_proc,,,"TYPE")
     59 $tab[0,8] = 9
     60 $datetime = f$element(0,".",f$cvtime(,"ABSOLUTE","DATETIME"))
     61 $username = f$edit(f$getjpi("","USERNAME"),"TRIM")
     62 $!
     63 $pid = f$getjpi("","PID")
     64 $tfile1 = "SYS$SCRATCH:config_h_temp1_''pid'.TEMP"
     65 $dchfile = "SYS$SCRATCH:config_h_decc_''pid'.TEMP"
     66 $starhfile = "SYS$SCRATCH:config_h_starlet_''pid'.TEMP"
     67 $configure_script = "SYS$SCRATCH:configure_script_''pid'.TEMP"
     68 $!
     69 $!  Get the system type
     70 $!----------------------
     71 $arch_type = f$getsyi("arch_type")
     72 $!
     73 $! Does config_vms.h exist?
     74 $!-------------------------
     75 $update_config_vms = 0
     76 $file = f$search("sys$disk:[]config_vms.h")
     77 $if file .nes. ""
     78 $then
     79 $   write sys$output "Found existing custom file ''file'."
     80 $else
     81 $   update_config_vms = 1
     82 $   write sys$output "Creating new sys$disk:[]config_vms.h for you."
     83 $   gosub write_config_vms
     84 $endif
     85 $!
     86 $!
     87 $! On some platforms, DCL search has problems with searching a file
     88 $! on a NFS mounted volume.  So copy it to sys$scratch:
     89 $!
     90 $if f$search(configure_script) .nes. "" then delete 'configure_script';*
     91 $copy sys$disk:[]configure 'configure_script'
     92 $!
     93 $ssl_header_dir = "OPENSSL:"
     94 $if f$trnlnm("OPENSSL") .eqs. ""
     95 $then
     96 $    ssl_header_dir = "SSL$INCLUDE:"
     97 $endif
     98 $!
     99 $!
    100 $! Write out the header
    101 $!----------------------
    102 $gosub write_config_h_header
    103 $!
    104 $!
    105 $!
    106 $! config.h.in could have at least five different names depending
    107 $! on how it was transferred to OpenVMS
    108 $!------------------------------------------------------------------
    109 $if p1 .nes. ""
    110 $then
    111 $   cfile = p1
    112 $else
    113 $   cfile = f$search("sys$disk:[]config.h.in")
    114 $   if cfile .eqs. ""
    115 $   then
    116 $       cfile = f$search("sys$disk:[]config.h_in")
    117 $       if cfile .eqs. ""
    118 $       then
    119 $           cfile = f$search("sys$disk:[]configh.in")
    120 $           if cfile .eqs. ""
    121 $           then
    122 $               cfile = f$search("sys$disk:[]config__2eh.in")
    123 $               if cfile .eqs. ""
    124 $               then
    125 $                   cfile = f$search("sys$disk:[]config.h__2ein")
    126 $               endif
    127 $           endif
    128 $       endif
    129 $   endif
    130 $endif
    131 $if f$trnlnm("PRJ_INCLUDE") .nes. ""
    132 $then
    133 $   cfile = f$search("PRJ_INCLUDE:config.h.in")
    134 $   if cfile .eqs. ""
    135 $   then
    136 $       cfile = f$search("PRJ_INCLUDE:config.h_in")
    137 $       if cfile .eqs. ""
    138 $       then
    139 $           cfile = f$search("PRJ_INCLUDE:config__2eh.in")
    140 $           if cfile .eqs. ""
    141 $           then
    142 $               cfile = f$search("PRJ_INCLUDE:config__2eh.in")
    143 $               if cfile .eqs. ""
    144 $               then
    145 $                   cfile = f$search("PRJ_INCLUDE:config.h__2ein")
    146 $               endif
    147 $           endif
    148 $       endif
    149 $    endif
    150 $endif
    151 $if cfile .eqs. ""
    152 $then
    153 $   write sys$output "Can not find sys$disk:config.h.in"
    154 $   line_out = "Looked for config.h.in, config.h_in, configh.in, "
    155 $   line_out = line_out + "config__2eh.in, config.h__2ein"
    156 $   write/symbol sys$output line_out
    157 $   if f$trnlnm("PRJ_INCLUDE") .nes. ""
    158 $   then
    159 $       write sys$output "Also looked in PRJ_INCLUDE: for these files."
    160 $   endif
    161 $!
    162 $   write tf ""
    163 $   write tf -
    164         "   /* Could not find sys$disk:config.h.in                           */"
    165 $   write tf -
    166         "  /*  Looked also for config.h_in, configh.in, config__2eh.in,     */"
    167 $   write tf -
    168         " /*   config.h__2ein                                              */"
    169 $   if f$trnlnm("PRJ_INCLUDE") .nes. ""
    170 $   then
    171 $       write tf -
    172         " /* Also looked in PRJ_INCLUDE: for these files.                 */"
    173 $   endif
    174 $   write tf -
    175         "/*--------------------------------------------------------------*/
    176 $   write tf ""
    177 $   goto write_tail
    178 $endif
    179 $!
    180 $!
    181 $! Locate the DECC libraries in use
    182 $!-----------------------------------
    183 $decc_rtldef = f$parse("decc$rtldef","sys$library:.tlb;0")
    184 $decc_starletdef = f$parse("sys$starlet_c","sys$library:.tlb;0")
    185 $decc_shr = f$parse("decc$shr","sys$share:.exe;0")
    186 $!
    187 $! Dump the DECC header names into a file
    188 $!----------------------------------------
    189 $if f$search(dchfile) .nes. "" then delete 'dchfile';*
    190 $if f$search(tfile1) .nes. "" then delete 'tfile1';*
    191 $define/user sys$output 'tfile1'
    192 $library/list 'decc_rtldef'
    193 $open/read/error=rtldef_loop1_end tf1 'tfile1'
    194 $open/write/error=rtldef_loop1_end tf2 'dchfile'
    195 $rtldef_loop1:
    196 $   read/end=rtldef_loop1_end tf1 line_in
    197 $   line_in = f$edit(line_in,"TRIM,COMPRESS")
    198 $   key1 = f$element(0," ",line_in)
    199 $   key2 = f$element(1," ",line_in)
    200 $   if key1 .eqs. " " .or. key1 .eqs. "" then goto rtldef_loop1
    201 $   if key2 .nes. " " .and. key2 .nes. "" then goto rtldef_loop1
    202 $   write tf2 "|",key1,"|"
    203 $   goto rtldef_loop1
    204 $rtldef_loop1_end:
    205 $if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1
    206 $if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2
    207 $if f$search(tfile1) .nes. "" then delete 'tfile1';*
    208 $!
    209 $! Dump the STARLET header names into a file
    210 $!----------------------------------------
    211 $if f$search(starhfile) .nes. "" then delete 'starhfile';*
    212 $if f$search(tfile1) .nes. "" then delete 'tfile1';*
    213 $define/user sys$output 'tfile1'
    214 $library/list 'decc_starletdef'
    215 $open/read/error=stardef_loop1_end tf1 'tfile1'
    216 $open/write/error=stardef_loop1_end tf2 'starhfile'
    217 $stardef_loop1:
    218 $   read/end=stardef_loop1_end tf1 line_in
    219 $   line_in = f$edit(line_in,"TRIM,COMPRESS")
    220 $   key1 = f$element(0," ",line_in)
    221 $   key2 = f$element(1," ",line_in)
    222 $   if key1 .eqs. " " .or. key1 .eqs. "" then goto stardef_loop1
    223 $   if key2 .nes. " " .and. key2 .nes. "" then goto stardef_loop1
    224 $   write tf2 "|",key1,"|"
    225 $   goto stardef_loop1
    226 $stardef_loop1_end:
    227 $if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1
    228 $if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2
    229 $if f$search(tfile1) .nes. "" then delete 'tfile1';*
    230 $!
    231 $!
    232 $! Now calculate what should be in the file from reading
    233 $! config.h.in and CONFIGURE.
    234 $!---------------------------------------------------------------
    235 $open/read inf 'cfile'
    236 $do_comment = 0
    237 $if_block = 0
    238 $cfgh_in_loop1:
    239 $!set nover
    240 $   read/end=cfgh_in_loop1_end inf line_in
    241 $   xline = f$edit(line_in,"TRIM,COMPRESS")
    242 $!
    243 $!  Blank line handling
    244 $!---------------------
    245 $   if xline .eqs. ""
    246 $   then
    247 $       write tf ""
    248 $       goto cfgh_in_loop1
    249 $   endif
    250 $   xlen = f$length(xline)
    251 $   key = f$extract(0,2,xline)
    252 $!
    253 $!  deal with comments by copying exactly
    254 $!-----------------------------------------
    255 $   if (do_comment .eq. 1) .or. (key .eqs. "/*")
    256 $   then
    257 $       do_comment = 1
    258 $       write tf line_in
    259 $       key = f$extract(xlen - 2, 2, xline)
    260 $       if key .eqs. "*/" then do_comment = 0
    261 $       goto cfgh_in_loop1
    262 $   endif
    263 $!
    264 $!  Some quick parsing
    265 $!----------------------
    266 $   keyif = f$extract(0,3,xline)
    267 $   key1 = f$element(0," ",xline)
    268 $   key2 = f$element(1," ",xline)
    269 $   key2a = f$element(0,"_",key2)
    270 $   key2b = f$element(1,"_",key2)
    271 $   key2_len = f$length(key2)
    272 $   key2_h = f$extract(key2_len - 2, 2, key2)
    273 $   key2_t = f$extract(key2_len - 5, 5, key2)
    274 $   if key2_t .eqs. "_TYPE" then key2_h = "_T"
    275 $   key64 = 0
    276 $   if f$locate("64", xline) .lt. xlen then key64 = 1
    277 $!
    278 $!write sys$output "xline = ''xline'"
    279 $!
    280 $!  Comment out this section of the ifblock
    281 $!-----------------------------------------
    282 $   if if_block .ge. 3
    283 $   then
    284 $       write tf "/* ", xline, " */"
    285 $       if keyif .eqs. "#en" then if_block = 0
    286 $       goto cfgh_in_loop1
    287 $   endif
    288 $!
    289 $!  Handle the end of an ifblock
    290 $!-------------------------------
    291 $   if keyif .eqs. "#en"
    292 $   then
    293 $       write tf xline
    294 $       if_block = 0
    295 $       goto cfgh_in_loop1
    296 $   endif
    297 $!
    298 $   if key1 .eqs. "#ifndef"
    299 $   then
    300 $!      Manual check for _ALL_SOURCE on AIX error
    301 $!-----------------------------------------------
    302 $       if key2 .eqs. "_ALL_SOURCE"
    303 $       then
    304 $          write tf "/* ", xline, " */"
    305 $!
    306 $!         Ignore the rest of the block
    307 $!--------------------------------------
    308 $          if_block = 3
    309 $          goto cfgh_in_loop1
    310 $       endif
    311 $   endif
    312 $!
    313 $!
    314 $!  Default action for an #if/#else/#endif
    315 $!------------------------------------------
    316 $   if keyif .eqs. "#if" .or. keyif .eqs. "#el"
    317 $   then
    318 $       if_block = 1
    319 $       write tf xline
    320 $       goto cfgh_in_loop1
    321 $   endif
    322 $!
    323 $!
    324 $!  Process "normal?" stuff
    325 $!---------------------------
    326 $   if key1 .eqs. "#undef"
    327 $   then
    328 $       key2c = f$element(2, "_", key2)
    329 $       if (key2c .eqs. "_") .or. (key2c .eqs. "H") then key2c = ""
    330 $       key2d = f$element(3, "_", key2)
    331 $       if (key2d .eqs. "_") .or. (key2d .eqs. "H") then key2d = ""
    332 $       key2e = f$element(4, "_", key2)
    333 $       if (key2e .eqs. "_") .or. (key2e .eqs. "H") then key2e = ""
    334 $       if key2d .eqs. "T"
    335 $       then
    336 $           if key2e .eqs. "TYPE"
    337 $           then
    338 $               key2_h = "_T"
    339 $               key2d = ""
    340 $           endif
    341 $       endif
    342 $!
    343 $       double_under = 0
    344 $!
    345 $!      Process FCNTL directives
    346 $!-------------------------------------
    347 $       if (key2b .eqs. "FCNTL") .and. (key2c .eqs. "O") .and. -
    348            (key2d .eqs. "NONBLOCK")
    349 $       then
    350 $           write tf "#ifndef ''key2'"
    351 $           write tf "#define ''key2' 1"
    352 $           write tf "#endif"
    353 $           goto cfgh_in_loop1
    354 $       endif
    355 $!
    356 $!      Process GETADDRINFO directives
    357 $!-------------------------------------
    358 $       if key2 .eqs. "GETADDRINFO_THREADSAFE"
    359 $       then
    360 $           write tf "#ifndef ''key2'"
    361 $           write tf "#define ''key2' 1"
    362 $           write tf "#endif"
    363 $           goto cfgh_in_loop1
    364 $       endif
    365 $!
    366 $!      Process IOCTL directives
    367 $!-------------------------------------
    368 $       if (key2b .eqs. "IOCTL") .and. (key2c .nes. "")
    369 $       then
    370 $           if (key2c .eqs. "FIONBIO") .or. (key2c .eqs. "SIOCGIFADDR")
    371 $           then
    372 $               write tf "#ifndef ''key2'"
    373 $               write tf "#define ''key2' 1"
    374 $               write tf "#endif"
    375 $               goto cfgh_in_loop1
    376 $           endif
    377 $       endif
    378 $!
    379 $!
    380 $!      Manual check for LL on
    381 $!-----------------------------------------------
    382 $       if key2 .eqs. "LL"
    383 $       then
    384 $          write tf "#ifndef __VAX
    385 $          write tf "#define HAVE_''key2' 1"
    386 $          write tf "#endif"
    387 $          goto cfgh_in_loop1
    388 $       endif
    389 $!
    390 $       if key2 .eqs. "bool_t"
    391 $       then
    392 $           write tf "#ifndef ''key2'"
    393 $           write tf "#define ''key2' short"
    394 $           write tf "#endif"
    395 $           goto cfgh_in_loop1
    396 $       endif
    397 $!
    398 $       if key2 .eqs. "bits16_t"
    399 $       then
    400 $           write tf "#ifndef ''key2'"
    401 $           write tf "#define ''key2' short"
    402 $           write tf "#endif"
    403 $           goto cfgh_in_loop1
    404 $       endif
    405 $!
    406 $       if key2 .eqs. "u_bits16_t"
    407 $       then
    408 $           write tf "#ifndef ''key2'"
    409 $           write tf "#define ''key2' unsigned short"
    410 $           write tf "#endif"
    411 $           goto cfgh_in_loop1
    412 $       endif
    413 $!
    414 $       if key2 .eqs. "bits32_t"
    415 $       then
    416 $           write tf "#ifndef ''key2'"
    417 $           write tf "#define ''key2' int"
    418 $           write tf "#endif"
    419 $           goto cfgh_in_loop1
    420 $       endif
    421 $!
    422 $       if key2 .eqs. "u_bits32_t"
    423 $       then
    424 $           write tf "#ifndef ''key2'"
    425 $           write tf "#define ''key2' unsigned int"
    426 $           write tf "#endif"
    427 $           goto cfgh_in_loop1
    428 $       endif
    429 $!
    430 $       if key2 .eqs. "intmax_t"
    431 $       then
    432 $           write tf "#ifndef ''key2'"
    433 $           write tf "#ifdef __VAX"
    434 $           write tf "#define ''key2' long"
    435 $           write tf "#else"
    436 $           write tf "#define ''key2' long long"
    437 $           write tf "#endif"
    438 $           write tf "#endif"
    439 $           goto cfgh_in_loop1
    440 $       endif
    441 $!
    442 $       if key2 .eqs. "uintmax_t"
    443 $       then
    444 $           write tf "#ifndef ''key2'"
    445 $           write tf "#ifdef __VAX"
    446 $           write tf "#define ''key2' unsigned long"
    447 $           write tf "#else"
    448 $           write tf "#define ''key2' unsigned long long"
    449 $           write tf "#endif"
    450 $           write tf "#endif"
    451 $           goto cfgh_in_loop1
    452 $       endif
    453 $!
    454 $       if key2 .eqs. "socklen_t"
    455 $       then
    456 $           write tf "#ifndef ''key2'"
    457 $           write tf "#define ''key2' int"
    458 $           write tf "#endif"
    459 $           goto cfgh_in_loop1
    460 $       endif
    461 $!
    462 $       if key2 .eqs. "GETGROUPS_T"
    463 $       then
    464 $           write tf "#ifndef ''key2'"
    465 $           write tf "#define ''key2' gid_t"
    466 $           write tf "#endif"
    467 $           goto cfgh_in_loop1
    468 $       endif
    469 $!
    470 $       if key2 .eqs. "HAVE_DECL_SYS_SIGLIST"
    471 $       then
    472 $           write tf "#ifndef ''key2'"
    473 $           write tf "#define ''key2' 0"
    474 $           write tf "#endif"
    475 $           goto cfgh_in_loop1
    476 $       endif
    477 $!
    478 $       if key2 .eqs. "HAVE_SYS_ERRLIST"
    479 $       then
    480 $           write tf "#ifndef ''key2'"
    481 $           write tf "#define ''key2' 1"
    482 $           write tf "#endif"
    483 $           goto cfgh_in_loop1
    484 $       endif
    485 $!
    486 $       if key2 .eqs. "HAVE_STRUCT_DIRENT_D_INO"
    487 $       then
    488 $           write tf "#ifndef ''key2'"
    489 $           write tf "#define ''key2' 1"
    490 $           write tf "#endif"
    491 $           goto cfgh_in_loop1
    492 $       endif
    493 $!
    494 $       if key2 .eqs. "HAVE_STRUCT_TIMEVAL"
    495 $       then
    496 $           write tf "#ifndef ''key2'"
    497 $           write tf "#define ''key2' 1"
    498 $           write tf "#endif"
    499 $           goto cfgh_in_loop1
    500 $       endif
    501 $!
    502 $!      ! The header files have this information, however
    503 $!      ! The ioctl() call only works on sockets.
    504 $!      if key2 .eqs. "FIONREAD_IN_SYS_IOCTL"
    505 $!      then
    506 $!          write tf "#ifndef ''key2'"
    507 $!          write tf "#define ''key2' 1"
    508 $!          write tf "#endif"
    509 $!          goto cfgh_in_loop1
    510 $!      endif
    511 $!
    512 $!      ! The header files have this information, however
    513 $!      ! The ioctl() call only works on sockets.
    514 $!      if key2 .eqs. "GWINSZ_IN_SYS_IOCTL"
    515 $!      then
    516 $!          write tf "#ifndef ''key2'"
    517 $!          write tf "#define ''key2' 1"
    518 $!          write tf "#endif"
    519 $!          goto cfgh_in_loop1
    520 $!      endif
    521 $!
    522 $!      ! The header files have this information, however
    523 $!      ! The ioctl() call only works on sockets.
    524 $!      if key2 .eqs. "STRUCT_WINSIZE_IN_SYS_IOCTL"
    525 $!      then
    526 $!          write tf "#ifndef ''key2'"
    527 $!          write tf "#define ''key2' 0"
    528 $!          write tf "#endif"
    529 $!          goto cfgh_in_loop1
    530 $!      endif
    531 $!
    532 $       if key2 .eqs. "HAVE_STRUCT_TM_TM_ZONE"
    533 $       then
    534 $           write tf "#ifndef ''key2'"
    535 $           write tf "#define ''key2' 1"
    536 $           write tf "#endif"
    537 $           goto cfgh_in_loop1
    538 $       endif
    539 $!
    540 $       if key2 .eqs. "HAVE_TM_ZONE"
    541 $       then
    542 $           write tf "#ifndef ''key2'"
    543 $           write tf "#define ''key2' 1"
    544 $           write tf "#endif"
    545 $           goto cfgh_in_loop1
    546 $       endif
    547 $!
    548 $       if key2 .eqs. "HAVE_TIMEVAL"
    549 $       then
    550 $           write tf "#ifndef ''key2'"
    551 $           write tf "#define ''key2' 1"
    552 $           write tf "#endif"
    553 $           goto cfgh_in_loop1
    554 $       endif
    555 $!
    556 $       if key2 .eqs. "WEXITSTATUS_OFFSET"
    557 $       then
    558 $           write tf "#ifndef ''key2'"
    559 $           write tf "#define ''key2' 2"
    560 $           write tf "#endif"
    561 $           goto cfgh_in_loop1
    562 $       endif
    563 $!
    564 $       if key2 .eqs. "HAVE_GETPW_DECLS"
    565 $       then
    566 $           write tf "#ifndef ''key2'"
    567 $           write tf "#define ''key2' 1"
    568 $           write tf "#endif"
    569 $           goto cfgh_in_loop1
    570 $       endif
    571 $!
    572 $       if key2 .eqs. "HAVE_DECL_CONFSTR"
    573 $       then
    574 $           write tf "#ifndef ''key2'"
    575 $           write tf "#define ''key2' 1"
    576 $           write tf "#endif"
    577 $           goto cfgh_in_loop1
    578 $       endif
    579 $!
    580 $       if key2 .eqs. "HAVE_DECL_PRINTF"
    581 $       then
    582 $           write tf "#ifndef ''key2'"
    583 $           write tf "#define ''key2' 1"
    584 $           write tf "#endif"
    585 $           goto cfgh_in_loop1
    586 $       endif
    587 $!
    588 $       if key2 .eqs. "HAVE_DECL_SBRK"
    589 $       then
    590 $           write tf "#ifndef ''key2'"
    591 $           write tf "#define ''key2' 1"
    592 $           write tf "#endif"
    593 $           goto cfgh_in_loop1
    594 $       endif
    595 $!
    596 $       if key2 .eqs. "HAVE_DECL_STRSIGNAL"
    597 $       then
    598 $           write tf "#ifndef ''key2'"
    599 $           write tf "#define ''key2' 0"
    600 $           write tf "#endif"
    601 $           goto cfgh_in_loop1
    602 $       endif
    603 $!
    604 $       if key2a .eqs. "HAVE_DECL_STRTOLD"
    605 $       then
    606 $           write tf "#ifndef ''key2'"
    607 $           write tf "#define ''key2' 0"
    608 $           write tf "#endif"
    609 $           goto cfgh_in_loop1
    610 $       endif
    611 $!
    612 $       if key2 .eqs. "HAVE_DECL_STRTOIMAX"
    613 $       then
    614 $           write tf "#ifndef ''key2'"
    615 $           write tf "#define ''key2' 0"
    616 $           write tf "#endif"
    617 $           goto cfgh_in_loop1
    618 $       endif
    619 $!
    620 $       if key2 .eqs. "HAVE_DECL_STRTOL"
    621 $       then
    622 $           write tf "#ifndef ''key2'"
    623 $           write tf "#define ''key2' 1"
    624 $           write tf "#endif"
    625 $           goto cfgh_in_loop1
    626 $       endif
    627 $!
    628 $       if key2 .eqs. "HAVE_DECL_STRTOUL"
    629 $       then
    630 $           write tf "#ifndef ''key2'"
    631 $           write tf "#define ''key2' 1"
    632 $           write tf "#endif"
    633 $           goto cfgh_in_loop1
    634 $       endif
    635 $!
    636 $       if key2 .eqs. "HAVE_DECL_STRTOUMAX"
    637 $       then
    638 $           write tf "#ifndef ''key2'"
    639 $           write tf "#define ''key2' 0"
    640 $           write tf "#endif"
    641 $           goto cfgh_in_loop1
    642 $       endif
    643 $!
    644 $       if key2 .eqs. "GETPGRP_VOID"
    645 $       then
    646 $           write tf "#ifndef ''key2'"
    647 $           write tf "#define ''key2' 1"
    648 $           write tf "#endif"
    649 $           goto cfgh_in_loop1
    650 $       endif
    651 $!
    652 $       if key2 .eqs. "NAMED_PIPES_MISSING"
    653 $       then
    654 $           write tf "#ifndef ''key2'"
    655 $           write tf "#define ''key2' 1"
    656 $           write tf "#endif"
    657 $           goto cfgh_in_loop1
    658 $       endif
    659 $!
    660 $       if key2 .eqs. "OPENDIR_NOT_ROBUST"
    661 $       then
    662 $           write tf "#ifndef ''key2'"
    663 $           write tf "#define ''key2' 1"
    664 $           write tf "#endif"
    665 $           goto cfgh_in_loop1
    666 $       endif
    667 $!
    668 $       if key2 .eqs. "PGRP_PIPE"
    669 $       then
    670 $           write tf "#ifndef ''key2'"
    671 $           write tf "#define ''key2' 1"
    672 $           write tf "#endif"
    673 $           goto cfgh_in_loop1
    674 $       endif
    675 $!
    676 $       if key2 .eqs. "CAN_REDEFINE_GETENV"
    677 $       then
    678 $           write tf "#ifndef ''key2'"
    679 $           write tf "#define ''key2' 1"
    680 $           write tf "#endif"
    681 $           goto cfgh_in_loop1
    682 $       endif
    683 $!
    684 $       if key2 .eqs. "HAVE_PRINTF_A_FORMAT"
    685 $       then
    686 $           write tf "#ifndef ''key2'"
    687 $           write tf "#define ''key2' 1"
    688 $           write tf "#endif"
    689 $           goto cfgh_in_loop1
    690 $       endif
    691 $!
    692 $       if key2 .eqs. "CTYPE_NON_ASCII"
    693 $       then
    694 $           write tf "#ifndef ''key2'"
    695 $           write tf "#define ''key2' 1"
    696 $           write tf "#endif"
    697 $           goto cfgh_in_loop1
    698 $       endif
    699 $!
    700 $       if key2 .eqs. "HAVE_LANGINFO_CODESET"
    701 $       then
    702 $           write tf "#ifndef ''key2'"
    703 $           write tf "#define ''key2' 0"
    704 $           write tf "#endif"
    705 $           goto cfgh_in_loop1
    706 $       endif
    707 $!
    708 $!      This wants execve() to do this automagically to pass.
    709 $!      if key2 .eqs. "HAVE_HASH_BANG_EXEC"
    710 $!      then
    711 $!          write tf "#ifndef ''key2'"
    712 $!          write tf "#define ''key2' 1"
    713 $!          write tf "#endif"
    714 $!          goto cfgh_in_loop1
    715 $!      endif
    716 $!
    717 $       if key2 .eqs. "ICONV_CONST"
    718 $       then
    719 $           write tf "#ifndef ''key2'"
    720 $           write tf "#define ''key2'"
    721 $           write tf "#endif"
    722 $           goto cfgh_in_loop1
    723 $       endif
    724 $!
    725 $       if key2 .eqs. "VOID_SIGHANDLER"
    726 $       then
    727 $           write tf "#ifndef ''key2'"
    728 $           write tf "#define ''key2' 1"
    729 $           write tf "#endif"
    730 $           goto cfgh_in_loop1
    731 $       endif
    732 $!
    733 $       if key2 .eqs. "HAVE_POSIX_SIGNALS"
    734 $       then
    735 $           write tf "#ifndef ''key2'"
    736 $           write tf "#define ''key2' 1"
    737 $           write tf "#endif"
    738 $           goto cfgh_in_loop1
    739 $       endif
    740 $!
    741 $       if key2 .eqs. "UNUSABLE_RT_SIGNALS"
    742 $       then
    743 $           write tf "#ifndef ''key2'"
    744 $           write tf "#define ''key2' 1"
    745 $           write tf "#endif"
    746 $           goto cfgh_in_loop1
    747 $       endif
    748 $!
    749 $       if key2a .eqs. "HAVE_DECL_FPURGE"
    750 $       then
    751 $           write tf "#ifndef ''key2a'"
    752 $           write tf "#define ''key2a' 1"
    753 $           write tf "#endif"
    754 $           goto cfgh_in_loop1
    755 $       endif
    756 $!
    757 $       if key2 .eqs. "HAVE_DECL_SETREGID"
    758 $       then
    759 $           write tf "#ifndef ''key2'"
    760 $           write tf "#define ''key2' 1"
    761 $           write tf "#endif"
    762 $           goto cfgh_in_loop1
    763 $       endif
    764 $!
    765 $       if key2 .eqs. "HAVE_POSIX_SIGSETJMP"
    766 $       then
    767 $           write tf "#ifndef ''key2'"
    768 $           write tf "#define ''key2' 1"
    769 $           write tf "#endif"
    770 $           goto cfgh_in_loop1
    771 $       endif
    772 $!
    773 $       if key2b .eqs. "RAND" .and. key2c .nes. "" .and. key2d .eqs. ""
    774 $       then
    775 $           if (key2c .eqs. "EGD") .or. -
    776                (key2c .eqs. "STATUS") .or. -
    777                (key2c .eqs. "SCREEN")
    778 $           then
    779 $               if f$search("''ssl_header_dir'rand.h") .nes. ""
    780 $               then
    781 $                   write tf "#ifndef ''key2'"
    782 $                   write tf "#define ''key2' 1"
    783 $                   write tf "#endif"
    784 $               else
    785 $                   write tf "/* #undef ''key2' */"
    786 $               endif
    787 $           endif
    788 $       endif
    789 $!
    790 $       if key2 .eqs. "STRCOLL_BROKEN"
    791 $       then
    792 $           write tf "#ifndef ''key2'"
    793 $           write tf "#define ''key2' 1"
    794 $           write tf "#endif"
    795 $           goto cfgh_in_loop1
    796 $       endif
    797 $!
    798 $       if key2 .eqs. "DUP_BROKEN"
    799 $       then
    800 $           write tf "#ifndef ''key2'"
    801 $           write tf "#define ''key2' 1"
    802 $           write tf "#endif"
    803 $           goto cfgh_in_loop1
    804 $       endif
    805 $!
    806 $!      This is for a test that getcwd(0,0) works.
    807 $!      It does not on VMS.
    808 $!--------------------------
    809 $       if key2 .eqs. "GETCWD_BROKEN"
    810 $       then
    811 $           write sys$output ""
    812 $           write sys$output -
    813   "%CONFIG_H-I-NONPORT, ''key2' being tested for!"
    814 $                  write sys$output -
    815  "-CONFIG_H-I-GETCWD, GETCWD(0,0) does not work on VMS."
    816 $                  write sys$output -
    817  "-CONFIG_H-I-GETCWD2, Work around hack probably required."
    818 $                  write sys$output -
    819  "-CONFIG_H-I-REVIEW, Manual Code review required!"
    820 $                   if update_config_vms
    821 $                   then
    822 $                       open/append tfcv sys$disk:[]config_vms.h
    823 $                       write tfcv ""
    824 $                       write tfcv -
    825                 "/* Check config.h for use of ''key2' settings */"
    826 $                       write tfcv ""
    827 $                       close tfcv
    828 $                   endif
    829 $
    830 $           goto cfgh_in_loop1
    831 $       endif
    832 $!
    833 $       if (key2a .eqs. "HAVE") .or. (key2a .eqs. "STAT") .or. -
    834            (key2 .eqs. "USE_IPV6") .or. (key2b .eqs. "LDAP")
    835 $       then
    836 $!
    837 $!          Process extra underscores
    838 $!------------------------------------
    839 $           if f$locate("HAVE___", key2) .lt. key2_len
    840 $           then
    841 $               key2b = "__" + key2d
    842 $               key2d = ""
    843 $               double_under = 1
    844 $           else
    845 $               if f$locate("HAVE__", key2) .lt. key2_len
    846 $               then
    847 $                   key2b = "_" + key2c
    848 $                   key2c = ""
    849 $                   double_under = 1
    850 $               endif
    851 $           endif
    852 $!
    853 $           if (key2_h .eqs. "_H") .or. (key2 .eqs. "USE_IPV6") .or. -
    854                (key2b .eqs. "LDAP")
    855 $           then
    856 $!
    857 $!              Looking for a header file
    858 $!---------------------------------------
    859 $               headf = key2b
    860 $               if key2c .nes. "" then headf = headf + "_" + key2c
    861 $               if key2d .nes. "" then headf = headf + "_" + key2d
    862 $!
    863 $!                 (key2b .eqs. "READLINE")
    864 $!
    865 $!              Some special parsing
    866 $!------------------------------------------
    867 $               if (key2b .eqs. "SYS") .or. (key2b .eqs. "ARPA") .or. -
    868                    (key2b .eqs. "NET") .or. (key2b .eqs. "NETINET")
    869 $               then
    870 $                   if key2c .nes. ""
    871 $                   then
    872 $                       headf = key2c
    873 $                       if key2d .nes. "" then headf = key2c + "_" + key2d
    874 $                   endif
    875 $               endif
    876 $!
    877 $!              And of course what's life with out some special cases
    878 $!--------------------------------------------------------------------
    879 $               if key2 .eqs. "USE_IPV6"
    880 $               then
    881 $                   headf = "in6"
    882 $               endif
    883 $!
    884 $               if key2b .eqs. "LDAP"
    885 $               then
    886 $                   if (key2 .eqs. "HAVE_LDAP_SSL") .or. -
    887                        (key2 .eqs. "HAVE_LDAP_URL_PARSE")
    888 $                   then
    889 $                       headf = "ldap"
    890 $                   endif
    891 $               endif
    892 $!
    893 $!
    894 $               if key2b .eqs. "FILE"
    895 $               then
    896 $                  write sys$output ""
    897 $                  write sys$output -
    898   "%CONFIG_H-I-NONPORT, ''key2' being asked for!"
    899 $                  write sys$output -
    900  "-CONFIG_H-I-FILE_OLD, file.h will not be configured as is obsolete!"
    901 $                  write sys$output -
    902  "-CONFIG_H_I-FCNTL_NEW, "Expecting fcntl.h to be configured instead!"
    903 $                  write sys$output -
    904  "-CONFIG_H_I-FCNTL_CHK, "Unable to verify at this time!"
    905 $                  write sys$output -
    906  "-CONFIG_H-I-REVIEW, Manual Code review required!"
    907 $!
    908 $                   if update_config_vms
    909 $                   then
    910 $                       open/append tfcv sys$disk:[]config_vms.h
    911 $                       write tfcv ""
    912 $                       write tfcv -
    913                 "/* Check config.h for use of fcntl.h instead of file.h */"
    914 $                       write tfcv ""
    915 $                       close tfcv
    916 $                   endif
    917 $               endif
    918 $!
    919 $!              Now look it up in the DEC C RTL
    920 $!---------------------------------------------
    921 $               define/user sys$output nl:
    922 $               define/user sys$error nl:
    923 $               search/output=nl: 'dchfile' |'headf'|/exact
    924 $               if '$severity' .eq. 1
    925 $               then
    926 $                   if key64 then write tf "#ifndef __VAX"
    927 $                   write tf "#ifndef ''key2'"
    928 $                   write tf "#define ''key2' 1"
    929 $if p2 .nes. "" then write sys$output "''dchfile' - #define ''key2' 1"
    930 $                   write tf "#endif"
    931 $                   if key64 then write tf "#endif"
    932 $set nover
    933 $                   goto cfgh_in_loop1
    934 $               endif
    935 $!
    936 $!
    937 $!              Now look it up in the DEC C STARLET_C
    938 $!---------------------------------------------
    939 $               define/user sys$output nl:
    940 $               define/user sys$error nl:
    941 $               search/output=nl: 'starhfile' |'headf'|/exact
    942 $               if '$severity' .eq. 1
    943 $               then
    944 $                   if key64 then write tf "#ifndef __VAX"
    945 $                   write tf "#ifndef ''key2'"
    946 $                   write tf "#define ''key2' 1"
    947 $if p2 .nes. "" then write sys$output "''starfile' - #define ''key2' 1"
    948 $                   write tf "#endif"
    949 $                   if key64 then write tf "#endif"
    950 $set nover
    951 $                   goto cfgh_in_loop1
    952 $               endif
    953 $!
    954 $!              Now look for OPENSSL headers
    955 $!---------------------------------------------------------
    956 $               if key2b .eqs. "OPENSSL"
    957 $               then
    958 $                   headf = headf - "OPENSSL_"
    959 $                   header = f$search("''ssl_header_dir'''headf'.h")
    960 $                   if header .nes. ""
    961 $                   then
    962 $                       write tf "#ifndef ''key2'"
    963 $                       write tf "#define ''key2' 1"
    964 $                       write tf "#endif"
    965 $set nover
    966 $                       goto cfgh_in_loop1
    967 $                   endif
    968 $               endif
    969 $!
    970 $!              Now look for Kerberos
    971 $!------------------------------------------------------------
    972 $               if key2b .eqs. "GSSAPI"
    973 $               then
    974 $                   header_dir = "sys$sysroot:[kerberos.include]"
    975 $                   headf = headf - "GSSAPI_"
    976 $                   header = f$search("''header_dir'''headf'.h")
    977 $                   if header .nes. ""
    978 $                   then
    979 $                       write tf "#ifndef ''key2'"
    980 $                       write tf "#define ''key2' 1"
    981 $                       write tf "#endif"
    982 $set nover
    983 $                       goto cfgh_in_loop1
    984 $                   endif
    985 $               endif
    986 $!
    987 $set nover
    988 $           else
    989 $!
    990 $!              Looking for a routine or a symbol
    991 $!------------------------------------------------
    992 $               if key2c .eqs. "MACRO"
    993 $               then
    994 $                   if (key2b .eqs. "FILE") .or. (key2b .eqs. "DATE") -
    995                         .or. (key2b .eqs. "LINE") .or. (key2b .eqs. "TIME")
    996 $                   then
    997 $                       write tf "#ifndef HAVE_''key2b'"
    998 $                       write tf "#define HAVE_''key2b' 1"
    999 $                       write tf "#endif"
   1000 $                   endif
   1001 $                   goto cfgh_in_loop1
   1002 $               endif
   1003 $!
   1004 $!              Special false tests
   1005 $!-------------------------------------
   1006 $               if double_under
   1007 $               then
   1008 $                   if key2b .eqs. "_FCNTL" .or. key2b .eqs. "__FCNTL"
   1009 $                   then
   1010 $                       write tf "/* #undef HAVE_''key2b' */"
   1011 $                       goto cfgh_in_loop1
   1012 $                   endif
   1013 $!
   1014 $                   if key2b .eqs. "_STAT" .or. key2b .eqs. "__STAT"
   1015 $                   then
   1016 $                       write tf "/* #undef HAVE_''key2b' */"
   1017 $                       goto cfgh_in_loop1
   1018 $                   endif
   1019 $!
   1020 $                   if key2b .eqs. "_READ" .or. key2b .eqs. "__READ"
   1021 $                   then
   1022 $                       write tf "/* #undef HAVE_''key2b' */"
   1023 $                       goto cfgh_in_loop1
   1024 $                   endif
   1025 $               endif
   1026 $!
   1027 $               keysym = key2b
   1028 $               if key2c .nes. "" then keysym = keysym + "_" + key2c
   1029 $               if key2d .nes. "" then keysym = keysym + "_" + key2d
   1030 $               if key2e .nes. "" then keysym = keysym + "_" + key2e
   1031 $!
   1032 $!
   1033 $!              Stat structure members
   1034 $!-------------------------------------
   1035 $               if key2b .eqs. "STRUCT"
   1036 $               then
   1037 $                   if key2c .eqs. "STAT" .and (key2d .nes. "")
   1038 $                   then
   1039 $                       key2b = key2b + "_" + key2c + "_" + key2d
   1040 $                       key2c = key2e
   1041 $                       key2d = ""
   1042 $                       key2e = ""
   1043 $                   endif
   1044 $               endif
   1045 $               if (key2b .eqs. "ST") .or. (key2b .eqs. "STRUCT_STAT_ST")
   1046 $               then
   1047 $                   keysym = "ST" + "_" + key2c
   1048 $                   keysym = f$edit(keysym,"LOWERCASE")
   1049 $               endif
   1050 $               if key2a .eqs. "STAT"
   1051 $               then
   1052 $                   if (f$locate("STATVFS", key2b) .eq. 0) .and. key2c .eqs. ""
   1053 $                   then
   1054 $                       keysym = f$edit(key2b, "LOWERCASE")
   1055 $                   endif
   1056 $!$                 if (key2b .eqs. "STATVFS" .or. key2b .eqs. "STATFS2" -
   1057 $!                      .or. key2b .eqs. "STATFS3") .and. key2c .nes. ""
   1058 $!
   1059 $                   if (key2b .eqs. "STATVFS") .and. key2c .nes. ""
   1060 $                   then
   1061 $!                      Should really verify that the structure
   1062 $!                      named by key2b actually exists first.
   1063 $!------------------------------------------------------------
   1064 $!
   1065 $!                      Statvfs structure members
   1066 $!-------------------------------------------------
   1067 $                       keysym = "f_" + f$edit(key2c,"LOWERCASE")
   1068 $                   endif
   1069 $               endif
   1070 $!
   1071 $!              UTMPX structure members
   1072 $!--------------------------------------
   1073 $               if key2b .eqs. "UT" .and. key2c .eqs. "UT"
   1074 $               then
   1075 $                   keysym = "ut_" + f$edit(key2d,"LOWERCASE")
   1076 $               endif
   1077 $!
   1078 $               if f$locate("MMAP",key2) .lt. key2_len
   1079 $               then
   1080 $                  write sys$output ""
   1081 $                  write sys$output -
   1082   "%CONFIG_H-I-NONPORT, ''key2' being asked for!"
   1083 $                  write sys$output -
   1084  "-CONFIG_H-I-MMAP, MMAP operations only work on STREAM and BINARY files!"
   1085 $                  write sys$output -
   1086  "-CONFIG_H-I-REVIEW, Manual Code review required!"
   1087 $                   if update_config_vms
   1088 $                   then
   1089 $                       open/append tfcv sys$disk:[]config_vms.h
   1090 $                       write tfcv ""
   1091 $                       write tfcv -
   1092                 "/* Check config.h for use of ''key2' settings */"
   1093 $                       write tfcv ""
   1094 $                       close tfcv
   1095 $                   endif
   1096 $               endif
   1097 $!
   1098 $!
   1099 $               if keysym .eqs. "CRYPT"
   1100 $               then
   1101 $                  write sys$output ""
   1102 $                  write sys$output -
   1103   "%CONFIG_H-I-NONPORT, ''key2' being asked for!"
   1104 $                  write sys$output -
   1105  "-CONFIG_H-I-CRYPT, CRYPT operations on the VMS SYSUAF may not work!"
   1106 $                  write sys$output -
   1107  "-CONFIG_H-I-REVIEW, Manual Code review required!"
   1108 $                   if update_config_vms
   1109 $                   then
   1110 $                       open/append tfcv sys$disk:[]config_vms.h
   1111 $                       write tfcv ""
   1112 $                       write tfcv -
   1113                 "/* Check config.h for use of ''keysym' */"
   1114 $                       write tfcv ""
   1115 $                       close tfcv
   1116 $                   endif
   1117 $               endif
   1118 $!
   1119 $!
   1120 $               if keysym .eqs. "EXECL"
   1121 $               then
   1122 $                  write sys$output ""
   1123 $                  write sys$output -
   1124   "%CONFIG_H-I-NONPORT, ''key2' being asked for!"
   1125 $                  write sys$output -
   1126  "-CONFIG_H-I-EXCEL, EXECL configured, Will probably not work."
   1127 $                  write sys$output -
   1128  "-CONFIG_H-I-REVIEW, Manual Code review required!"
   1129 $                   if update_config_vms
   1130 $                   then
   1131 $                       open/append tfcv sys$disk:[]config_vms.h
   1132 $                       write tfcv ""
   1133 $                       write tfcv -
   1134                 "/* Check config.h for use of ''keysym' */"
   1135 $                       write tfcv ""
   1136 $                       close tfcv
   1137 $                   endif
   1138 $               endif
   1139 $!
   1140 $!
   1141 $!              Process if cpp supports ANSI-C stringizing '#' operator
   1142 $!-----------------------------------------------------------------------
   1143 $               if keysym .eqs. "STRINGIZE"
   1144 $               then
   1145 $                   write tf "#ifndef HAVE_STRINGIZE"
   1146 $                   write tf "#define HAVE_STRINGSIZE 1"
   1147 $                   write tf "#endif"
   1148 $                   goto cfgh_in_loop1
   1149 $               endif
   1150 $!
   1151 $               if keysym .eqs. "VOLATILE"
   1152 $               then
   1153 $                   write tf "#ifndef HAVE_VOLATILE"
   1154 $                   write tf "#define HAVE_VOLATILE 1"
   1155 $                   write tf "#endif"
   1156 $                   goto cfgh_in_loop1
   1157 $               endif
   1158 $!
   1159 $               if keysym .eqs. "ALLOCA"
   1160 $               then
   1161 $                   write tf "#ifndef HAVE_ALLOCA"
   1162 $                   write tf "#define HAVE_ALLOCA 1"
   1163 $                   write tf "#endif"
   1164 $                   goto cfgh_in_loop1
   1165 $               endif
   1166 $!
   1167 $               if keysym .eqs. "ERRNO_DECL"
   1168 $               then
   1169 $                   write tf "#ifndef HAVE_ERRNO_DECL"
   1170 $                   write tf "#define HAVE_ERRNO_DECL 1"
   1171 $                   write tf "#endif"
   1172 $                   goto cfgh_in_loop1
   1173 $               endif
   1174 $!
   1175 $               if keysym .eqs. "LONGLONG"
   1176 $               then
   1177 $                   write tf "#ifndef __VAX"
   1178 $                   write tf "#pragma message disable longlongtype"
   1179 $                   write tf "#ifndef HAVE_LONGLONG"
   1180 $                   write tf "#define HAVE_LONGLONG 1"
   1181 $                   write tf "#endif"
   1182 $                   write tf "#endif"
   1183 $                   goto cfgh_in_loop1
   1184 $               endif
   1185 $!
   1186 $!              May need to test compiler version
   1187 $!-----------------------------------------------
   1188 $               if keysym .eqs. "LONG_LONG"
   1189 $               then
   1190 $                   write tf "#ifndef __VAX"
   1191 $                   write tf "#pragma message disable longlongtype"
   1192 $                   write tf "#ifndef HAVE_LONG_LONG"
   1193 $                   write tf "#define HAVE_LONG_LONG 1"
   1194 $                   write tf "#endif"
   1195 $                   write tf "#endif"
   1196 $                   goto cfgh_in_loop1
   1197 $               endif
   1198 $!
   1199 $!              May need to test compiler version
   1200 $!-----------------------------------------------
   1201 $               if keysym .eqs. "UNSIGNED_LONG_LONG"
   1202 $               then
   1203 $                   write tf "#ifndef __VAX"
   1204 $                   write tf "#pragma message disable longlongtype"
   1205 $                   write tf "#ifndef HAVE_UNSIGNED_LONG_LONG"
   1206 $                   write tf "#define HAVE_UNSIGNED_LONG_LONG 1"
   1207 $                   write tf "#endif"
   1208 $                   write tf "#endif"
   1209 $                   goto cfgh_in_loop1
   1210 $               endif
   1211 $!
   1212 $!              May need to test compiler version
   1213 $!-----------------------------------------------
   1214 $               if keysym .eqs. "UNSIGNED_LONG_LONG_INT"
   1215 $               then
   1216 $                   write tf "#ifndef __VAX"
   1217 $                   write tf "#pragma message disable longlongtype"
   1218 $                   write tf "#ifndef HAVE_UNSIGNED_LONG_LONG_INT"
   1219 $                   write tf "#define HAVE_UNSIGNED_LONG_LONG_INT 1"
   1220 $                   write tf "#endif"
   1221 $                   write tf "#endif"
   1222 $                   goto cfgh_in_loop1
   1223 $               endif
   1224 $!
   1225 $!              May need to test compiler version
   1226 $!-----------------------------------------------
   1227 $               if keysym .eqs. "LONG_DOUBLE"
   1228 $               then
   1229 $                   write tf "#ifndef __VAX"
   1230 $                   write tf "#pragma message disable longlongtype"
   1231 $                   write tf "#ifndef HAVE_LONG_DOUBLE"
   1232 $                   write tf "#define HAVE_LONG_DOUBLE 1"
   1233 $                   write tf "#endif"
   1234 $                   write tf "#endif"
   1235 $                   goto cfgh_in_loop1
   1236 $               endif
   1237 $!
   1238 $               if keysym .eqs. "FCNTL_LOCK"
   1239 $               then
   1240 $                   write sys$output -
   1241   "%CONFIG_H-I-NONPORT, ''key2' being asked for!
   1242 $                  write sys$output -
   1243  "-CONFIG_H-I-REVIEW, Manual Code review required!"
   1244 $                   goto cfgh_in_loop1
   1245 $               endif
   1246 $!
   1247 $!
   1248 $!              These libraries are provided by the DEC C RTL
   1249 $!-------------------------------------------------------------
   1250 $               if keysym .eqs. "LIBINET" .or. keysym .eqs. "LIBSOCKET"
   1251 $               then
   1252 $                   write tf "#ifndef HAVE_''keysym'"
   1253 $                   write tf "#define HAVE_''keysym' 1"
   1254 $if p2 .nes. "" then write sys$output "''decc_shr' #define ''keysym' 1"
   1255 $                   write tf "#endif
   1256 $                   goto cfgh_in_loop1
   1257 $               endif
   1258 $!
   1259 $               if keysym .eqs. "HERRNO" then keysym = "h_errno"
   1260 $               if keysym .eqs. "UTIMBUF" then keysym = "utimbuf"
   1261 $               if key2c .eqs. "STRUCT"
   1262 $               then
   1263 $                   keysym = f$edit(key2d,"LOWERCASE")
   1264 $               else
   1265 $                   if key2_h .eqs. "_T"
   1266 $                   then
   1267 $                       if key2_t .eqs. "_TYPE"
   1268 $                       then
   1269 $                           keysym = f$extract(0, key2_len - 5, key2) - "HAVE_"
   1270 $                       endif
   1271 $                       keysym = f$edit(keysym,"LOWERCASE")
   1272 $                   endif
   1273 $               endif
   1274 $!
   1275 $!              Check the DEC C RTL shared image first
   1276 $!------------------------------------------------------
   1277 $               if f$search(tfile1) .nes. "" then delete 'tfile1';*
   1278 $               define/user sys$output nl:
   1279 $               define/user sys$error nl:
   1280 $               search/format=nonull/out='tfile1' 'decc_shr' 'keysym'
   1281 $               if '$severity' .eq. 1
   1282 $               then
   1283 $!
   1284 $!                  Not documented, but from observation
   1285 $!------------------------------------------------------
   1286 $                   define/user sys$output nl:
   1287 $                   define/user sys$error nl:
   1288 $                   if arch_type .eq. 3
   1289 $                   then
   1290 $                       keyterm = "''keysym'<SOH>"
   1291 $                   else
   1292 $                       if arch_type .eq. 2
   1293 $                       then
   1294 $                           keyterm = "''keysym'<BS>"
   1295 $                       else
   1296 $                           keyterm = "''keysym'<STX>"
   1297 $                       endif
   1298 $                   endif
   1299 $                   search/out=nl: 'tfile1' -
   1300    "$''keyterm'","$g''keyterm'","$__utc_''keyterm'",-
   1301    "$__utctz_''keyterm'","$__bsd44_''keyterm'","$bsd_''keyterm'",-
   1302    "$''keysym'decc$","$G''keysym'decc$","$GX''keyterm'"
   1303 $                   severity = '$severity'
   1304 $!
   1305 $!
   1306 $!                  Of course the 64-bit stuff is different
   1307 $!---------------------------------------------------------
   1308 $                   if severity .ne. 1 .and. key64
   1309 $                   then
   1310 $                       define/user sys$output nl:
   1311 $                       define/user sys$error nl:
   1312 $                       search/out=nl: 'tfile1' "$_''keyterm'"
   1313 $!                      search/out 'tfile1' "$_''keyterm'"
   1314 $                       severity = '$severity'
   1315 $                   endif
   1316 $!
   1317 $!                  Unix compatibility routines
   1318 $!---------------------------------------------
   1319 $                   if severity .ne. 1
   1320 $                   then
   1321 $                       define/user sys$output nl:
   1322 $                       define/user sys$error nl:
   1323 $                       search/out=nl: 'tfile1' -
   1324     "$__unix_''keyterm'","$__vms_''keyterm'","$_posix_''keyterm'"
   1325 $                       severity = '$severity'
   1326 $                   endif
   1327 $!
   1328 $!                  Show the result of the search
   1329 $!------------------------------------------------
   1330 $                   if 'severity' .eq. 1
   1331 $                   then
   1332 $                       if key64 then write tf "#ifndef __VAX"
   1333 $                       write tf "#ifndef ''key2'"
   1334 $                       write tf "#define ''key2' 1"
   1335 $if p2 .nes. "" then write sys$output "''decc_shr' #define ''key2' 1"
   1336 $                       write tf "#endif"
   1337 $                       if key64 then write tf "#endif"
   1338 $                       goto cfgh_in_loop1
   1339 $                   endif
   1340 $               endif
   1341 $               if f$search(tfile1) .nes. "" then delete 'tfile1';*
   1342 $!
   1343 $!              Check the DECC Header files next
   1344 $!----------------------------------------------
   1345 $               define/user sys$output nl:
   1346 $               define/user sys$error nl:
   1347 $               search/out=nl: 'decc_rtldef' -
   1348                     "''keysym';", "''keysym'[", "struct ''keysym'"/exact
   1349 $               severity = '$severity'
   1350 $               if severity .eq. 1
   1351 $               then
   1352 $                   if key64 then write tf "#ifndef __VAX"
   1353 $                   write tf "#ifndef ''key2'"
   1354 $                   write tf "#define ''key2' 1"
   1355 $if p2 .nes. "" then write sys$output "''decc_rtldef' #define ''key2' 1"
   1356 $                   write tf "#endif"
   1357 $                   if key64 then write tf "#endif"
   1358 $                   goto cfgh_in_loop1
   1359 $               endif
   1360 $!
   1361 $!              Check kerberos
   1362 $!--------------------------------------------
   1363 $               if f$search("SYS$SYSROOT:[kerberos]include.dir") .nes. ""
   1364 $               then
   1365 $                   test_mit = "SYS$SYSROOT:[kerberos.include]gssapi_krb5.h"
   1366 $                   if (key2 .eqs. "HAVE_GSSAPI")
   1367 $                   then
   1368 $                       write tf "#ifndef ''key2'"
   1369 $                       write tf "#define ''key2' 1"
   1370 $                       write tf "#endif"
   1371 $                       goto cfgh_in_loop1
   1372 $                   endif
   1373 $               endif
   1374 $!
   1375 $           endif
   1376 $           write tf "/* ", xline, " */"
   1377 $           goto cfgh_in_loop1
   1378 $       endif
   1379 $!
   1380 $!
   1381 $!      Process SIZEOF directives found in SAMBA and others
   1382 $!----------------------------------------------------------
   1383 $       if key2a .eqs. "SIZEOF"
   1384 $       then
   1385 $           if key2b .eqs. "INO" .and. key2_h .eqs. "_T"
   1386 $           then
   1387 $               write tf "#ifndef SIZEOF_INO_T"
   1388 $               write tf "#if !__USING_STD_STAT
   1389 $               write tf "#define SIZEOF_INO_T 6"
   1390 $               write tf "#else
   1391 $               write tf "#define SIZEOF_INO_T 8"
   1392 $               write tf "#endif
   1393 $               write tf "#endif"
   1394 $               goto cfgh_in_loop1
   1395 $           endif
   1396 $           if key2b .eqs. "INTMAX" .and. key2_h .eqs. "_T"
   1397 $           then
   1398 $               write tf "#ifndef SIZEOF_INTMAX_T"
   1399 $               write tf "#ifdef __VAX"
   1400 $               write tf "#define SIZEOF_INTMAX_T 4"
   1401 $               write tf "#else"
   1402 $               write tf "#define SIZEOF_INTMAX_T 8"
   1403 $               write tf "#endif"
   1404 $               write tf "#endif"
   1405 $               goto cfgh_in_loop1
   1406 $           endif
   1407 $           if key2b .eqs. "OFF" .and. key2_h .eqs. "_T"
   1408 $           then
   1409 $               write tf "#ifndef SIZEOF_OFF_T"
   1410 $               write tf "#if __USE_OFF64_T"
   1411 $               write tf "#define SIZEOF_OFF_T 8"
   1412 $               write tf "#else"
   1413 $               write tf "#define SIZEOF_OFF_T 4"
   1414 $               write tf "#endif"
   1415 $               write tf "#endif"
   1416 $               goto cfgh_in_loop1
   1417 $           endif
   1418 $           if key2b .eqs. "CHAR" .and. key2_h .eqs. "_P"
   1419 $           then
   1420 $               write tf "#ifndef SIZEOF_CHAR_P"
   1421 $               write tf "#if __INITIAL_POINTER_SIZE == 64"
   1422 $               write tf "#define SIZEOF_CHAR_P 8"
   1423 $               write tf "#else"
   1424 $               write tf "#define SIZEOF_CHAR_P 4"
   1425 $               write tf "#endif"
   1426 $               goto cfgh_in_loop1
   1427 $           endif
   1428 $           if key2b .eqs. "VOIDP"
   1429 $           then
   1430 $               write tf "#ifndef SIZEOF_VOIDP"
   1431 $               write tf "#if __INITIAL_POINTER_SIZE == 64"
   1432 $               write tf "#define SIZEOF_VOIDP 8"
   1433 $               write tf "#else"
   1434 $               write tf "#define SIZEOF_VOIDP 4"
   1435 $               write tf "#endif"
   1436 $               write tf "#endif"
   1437 $               goto cfgh_in_loop1
   1438 $           endif
   1439 $           if key2b .eqs. "INT"
   1440 $           then
   1441 $               write tf "#ifndef SIZEOF_INT"
   1442 $               write tf "#define SIZEOF_INT 4"
   1443 $               write tf "#endif"
   1444 $               goto cfgh_in_loop1
   1445 $           endif
   1446 $           if key2b .eqs. "SIZE" .and. key2_h .eqs. "_T"
   1447 $           then
   1448 $               write tf "#ifndef SIZEOF_SIZE_T"
   1449 $               write tf "#define SIZEOF_SIZE_T 4"
   1450 $               write tf "#endif"
   1451 $               goto cfgh_in_loop1
   1452 $           endif
   1453 $           if key2b .eqs. "TIME" .and. key2_h .eqs. "_T"
   1454 $           then
   1455 $               write tf "#ifndef SIZEOF_TIME_T"
   1456 $               write tf "#define SIZEOF_TIME_T 4"
   1457 $               write tf "#endif"
   1458 $               goto cfgh_in_loop1
   1459 $           endif
   1460 $           if key2b .eqs. "DOUBLE"
   1461 $           then
   1462 $               write tf "#ifndef SIZEOF_DOUBLE"
   1463 $               write tf "#define SIZEOF_DOUBLE 8"
   1464 $               write tf "#endif"
   1465 $               goto cfgh_in_loop1
   1466 $           endif
   1467 $           if key2b .eqs. "LONG"
   1468 $           then
   1469 $               if key2c .eqs. ""
   1470 $               then
   1471 $                   write tf "#ifndef SIZEOF_LONG"
   1472 $                   write tf "#define SIZEOF_LONG 4"
   1473 $                   write tf "#endif"
   1474 $               else
   1475 $                   write tf "#ifndef SIZEOF_LONG_LONG"
   1476 $                   write tf "#ifndef __VAX"
   1477 $                   write tf "#define SIZEOF_LONG_LONG 8"
   1478 $                   write tf "#endif"
   1479 $                   write tf "#endif"
   1480 $               endif
   1481 $               goto cfgh_in_loop1
   1482 $           endif
   1483 $           write tf "/* ", xline, " */"
   1484 $           goto cfgh_in_loop1
   1485 $       endif
   1486 $!
   1487 $!      Process NEED directives
   1488 $!-------------------------------
   1489 $       if key2a .eqs. "NEED"
   1490 $       then
   1491 $           if key2b .eqs. "STRINGS" .and. key2_h .eqs. "_H"
   1492 $           then
   1493 $               write tf "#ifndef NEED_STRINGS_H"
   1494 $               write tf "#define NEED_STRINGS_H 1"
   1495 $               write tf "#endif"
   1496 $               goto cfgh_in_loop1
   1497 $           endif
   1498 $           write tf "/* ", xline, " */"
   1499 $           goto cfgh_in_loop1
   1500 $       endif
   1501 $!
   1502 $!      Process GETHOSTNAME directives
   1503 $!-------------------------------------
   1504 $       if key2 .eqs. "GETHOSTNAME_TYPE_ARG2"
   1505 $       then
   1506 $           write tf "#ifndef ''key2'"
   1507 $           write tf "#ifdef _DECC_V4_SOURCE"
   1508 $           write tf "#define ''key2' int"
   1509 $           write tf "#else"
   1510 $           write tf "#define ''key2' size_t"
   1511 $           write tf "#endif"
   1512 $           write tf "#endif"
   1513 $           goto cfgh_in_loop1
   1514 $       endif
   1515 $!
   1516 $!      Process GETNAMEINFO directives
   1517 $!-------------------------------------
   1518 $       if key2a .eqs. "GETNAMEINFO"
   1519 $       then
   1520 $           if key2 .eqs. "GETNAMEINFO_QUAL_ARG1"
   1521 $           then
   1522 $               write tf "#ifndef ''key2'"
   1523 $               write tf "#define ''key2' const"
   1524 $               write tf "#endif"
   1525 $               goto cfgh_in_loop1
   1526 $           endif
   1527 $           if key2 .eqs. "GETNAMEINFO_TYPE_ARG1"
   1528 $           then
   1529 $               write tf "#ifndef ''key2'"
   1530 $               write tf "#define ''key2' struct sockaddr *"
   1531 $               write tf "#endif"
   1532 $               goto cfgh_in_loop1
   1533 $           endif
   1534 $           if key2 .eqs. "GETNAMEINFO_TYPE_ARG2"
   1535 $           then
   1536 $               write tf "#ifndef ''key2'"
   1537 $               write tf "#define ''key2' size_t"
   1538 $               write tf "#endif"
   1539 $               goto cfgh_in_loop1
   1540 $           endif
   1541 $           if key2 .eqs. "GETNAMEINFO_TYPE_ARG46"
   1542 $           then
   1543 $               write tf "#ifndef ''key2'"
   1544 $               write tf "#define ''key2' size_t"
   1545 $               write tf "#endif"
   1546 $               goto cfgh_in_loop1
   1547 $           endif
   1548 $           if key2 .eqs. "GETNAMEINFO_TYPE_ARG7"
   1549 $           then
   1550 $               write tf "#ifndef ''key2'"
   1551 $               write tf "#define ''key2' int"
   1552 $               write tf "#endif"
   1553 $               goto cfgh_in_loop1
   1554 $           endif
   1555 $       endif
   1556 $!
   1557 $!      Process RECV directives
   1558 $!-------------------------------------
   1559 $       if key2a .eqs. "RECV"
   1560 $       then
   1561 $           if key2 .eqs. "RECV_TYPE_ARG1"
   1562 $           then
   1563 $               write tf "#ifndef ''key2'"
   1564 $               write tf "#define ''key2' int"
   1565 $               write tf "#endif"
   1566 $               goto cfgh_in_loop1
   1567 $           endif
   1568 $           if key2 .eqs. "RECV_TYPE_ARG2"
   1569 $           then
   1570 $               write tf "#ifndef ''key2'"
   1571 $               write tf "#define ''key2' void *"
   1572 $               write tf "#endif"
   1573 $               goto cfgh_in_loop1
   1574 $           endif
   1575 $           if key2 .eqs. "RECV_TYPE_ARG3"
   1576 $           then
   1577 $               write tf "#ifndef ''key2'"
   1578 $               write tf "#define ''key2' size_t"
   1579 $               write tf "#endif"
   1580 $               goto cfgh_in_loop1
   1581 $           endif
   1582 $           if key2 .eqs. "RECV_TYPE_ARG4"
   1583 $           then
   1584 $               write tf "#ifndef ''key2'"
   1585 $               write tf "#define ''key2' int"
   1586 $               write tf "#endif"
   1587 $               goto cfgh_in_loop1
   1588 $           endif
   1589 $           if key2 .eqs. "RECV_TYPE_RETV"
   1590 $           then
   1591 $               write tf "#ifndef ''key2'"
   1592 $               write tf "#define ''key2' int"
   1593 $               write tf "#endif"
   1594 $               goto cfgh_in_loop1
   1595 $           endif
   1596 $       endif
   1597 $!
   1598 $!      Process SEND directives
   1599 $!-------------------------------------
   1600 $       if key2a .eqs. "SEND"
   1601 $       then
   1602 $           if key2 .eqs. "SEND_QUAL_ARG2"
   1603 $           then
   1604 $               write tf "#ifndef ''key2'"
   1605 $               write tf "#define ''key2' const"
   1606 $               write tf "#endif"
   1607 $               goto cfgh_in_loop1
   1608 $           endif
   1609 $           if key2 .eqs. "SEND_TYPE_ARG1"
   1610 $           then
   1611 $               write tf "#ifndef ''key2'"
   1612 $               write tf "#define ''key2' int"
   1613 $               write tf "#endif"
   1614 $               goto cfgh_in_loop1
   1615 $           endif
   1616 $           if key2 .eqs. "SEND_TYPE_ARG2"
   1617 $           then
   1618 $               write tf "#ifndef ''key2'"
   1619 $               write tf "#define ''key2' void *"
   1620 $               write tf "#endif"
   1621 $               goto cfgh_in_loop1
   1622 $           endif
   1623 $           if key2 .eqs. "SEND_TYPE_ARG3"
   1624 $           then
   1625 $               write tf "#ifndef ''key2'"
   1626 $               write tf "#define ''key2' size_t"
   1627 $               write tf "#endif"
   1628 $               goto cfgh_in_loop1
   1629 $           endif
   1630 $           if key2 .eqs. "SEND_TYPE_ARG4"
   1631 $           then
   1632 $               write tf "#ifndef ''key2'"
   1633 $               write tf "#define ''key2' int"
   1634 $               write tf "#endif"
   1635 $               goto cfgh_in_loop1
   1636 $           endif
   1637 $           if key2 .eqs. "SEND_TYPE_RETV"
   1638 $           then
   1639 $               write tf "#ifndef ''key2'"
   1640 $               write tf "#define ''key2' int"
   1641 $               write tf "#endif"
   1642 $               goto cfgh_in_loop1
   1643 $           endif
   1644 $       endif
   1645 $!
   1646 $!
   1647 $!      Process STATFS directives
   1648 $!-------------------------------
   1649 $!      if key2a .eqs. "STATFS"
   1650 $!      then
   1651 $!          write tf "/* ", xline, " */"
   1652 $!          goto cfgh_in_loop1
   1653 $!      endif
   1654 $!
   1655 $!      Process inline directive
   1656 $!------------------------------
   1657 $       if key2 .eqs. "inline"
   1658 $       then
   1659 $           write tf "#ifndef inline"
   1660 $           write tf "#define inline __inline"
   1661 $           write tf "#endif"
   1662 $           goto cfgh_in_loop1
   1663 $       endif
   1664 $!
   1665 $!      Process restrict directive
   1666 $!--------------------------------
   1667 $       if key2 .eqs. "restrict"
   1668 $       then
   1669 $           write tf "#ifndef restrict"
   1670 $           write tf "#define restrict __restrict"
   1671 $           write tf "#endif"
   1672 $           goto cfgh_in_loop1
   1673 $       endif
   1674 $!
   1675 $!      Process STDC_HEADERS (SAMBA!)
   1676 $!---------------------------
   1677 $       if key2 .eqs. "STDC_HEADERS"
   1678 $       then
   1679 $           write tf "#ifndef STDC_HEADERS"
   1680 $           write tf "#define STDC_HEADERS 1"
   1681 $           write tf "#endif"
   1682 $           goto cfgh_in_loop1
   1683 $       endif
   1684 $!
   1685 $!      Process PROTOTYPES directive
   1686 $!-------------------------------------
   1687 $       if key2 .eqs. "PROTOTYPES"
   1688 $       then
   1689 $           write tf "#ifndef PROTOTYPES"
   1690 $           write tf "#define PROTOTYPES 1"
   1691 $           write tf "#endif"
   1692 $           goto cfgh_in_loop1
   1693 $       endif
   1694 $!
   1695 $!      Special for SEEKDIR_RETURNS_VOID
   1696 $!---------------------------------------
   1697 $       if key2 .eqs. "SEEKDIR_RETURNS_VOID"
   1698 $       then
   1699 $           write tf "#ifndef SEEKDIR_RETURNS_VOID"
   1700 $           write tf "#define SEEKDIR_RETURNS_VOID 1"
   1701 $           write tf "#endif"
   1702 $       endif
   1703 $!
   1704 $!      Unknown - See if CONFIGURE can give a clue for this
   1705 $!----------------------------------------------------------
   1706 $       pflag = 0
   1707 $       set_flag = 0
   1708 $!      gproj_name = proj_name - "_VMS" - "-VMS"
   1709 $       if f$search(tfile1) .nes. "" then delete 'tfile1';*
   1710 $       define/user sys$output nl:
   1711 $       define/user sys$error nl:
   1712 $!      if f$locate("FILE", key2) .lt. key2_len then pflag = 1
   1713 $!      if f$locate("DIR", key2) .eq. key2_len - 3 then pflag = 1
   1714 $!      if f$locate("PATH", key2) .eq. key2_len - 4 then pflag = 1
   1715 $!
   1716 $       search/out='tfile1' 'configure_script' "''key2'="/exact
   1717 $       search_sev = '$severity'
   1718 $       if 'search_sev' .eq. 1
   1719 $       then
   1720 $           open/read/err=unknown_cf_rd_error sf 'tfile1'
   1721 $search_file_rd_loop:
   1722 $           read/end=unknown_cf_rd_err sf line_in
   1723 $           line_in = f$edit(line_in, "TRIM")
   1724 $           skey1 = f$element(0,"=",line_in)
   1725 $           if skey1 .eqs. key2
   1726 $           then
   1727 $               skey2 = f$element(1,"=",line_in)
   1728 $               skey2a = f$extract(0,2,skey2)
   1729 $!
   1730 $!
   1731 $!              We can not handle assignment to shell symbols.
   1732 $!              For now skip them.
   1733 $!------------------------------------------------------------
   1734 $               if f$locate("$", skey2) .lt. f$length(skey2)
   1735 $               then
   1736 $                   write tf "/* ", xline, " */"
   1737 $                   set_flag = 1
   1738 $                   goto found_in_configure
   1739 $               endif
   1740 $!
   1741 $!              Keep these two cases separate to make it easier to add
   1742 $!              more future intelligence to this routine
   1743 $!----------------------------------------------------------------------
   1744 $               if skey2a .eqs. """`"
   1745 $               then
   1746 $!                  if pflag .eq. 1
   1747 $!                  then
   1748 $!                      write tf "#ifndef ''key2'"
   1749 $!                      write tf "#define ",key2," """,gproj_name,"_",key2,""""
   1750 $!                      write tf "#endif"
   1751 $!                  else
   1752 $!                      Ignore this for now
   1753 $!------------------------------------------
   1754 $                       write tf "/* ", xline, " */"
   1755 $!                  endif
   1756 $                   set_flag = 1
   1757 $                   goto found_in_configure
   1758 $               endif
   1759 $               if skey2a .eqs. """$"
   1760 $               then
   1761 $!                  if pflag .eq. 1
   1762 $!                  then
   1763 $!                      write tf "#ifndef ''key2'"
   1764 $!                      write tf "#define ",key2," """,gproj_name,"_",key2,""""
   1765 $!                      write tf "#endif"
   1766 $!                  else
   1767 $!                      Ignore this for now
   1768 $!-------------------------------------------
   1769 $                       write tf "/* ", xline, " */"
   1770 $!                  endif
   1771 $                   set_flag = 1
   1772 $                   goto found_in_configure
   1773 $               endif
   1774 $!
   1775 $!              Remove multiple layers of quotes if present
   1776 $!----------------------------------------------------------
   1777 $               if f$extract(0, 1, skey2) .eqs. "'"
   1778 $               then
   1779 $                   skey2 = skey2 - "'" - "'" - "'" - "'"
   1780 $               endif
   1781 $               if f$extract(0, 1, skey2) .eqs. """"
   1782 $               then
   1783 $                   skey2 = skey2 - """" - """" - """" - """"
   1784 $               endif
   1785 $               write tf "#ifndef ''key2'"
   1786 $               if skey2 .eqs. ""
   1787 $               then
   1788 $                   write tf "#define ",key2
   1789 $               else
   1790 $!                  Only quote non-numbers
   1791 $!----------------------------------------
   1792 $                   if f$string(skey2+0) .eqs. skey2
   1793 $                   then
   1794 $                       write tf "#define ",key2," ",skey2
   1795 $                   else
   1796 $                       write tf "#define ",key2," """,skey2,""""
   1797 $                   endif
   1798 $               endif
   1799 $               write tf "#endif"
   1800 $               set_flag = 1
   1801 $           else
   1802 $               goto search_file_rd_loop
   1803 $!              if pflag .eq. 1
   1804 $!              then
   1805 $!                  write tf "#ifndef ''key2'"
   1806 $!                  write tf "#define ",key2," """,gproj_name,"_",key2,""""
   1807 $!                  write tf "#endif"
   1808 $!                  set_flag = 1
   1809 $!              endif
   1810 $           endif
   1811 $found_in_configure:
   1812 $unknown_cf_rd_err:
   1813 $           if f$trnlnm("sf","lnm$process",,"SUPERVISOR") .nes. ""
   1814 $           then
   1815 $               close sf
   1816 $           endif
   1817 $           if f$search(tfile1) .nes. "" then delete 'tfile1';*
   1818 $           if set_flag .eq. 1 then goto cfgh_in_loop1
   1819 $       endif
   1820 $   endif
   1821 $!
   1822 $!
   1823 $!
   1824 $!  If it falls through everything else, comment it out
   1825 $!-----------------------------------------------------
   1826 $   write tf "/* ", xline, " */"
   1827 $   goto cfgh_in_loop1
   1828 $cfgh_in_loop1_end:
   1829 $close inf
   1830 $!
   1831 $!
   1832 $! Write out the tail
   1833 $!--------------------
   1834 $write_tail:
   1835 $gosub write_config_h_tail
   1836 $!
   1837 $! Exit and clean up
   1838 $!--------------------
   1839 $general_error:
   1840 $status = '$status'
   1841 $all_exit:
   1842 $set noon
   1843 $if f$trnlnm("sf","lnm$process",,"SUPERVISOR") .nes. "" then close sf
   1844 $if f$trnlnm("tf","lnm$process",,"SUPERVISOR") .nes. "" then close tf
   1845 $if f$trnlnm("inf","lnm$process",,"SUPERVISOR") .nes. "" then close inf
   1846 $if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1
   1847 $if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2
   1848 $if f$trnlnm("tfcv","lnm$process",,"SUPERVISOR") .nes. "" then close tfcv
   1849 $if f$type(tfile1) .eqs. "STRING"
   1850 $then
   1851 $   if f$search(tfile1) .nes. "" then delete 'tfile1';*
   1852 $endif
   1853 $if f$type(dchfile) .eqs. "STRING"
   1854 $then
   1855 $   if f$search(dchfile) .nes. "" then delete 'dchfile';*
   1856 $endif
   1857 $if f$type(starhfile) .eqs. "STRING"
   1858 $then
   1859 $   if f$search(starhfile) .nes. "" then delete 'starhfile';*
   1860 $endif
   1861 $if f$type(configure_script) .eqs. "STRING"
   1862 $then
   1863 $   if f$search(configure_script) .nes. "" then delete 'configure_script';*
   1864 $endif
   1865 $exit 'status'
   1866 $!
   1867 $!
   1868 $control_y:
   1869 $   status = ss_control_y
   1870 $   goto all_exit
   1871 $!
   1872 $!
   1873 $!
   1874 $! Gosub to write a new config_vms.h
   1875 $!-----------------------------------
   1876 $write_config_vms:
   1877 $outfile = "sys$disk:[]config_vms.h"
   1878 $create 'outfile'
   1879 $open/append tf 'outfile'
   1880 $write tf "/* File: config_vms.h"
   1881 $write tf "**"
   1882 $write tf "** This file contains the manual edits needed for porting"
   1883 $!write tf "** the ''proj_name' package to OpenVMS.
   1884 $write tf "**"
   1885 $write tf "** Edit this file as needed.  The procedure that automatically"
   1886 $write tf "** generated this header stub will not overwrite or make any"
   1887 $write tf "** changes to this file."
   1888 $write tf "**"
   1889 $write tf -
   1890  "** ", datetime, tab, username, tab, "Generated by ''my_proc_file'"
   1891 $write tf "**"
   1892 $write tf -
   1893  "**========================================================================*/"
   1894 $write tf ""
   1895 $close tf
   1896 $return
   1897 $!
   1898 $! gosub to write out a documentation header for config.h
   1899 $!----------------------------------------------------------------
   1900 $write_config_h_header:
   1901 $outfile = "sys$disk:[]config.h"
   1902 $create 'outfile'
   1903 $open/append tf 'outfile'
   1904 $write tf "#ifndef CONFIG_H"
   1905 $write tf "#define CONFIG_H"
   1906 $write tf "/* File: config.h"
   1907 $write tf "**"
   1908 $write tf -
   1909   "** This file contains the options needed for porting "
   1910 $write tf "** the project on a VMS system."
   1911 $write tf "**"
   1912 $write tf "** Try not to make any edits to this file, as it is"
   1913 $write tf "** automagically generated."
   1914 $write tf "**"
   1915 $write tf "** Manual edits should be made to the config_vms.h file."
   1916 $write tf "**"
   1917 $write tf -
   1918  "** ", datetime, tab, username, tab, "Generated by ''my_proc_file'"
   1919 $write tf "**"
   1920 $write tf -
   1921  "**========================================================================*/"
   1922 $write tf ""
   1923 $write tf "#if (__CRTL_VER >= 70200000) && !defined (__VAX)"
   1924 $write tf "#define _LARGEFILE 1"
   1925 $write tf "#endif"
   1926 $write tf ""
   1927 $write tf "#ifndef __VAX"
   1928 $write tf "#ifdef __CRTL_VER"
   1929 $write tf "#if __CRTL_VER >= 80200000"
   1930 $write tf "#define _USE_STD_STAT 1"
   1931 $write tf "#endif"
   1932 $write tf "#endif"
   1933 $write tf "#endif"
   1934 $write tf ""
   1935 $!
   1936 $write tf " /* Allow compiler builtins */"
   1937 $write tf "/*-------------------------*/"
   1938 $write tf "#ifdef __DECC_VER"
   1939 $write tf "#include <non_existent_dir:builtins.h>"
   1940 $write tf "#endif"
   1941 $!
   1942 $write tf ""
   1943 $return
   1944 $!
   1945 $! gosub to write out the tail for config.h and close it
   1946 $!---------------------------------------------------------
   1947 $write_config_h_tail:
   1948 $write tf ""
   1949 $write tf " /* Include the hand customized settings */"
   1950 $write tf "/*--------------------------------------*/"
   1951 $write tf "#include ""config_vms.h"""
   1952 $write tf ""
   1953 $write tf "#endif /* CONFIG_H */"
   1954 $close tf
   1955 $return
   1956 $!