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_STRTOLL" 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_STRTOUL" 637$ then 638$ write tf "#ifndef ''key2'" 639$ write tf "#define ''key2' 1" 640$ write tf "#endif" 641$ goto cfgh_in_loop1 642$ endif 643$! 644$ if key2 .eqs. "HAVE_DECL_STRTOULL" 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. "HAVE_DECL_STRTOUMAX" 653$ then 654$ write tf "#ifndef ''key2'" 655$ write tf "#define ''key2' 0" 656$ write tf "#endif" 657$ goto cfgh_in_loop1 658$ endif 659$! 660$ if key2 .eqs. "GETPGRP_VOID" 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. "NAMED_PIPES_MISSING" 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. "OPENDIR_NOT_ROBUST" 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. "PGRP_PIPE" 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. "CAN_REDEFINE_GETENV" 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_PRINTF_A_FORMAT" 701$ then 702$ write tf "#ifndef ''key2'" 703$ write tf "#define ''key2' 1" 704$ write tf "#endif" 705$ goto cfgh_in_loop1 706$ endif 707$! 708$ if key2 .eqs. "CTYPE_NON_ASCII" 709$ then 710$ write tf "#ifndef ''key2'" 711$ write tf "#define ''key2' 1" 712$ write tf "#endif" 713$ goto cfgh_in_loop1 714$ endif 715$! 716$ if key2 .eqs. "HAVE_LANGINFO_CODESET" 717$ then 718$ write tf "#ifndef ''key2'" 719$ write tf "#define ''key2' 0" 720$ write tf "#endif" 721$ goto cfgh_in_loop1 722$ endif 723$! 724$! This wants execve() to do this automagically to pass. 725$! if key2 .eqs. "HAVE_HASH_BANG_EXEC" 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. "ICONV_CONST" 734$ then 735$ write tf "#ifndef ''key2'" 736$ write tf "#define ''key2'" 737$ write tf "#endif" 738$ goto cfgh_in_loop1 739$ endif 740$! 741$ if key2 .eqs. "VOID_SIGHANDLER" 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 key2 .eqs. "HAVE_POSIX_SIGNALS" 750$ then 751$ write tf "#ifndef ''key2'" 752$ write tf "#define ''key2' 1" 753$ write tf "#endif" 754$ goto cfgh_in_loop1 755$ endif 756$! 757$ if key2 .eqs. "UNUSABLE_RT_SIGNALS" 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 key2a .eqs. "HAVE_DECL_FPURGE" 766$ then 767$ write tf "#ifndef ''key2a'" 768$ write tf "#define ''key2a' 1" 769$ write tf "#endif" 770$ goto cfgh_in_loop1 771$ endif 772$! 773$ if key2 .eqs. "HAVE_DECL_SETREGID" 774$ then 775$ write tf "#ifndef ''key2'" 776$ write tf "#define ''key2' 1" 777$ write tf "#endif" 778$ goto cfgh_in_loop1 779$ endif 780$! 781$ if key2 .eqs. "HAVE_POSIX_SIGSETJMP" 782$ then 783$ write tf "#ifndef ''key2'" 784$ write tf "#define ''key2' 1" 785$ write tf "#endif" 786$ goto cfgh_in_loop1 787$ endif 788$! 789$ if key2b .eqs. "RAND" .and. key2c .nes. "" .and. key2d .eqs. "" 790$ then 791$ if (key2c .eqs. "EGD") .or. - 792 (key2c .eqs. "STATUS") .or. - 793 (key2c .eqs. "SCREEN") 794$ then 795$ if f$search("''ssl_header_dir'rand.h") .nes. "" 796$ then 797$ write tf "#ifndef ''key2'" 798$ write tf "#define ''key2' 1" 799$ write tf "#endif" 800$ else 801$ write tf "/* #undef ''key2' */" 802$ endif 803$ endif 804$ endif 805$! 806$ if key2 .eqs. "STRCOLL_BROKEN" 807$ then 808$ write tf "#ifndef ''key2'" 809$ write tf "#define ''key2' 1" 810$ write tf "#endif" 811$ goto cfgh_in_loop1 812$ endif 813$! 814$ if key2 .eqs. "DUP_BROKEN" 815$ then 816$ write tf "#ifndef ''key2'" 817$ write tf "#define ''key2' 1" 818$ write tf "#endif" 819$ goto cfgh_in_loop1 820$ endif 821$! 822$! This is for a test that getcwd(0,0) works. 823$! It does not on VMS. 824$!-------------------------- 825$ if key2 .eqs. "GETCWD_BROKEN" 826$ then 827$ write sys$output "" 828$ write sys$output - 829 "%CONFIG_H-I-NONPORT, ''key2' being tested for!" 830$ write sys$output - 831 "-CONFIG_H-I-GETCWD, GETCWD(0,0) does not work on VMS." 832$ write sys$output - 833 "-CONFIG_H-I-GETCWD2, Work around hack probably required." 834$ write sys$output - 835 "-CONFIG_H-I-REVIEW, Manual Code review required!" 836$ if update_config_vms 837$ then 838$ open/append tfcv sys$disk:[]config_vms.h 839$ write tfcv "" 840$ write tfcv - 841 "/* Check config.h for use of ''key2' settings */" 842$ write tfcv "" 843$ close tfcv 844$ endif 845$ 846$ goto cfgh_in_loop1 847$ endif 848$! 849$ if (key2a .eqs. "HAVE") .or. (key2a .eqs. "STAT") .or. - 850 (key2 .eqs. "ENABLE_IPV6") .or. (key2b .eqs. "LDAP") 851$ then 852$! 853$! Process extra underscores 854$!------------------------------------ 855$ if f$locate("HAVE___", key2) .lt. key2_len 856$ then 857$ key2b = "__" + key2d 858$ key2d = "" 859$ double_under = 1 860$ else 861$ if f$locate("HAVE__", key2) .lt. key2_len 862$ then 863$ key2b = "_" + key2c 864$ key2c = "" 865$ double_under = 1 866$ endif 867$ endif 868$! 869$ if (key2_h .eqs. "_H") .or. (key2 .eqs. "ENABLE_IPV6") .or. - 870 (key2b .eqs. "LDAP") 871$ then 872$! 873$! Looking for a header file 874$!--------------------------------------- 875$ headf = key2b 876$ if key2c .nes. "" then headf = headf + "_" + key2c 877$ if key2d .nes. "" then headf = headf + "_" + key2d 878$! 879$! (key2b .eqs. "READLINE") 880$! 881$! Some special parsing 882$!------------------------------------------ 883$ if (key2b .eqs. "SYS") .or. (key2b .eqs. "ARPA") .or. - 884 (key2b .eqs. "NET") .or. (key2b .eqs. "NETINET") 885$ then 886$ if key2c .nes. "" 887$ then 888$ headf = key2c 889$ if key2d .nes. "" then headf = key2c + "_" + key2d 890$ endif 891$ endif 892$! 893$! And of course what's life with out some special cases 894$!-------------------------------------------------------------------- 895$ if key2 .eqs. "ENABLE_IPV6" 896$ then 897$ headf = "in6" 898$ endif 899$! 900$ if key2b .eqs. "LDAP" 901$ then 902$ if (key2 .eqs. "HAVE_LDAP_SSL") .or. - 903 (key2 .eqs. "HAVE_LDAP_URL_PARSE") 904$ then 905$ headf = "ldap" 906$ endif 907$ endif 908$! 909$! 910$ if key2b .eqs. "FILE" 911$ then 912$ write sys$output "" 913$ write sys$output - 914 "%CONFIG_H-I-NONPORT, ''key2' being asked for!" 915$ write sys$output - 916 "-CONFIG_H-I-FILE_OLD, file.h will not be configured as is obsolete!" 917$ write sys$output - 918 "-CONFIG_H_I-FCNTL_NEW, "Expecting fcntl.h to be configured instead!" 919$ write sys$output - 920 "-CONFIG_H_I-FCNTL_CHK, "Unable to verify at this time!" 921$ write sys$output - 922 "-CONFIG_H-I-REVIEW, Manual Code review required!" 923$! 924$ if update_config_vms 925$ then 926$ open/append tfcv sys$disk:[]config_vms.h 927$ write tfcv "" 928$ write tfcv - 929 "/* Check config.h for use of fcntl.h instead of file.h */" 930$ write tfcv "" 931$ close tfcv 932$ endif 933$ endif 934$! 935$! Now look it up in the DEC C RTL 936$!--------------------------------------------- 937$ define/user sys$output nl: 938$ define/user sys$error nl: 939$ search/output=nl: 'dchfile' |'headf'|/exact 940$ if '$severity' .eq. 1 941$ then 942$ if key64 then write tf "#ifndef __VAX" 943$ write tf "#ifndef ''key2'" 944$ write tf "#define ''key2' 1" 945$if p2 .nes. "" then write sys$output "''dchfile' - #define ''key2' 1" 946$ write tf "#endif" 947$ if key64 then write tf "#endif" 948$set nover 949$ goto cfgh_in_loop1 950$ endif 951$! 952$! 953$! Now look it up in the DEC C STARLET_C 954$!--------------------------------------------- 955$ define/user sys$output nl: 956$ define/user sys$error nl: 957$ search/output=nl: 'starhfile' |'headf'|/exact 958$ if '$severity' .eq. 1 959$ then 960$ if key64 then write tf "#ifndef __VAX" 961$ write tf "#ifndef ''key2'" 962$ write tf "#define ''key2' 1" 963$if p2 .nes. "" then write sys$output "''starfile' - #define ''key2' 1" 964$ write tf "#endif" 965$ if key64 then write tf "#endif" 966$set nover 967$ goto cfgh_in_loop1 968$ endif 969$! 970$! Now look for OPENSSL headers 971$!--------------------------------------------------------- 972$ if key2b .eqs. "OPENSSL" 973$ then 974$ headf = headf - "OPENSSL_" 975$ header = f$search("''ssl_header_dir'''headf'.h") 976$ if header .nes. "" 977$ then 978$ write tf "#ifndef ''key2'" 979$ write tf "#define ''key2' 1" 980$ write tf "#endif" 981$set nover 982$ goto cfgh_in_loop1 983$ endif 984$ endif 985$! 986$! Now look for Kerberos 987$!------------------------------------------------------------ 988$ if key2b .eqs. "GSSAPI" 989$ then 990$ header_dir = "sys$sysroot:[kerberos.include]" 991$ headf = headf - "GSSAPI_" 992$ header = f$search("''header_dir'''headf'.h") 993$ if header .nes. "" 994$ then 995$ write tf "#ifndef ''key2'" 996$ write tf "#define ''key2' 1" 997$ write tf "#endif" 998$set nover 999$ goto cfgh_in_loop1 1000$ endif 1001$ endif 1002$! 1003$set nover 1004$ else 1005$! 1006$! Looking for a routine or a symbol 1007$!------------------------------------------------ 1008$ if key2c .eqs. "MACRO" 1009$ then 1010$ if (key2b .eqs. "FILE") .or. (key2b .eqs. "DATE") - 1011 .or. (key2b .eqs. "LINE") .or. (key2b .eqs. "TIME") 1012$ then 1013$ write tf "#ifndef HAVE_''key2b'" 1014$ write tf "#define HAVE_''key2b' 1" 1015$ write tf "#endif" 1016$ endif 1017$ goto cfgh_in_loop1 1018$ endif 1019$! 1020$! Special false tests 1021$!------------------------------------- 1022$ if double_under 1023$ then 1024$ if key2b .eqs. "_FCNTL" .or. key2b .eqs. "__FCNTL" 1025$ then 1026$ write tf "/* #undef HAVE_''key2b' */" 1027$ goto cfgh_in_loop1 1028$ endif 1029$! 1030$ if key2b .eqs. "_STAT" .or. key2b .eqs. "__STAT" 1031$ then 1032$ write tf "/* #undef HAVE_''key2b' */" 1033$ goto cfgh_in_loop1 1034$ endif 1035$! 1036$ if key2b .eqs. "_READ" .or. key2b .eqs. "__READ" 1037$ then 1038$ write tf "/* #undef HAVE_''key2b' */" 1039$ goto cfgh_in_loop1 1040$ endif 1041$ endif 1042$! 1043$ keysym = key2b 1044$ if key2c .nes. "" then keysym = keysym + "_" + key2c 1045$ if key2d .nes. "" then keysym = keysym + "_" + key2d 1046$ if key2e .nes. "" then keysym = keysym + "_" + key2e 1047$! 1048$! 1049$! Stat structure members 1050$!------------------------------------- 1051$ if key2b .eqs. "STRUCT" 1052$ then 1053$ if key2c .eqs. "STAT" .and (key2d .nes. "") 1054$ then 1055$ key2b = key2b + "_" + key2c + "_" + key2d 1056$ key2c = key2e 1057$ key2d = "" 1058$ key2e = "" 1059$ endif 1060$ endif 1061$ if (key2b .eqs. "ST") .or. (key2b .eqs. "STRUCT_STAT_ST") 1062$ then 1063$ keysym = "ST" + "_" + key2c 1064$ keysym = f$edit(keysym,"LOWERCASE") 1065$ endif 1066$ if key2a .eqs. "STAT" 1067$ then 1068$ if (f$locate("STATVFS", key2b) .eq. 0) .and. key2c .eqs. "" 1069$ then 1070$ keysym = f$edit(key2b, "LOWERCASE") 1071$ endif 1072$!$ if (key2b .eqs. "STATVFS" .or. key2b .eqs. "STATFS2" - 1073$! .or. key2b .eqs. "STATFS3") .and. key2c .nes. "" 1074$! 1075$ if (key2b .eqs. "STATVFS") .and. key2c .nes. "" 1076$ then 1077$! Should really verify that the structure 1078$! named by key2b actually exists first. 1079$!------------------------------------------------------------ 1080$! 1081$! Statvfs structure members 1082$!------------------------------------------------- 1083$ keysym = "f_" + f$edit(key2c,"LOWERCASE") 1084$ endif 1085$ endif 1086$! 1087$! UTMPX structure members 1088$!-------------------------------------- 1089$ if key2b .eqs. "UT" .and. key2c .eqs. "UT" 1090$ then 1091$ keysym = "ut_" + f$edit(key2d,"LOWERCASE") 1092$ endif 1093$! 1094$ if f$locate("MMAP",key2) .lt. key2_len 1095$ then 1096$ write sys$output "" 1097$ write sys$output - 1098 "%CONFIG_H-I-NONPORT, ''key2' being asked for!" 1099$ write sys$output - 1100 "-CONFIG_H-I-MMAP, MMAP operations only work on STREAM and BINARY files!" 1101$ write sys$output - 1102 "-CONFIG_H-I-REVIEW, Manual Code review required!" 1103$ if update_config_vms 1104$ then 1105$ open/append tfcv sys$disk:[]config_vms.h 1106$ write tfcv "" 1107$ write tfcv - 1108 "/* Check config.h for use of ''key2' settings */" 1109$ write tfcv "" 1110$ close tfcv 1111$ endif 1112$ endif 1113$! 1114$! 1115$ if keysym .eqs. "CRYPT" 1116$ then 1117$ write sys$output "" 1118$ write sys$output - 1119 "%CONFIG_H-I-NONPORT, ''key2' being asked for!" 1120$ write sys$output - 1121 "-CONFIG_H-I-CRYPT, CRYPT operations on the VMS SYSUAF may not work!" 1122$ write sys$output - 1123 "-CONFIG_H-I-REVIEW, Manual Code review required!" 1124$ if update_config_vms 1125$ then 1126$ open/append tfcv sys$disk:[]config_vms.h 1127$ write tfcv "" 1128$ write tfcv - 1129 "/* Check config.h for use of ''keysym' */" 1130$ write tfcv "" 1131$ close tfcv 1132$ endif 1133$ endif 1134$! 1135$! 1136$ if keysym .eqs. "EXECL" 1137$ then 1138$ write sys$output "" 1139$ write sys$output - 1140 "%CONFIG_H-I-NONPORT, ''key2' being asked for!" 1141$ write sys$output - 1142 "-CONFIG_H-I-EXCEL, EXECL configured, Will probably not work." 1143$ write sys$output - 1144 "-CONFIG_H-I-REVIEW, Manual Code review required!" 1145$ if update_config_vms 1146$ then 1147$ open/append tfcv sys$disk:[]config_vms.h 1148$ write tfcv "" 1149$ write tfcv - 1150 "/* Check config.h for use of ''keysym' */" 1151$ write tfcv "" 1152$ close tfcv 1153$ endif 1154$ endif 1155$! 1156$! 1157$! Process if cpp supports ANSI-C stringizing '#' operator 1158$!----------------------------------------------------------------------- 1159$ if keysym .eqs. "STRINGIZE" 1160$ then 1161$ write tf "#ifndef HAVE_STRINGIZE" 1162$ write tf "#define HAVE_STRINGSIZE 1" 1163$ write tf "#endif" 1164$ goto cfgh_in_loop1 1165$ endif 1166$! 1167$ if keysym .eqs. "VOLATILE" 1168$ then 1169$ write tf "#ifndef HAVE_VOLATILE" 1170$ write tf "#define HAVE_VOLATILE 1" 1171$ write tf "#endif" 1172$ goto cfgh_in_loop1 1173$ endif 1174$! 1175$ if keysym .eqs. "ALLOCA" 1176$ then 1177$ write tf "#ifndef HAVE_ALLOCA" 1178$ write tf "#define HAVE_ALLOCA 1" 1179$ write tf "#endif" 1180$ goto cfgh_in_loop1 1181$ endif 1182$! 1183$ if keysym .eqs. "ERRNO_DECL" 1184$ then 1185$ write tf "#ifndef HAVE_ERRNO_DECL" 1186$ write tf "#define HAVE_ERRNO_DECL 1" 1187$ write tf "#endif" 1188$ goto cfgh_in_loop1 1189$ endif 1190$! 1191$ if keysym .eqs. "LONGLONG" 1192$ then 1193$ write tf "#ifndef __VAX" 1194$ write tf "#pragma message disable longlongtype" 1195$ write tf "#ifndef HAVE_LONGLONG" 1196$ write tf "#define HAVE_LONGLONG 1" 1197$ write tf "#endif" 1198$ write tf "#endif" 1199$ goto cfgh_in_loop1 1200$ endif 1201$! 1202$! May need to test compiler version 1203$!----------------------------------------------- 1204$ if keysym .eqs. "LONG_LONG" 1205$ then 1206$ write tf "#ifndef __VAX" 1207$ write tf "#pragma message disable longlongtype" 1208$ write tf "#ifndef HAVE_LONG_LONG" 1209$ write tf "#define HAVE_LONG_LONG 1" 1210$ write tf "#endif" 1211$ write tf "#endif" 1212$ goto cfgh_in_loop1 1213$ endif 1214$! 1215$! May need to test compiler version 1216$!----------------------------------------------- 1217$ if keysym .eqs. "UNSIGNED_LONG_LONG" 1218$ then 1219$ write tf "#ifndef __VAX" 1220$ write tf "#pragma message disable longlongtype" 1221$ write tf "#ifndef HAVE_UNSIGNED_LONG_LONG" 1222$ write tf "#define HAVE_UNSIGNED_LONG_LONG 1" 1223$ write tf "#endif" 1224$ write tf "#endif" 1225$ goto cfgh_in_loop1 1226$ endif 1227$! 1228$! May need to test compiler version 1229$!----------------------------------------------- 1230$ if keysym .eqs. "UNSIGNED_LONG_LONG_INT" 1231$ then 1232$ write tf "#ifndef __VAX" 1233$ write tf "#pragma message disable longlongtype" 1234$ write tf "#ifndef HAVE_UNSIGNED_LONG_LONG_INT" 1235$ write tf "#define HAVE_UNSIGNED_LONG_LONG_INT 1" 1236$ write tf "#endif" 1237$ write tf "#endif" 1238$ goto cfgh_in_loop1 1239$ endif 1240$! 1241$! May need to test compiler version 1242$!----------------------------------------------- 1243$ if keysym .eqs. "LONG_DOUBLE" 1244$ then 1245$ write tf "#ifndef __VAX" 1246$ write tf "#pragma message disable longlongtype" 1247$ write tf "#ifndef HAVE_LONG_DOUBLE" 1248$ write tf "#define HAVE_LONG_DOUBLE 1" 1249$ write tf "#endif" 1250$ write tf "#endif" 1251$ goto cfgh_in_loop1 1252$ endif 1253$! 1254$ if keysym .eqs. "FCNTL_LOCK" 1255$ then 1256$ write sys$output - 1257 "%CONFIG_H-I-NONPORT, ''key2' being asked for! 1258$ write sys$output - 1259 "-CONFIG_H-I-REVIEW, Manual Code review required!" 1260$ goto cfgh_in_loop1 1261$ endif 1262$! 1263$! 1264$! These libraries are provided by the DEC C RTL 1265$!------------------------------------------------------------- 1266$ if keysym .eqs. "LIBINET" .or. keysym .eqs. "LIBSOCKET" 1267$ then 1268$ write tf "#ifndef HAVE_''keysym'" 1269$ write tf "#define HAVE_''keysym' 1" 1270$if p2 .nes. "" then write sys$output "''decc_shr' #define ''keysym' 1" 1271$ write tf "#endif 1272$ goto cfgh_in_loop1 1273$ endif 1274$! 1275$ if keysym .eqs. "HERRNO" then keysym = "h_errno" 1276$ if keysym .eqs. "UTIMBUF" then keysym = "utimbuf" 1277$ if key2c .eqs. "STRUCT" 1278$ then 1279$ keysym = f$edit(key2d,"LOWERCASE") 1280$ else 1281$ if key2_h .eqs. "_T" 1282$ then 1283$ if key2_t .eqs. "_TYPE" 1284$ then 1285$ keysym = f$extract(0, key2_len - 5, key2) - "HAVE_" 1286$ endif 1287$ keysym = f$edit(keysym,"LOWERCASE") 1288$ endif 1289$ endif 1290$! 1291$! Check the DEC C RTL shared image first 1292$!------------------------------------------------------ 1293$ if f$search(tfile1) .nes. "" then delete 'tfile1';* 1294$ define/user sys$output nl: 1295$ define/user sys$error nl: 1296$ search/format=nonull/out='tfile1' 'decc_shr' 'keysym' 1297$ if '$severity' .eq. 1 1298$ then 1299$! 1300$! Not documented, but from observation 1301$!------------------------------------------------------ 1302$ define/user sys$output nl: 1303$ define/user sys$error nl: 1304$ if arch_type .eq. 3 1305$ then 1306$ keyterm = "''keysym'<SOH>" 1307$ else 1308$ if arch_type .eq. 2 1309$ then 1310$ keyterm = "''keysym'<BS>" 1311$ else 1312$ keyterm = "''keysym'<STX>" 1313$ endif 1314$ endif 1315$ search/out=nl: 'tfile1' - 1316 "$''keyterm'","$g''keyterm'","$__utc_''keyterm'",- 1317 "$__utctz_''keyterm'","$__bsd44_''keyterm'","$bsd_''keyterm'",- 1318 "$''keysym'decc$","$G''keysym'decc$","$GX''keyterm'" 1319$ severity = '$severity' 1320$! 1321$! 1322$! Of course the 64 bit stuff is different 1323$!--------------------------------------------------------- 1324$ if severity .ne. 1 .and. key64 1325$ then 1326$ define/user sys$output nl: 1327$ define/user sys$error nl: 1328$ search/out=nl: 'tfile1' "$_''keyterm'" 1329$! search/out 'tfile1' "$_''keyterm'" 1330$ severity = '$severity' 1331$ endif 1332$! 1333$! Unix compatibility routines 1334$!--------------------------------------------- 1335$ if severity .ne. 1 1336$ then 1337$ define/user sys$output nl: 1338$ define/user sys$error nl: 1339$ search/out=nl: 'tfile1' - 1340 "$__unix_''keyterm'","$__vms_''keyterm'","$_posix_''keyterm'" 1341$ severity = '$severity' 1342$ endif 1343$! 1344$! Show the result of the search 1345$!------------------------------------------------ 1346$ if 'severity' .eq. 1 1347$ then 1348$ if key64 then write tf "#ifndef __VAX" 1349$ write tf "#ifndef ''key2'" 1350$ write tf "#define ''key2' 1" 1351$if p2 .nes. "" then write sys$output "''decc_shr' #define ''key2' 1" 1352$ write tf "#endif" 1353$ if key64 then write tf "#endif" 1354$ goto cfgh_in_loop1 1355$ endif 1356$ endif 1357$ if f$search(tfile1) .nes. "" then delete 'tfile1';* 1358$! 1359$! Check the DECC Header files next 1360$!---------------------------------------------- 1361$ define/user sys$output nl: 1362$ define/user sys$error nl: 1363$ search/out=nl: 'decc_rtldef' - 1364 "''keysym';", "''keysym'[", "struct ''keysym'"/exact 1365$ severity = '$severity' 1366$ if severity .eq. 1 1367$ then 1368$ if key64 then write tf "#ifndef __VAX" 1369$ write tf "#ifndef ''key2'" 1370$ write tf "#define ''key2' 1" 1371$if p2 .nes. "" then write sys$output "''decc_rtldef' #define ''key2' 1" 1372$ write tf "#endif" 1373$ if key64 then write tf "#endif" 1374$ goto cfgh_in_loop1 1375$ endif 1376$! 1377$! Check kerberos 1378$!-------------------------------------------- 1379$ if f$search("SYS$SYSROOT:[kerberos]include.dir") .nes. "" 1380$ then 1381$ test_mit = "SYS$SYSROOT:[kerberos.include]gssapi_krb5.h" 1382$ if (key2 .eqs. "HAVE_GSSAPI") 1383$ then 1384$ write tf "#ifndef ''key2'" 1385$ write tf "#define ''key2' 1" 1386$ write tf "#endif" 1387$ goto cfgh_in_loop1 1388$ endif 1389$! 1390$! This is really do we have the newer MIT Kerberos 1391$!---------------------------------------------------------------------- 1392$ if (key2 .eqs. "HAVE_GSSMIT") 1393$ then 1394$ if f$search(test_mit) .nes. "" 1395$ then 1396$ write tf "#ifndef ''key2'" 1397$ write tf "#define ''key2' 1" 1398$ else 1399$ write tf "#ifdef ''key2'" 1400$ write tf "#undef ''key2'" 1401$ endif 1402$ write tf "#endif" 1403$ goto cfgh_in_loop1 1404$ endif 1405$! 1406$! Older MIT looks like Heimdal 1407$!------------------------------------------------ 1408$ if (key2 .eqs. "HAVE_HEIMDAL") 1409$ then 1410$ if f$search(test_mit) .eqs. "" 1411$ then 1412$ write tf "#ifndef ''key2'" 1413$ write tf "#define ''key2' 1" 1414$ else 1415$ write tf "#ifdef ''key2'" 1416$ write tf "#undef ''key2'" 1417$ endif 1418$ write tf "#endif" 1419$ goto cfgh_in_loop1 1420$ endif 1421$ endif 1422$! 1423$ endif 1424$ write tf "/* ", xline, " */" 1425$ goto cfgh_in_loop1 1426$ endif 1427$! 1428$! 1429$! Process SIZEOF directives found in SAMBA and others 1430$!---------------------------------------------------------- 1431$ if key2a .eqs. "SIZEOF" 1432$ then 1433$ if key2b .eqs. "INO" .and. key2_h .eqs. "_T" 1434$ then 1435$ write tf "#ifndef SIZEOF_INO_T" 1436$ write tf "#if !__USING_STD_STAT 1437$ write tf "#define SIZEOF_INO_T 6" 1438$ write tf "#else 1439$ write tf "#define SIZEOF_INO_T 8" 1440$ write tf "#endif 1441$ write tf "#endif" 1442$ goto cfgh_in_loop1 1443$ endif 1444$ if key2b .eqs. "INTMAX" .and. key2_h .eqs. "_T" 1445$ then 1446$ write tf "#ifndef SIZEOF_INTMAX_T" 1447$ write tf "#ifdef __VAX" 1448$ write tf "#define SIZEOF_INTMAX_T 4" 1449$ write tf "#else" 1450$ write tf "#define SIZEOF_INTMAX_T 8" 1451$ write tf "#endif" 1452$ write tf "#endif" 1453$ goto cfgh_in_loop1 1454$ endif 1455$ if key2b .eqs. "OFF" .and. key2_h .eqs. "_T" 1456$ then 1457$ write tf "#ifndef SIZEOF_OFF_T" 1458$ write tf "#if __USE_OFF64_T" 1459$ write tf "#define SIZEOF_OFF_T 8" 1460$ write tf "#else" 1461$ write tf "#define SIZEOF_OFF_T 4" 1462$ write tf "#endif" 1463$ write tf "#endif" 1464$ goto cfgh_in_loop1 1465$ endif 1466$ if key2b .eqs. "CHAR" .and. key2_h .eqs. "_P" 1467$ then 1468$ write tf "#ifndef SIZEOF_CHAR_P" 1469$ write tf "#if __INITIAL_POINTER_SIZE == 64" 1470$ write tf "#define SIZEOF_CHAR_P 8" 1471$ write tf "#else" 1472$ write tf "#define SIZEOF_CHAR_P 4" 1473$ write tf "#endif" 1474$ goto cfgh_in_loop1 1475$ endif 1476$ if key2b .eqs. "VOIDP" 1477$ then 1478$ write tf "#ifndef SIZEOF_VOIDP" 1479$ write tf "#if __INITIAL_POINTER_SIZE == 64" 1480$ write tf "#define SIZEOF_VOIDP 8" 1481$ write tf "#else" 1482$ write tf "#define SIZEOF_VOIDP 4" 1483$ write tf "#endif" 1484$ write tf "#endif" 1485$ goto cfgh_in_loop1 1486$ endif 1487$ if key2b .eqs. "INT" 1488$ then 1489$ write tf "#ifndef SIZEOF_INT" 1490$ write tf "#define SIZEOF_INT 4" 1491$ write tf "#endif" 1492$ goto cfgh_in_loop1 1493$ endif 1494$ if key2b .eqs. "SIZE" .and. key2_h .eqs. "_T" 1495$ then 1496$ write tf "#ifndef SIZEOF_SIZE_T" 1497$ write tf "#define SIZEOF_SIZE_T 4" 1498$ write tf "#endif" 1499$ goto cfgh_in_loop1 1500$ endif 1501$ if key2b .eqs. "TIME" .and. key2_h .eqs. "_T" 1502$ then 1503$ write tf "#ifndef SIZEOF_TIME_T" 1504$ write tf "#define SIZEOF_TIME_T 4" 1505$ write tf "#endif" 1506$ goto cfgh_in_loop1 1507$ endif 1508$ if key2b .eqs. "DOUBLE" 1509$ then 1510$ write tf "#ifndef SIZEOF_DOUBLE" 1511$ write tf "#define SIZEOF_DOUBLE 8" 1512$ write tf "#endif" 1513$ goto cfgh_in_loop1 1514$ endif 1515$ if key2b .eqs. "LONG" 1516$ then 1517$ if key2c .eqs. "" 1518$ then 1519$ write tf "#ifndef SIZEOF_LONG" 1520$ write tf "#define SIZEOF_LONG 4" 1521$ write tf "#endif" 1522$ else 1523$ write tf "#ifndef SIZEOF_LONG_LONG" 1524$ write tf "#ifndef __VAX" 1525$ write tf "#define SIZEOF_LONG_LONG 8" 1526$ write tf "#endif" 1527$ write tf "#endif" 1528$ endif 1529$ goto cfgh_in_loop1 1530$ endif 1531$ write tf "/* ", xline, " */" 1532$ goto cfgh_in_loop1 1533$ endif 1534$! 1535$! Process NEED directives 1536$!------------------------------- 1537$ if key2a .eqs. "NEED" 1538$ then 1539$ if key2b .eqs. "STRINGS" .and. key2_h .eqs. "_H" 1540$ then 1541$ write tf "#ifndef NEED_STRINGS_H" 1542$ write tf "#define NEED_STRINGS_H 1" 1543$ write tf "#endif" 1544$ goto cfgh_in_loop1 1545$ endif 1546$ write tf "/* ", xline, " */" 1547$ goto cfgh_in_loop1 1548$ endif 1549$! 1550$! Process GETHOSTNAME directives 1551$!------------------------------------- 1552$ if key2 .eqs. "GETHOSTNAME_TYPE_ARG2" 1553$ then 1554$ write tf "#ifndef ''key2'" 1555$ write tf "#ifdef _DECC_V4_SOURCE" 1556$ write tf "#define ''key2' int" 1557$ write tf "#else" 1558$ write tf "#define ''key2' size_t" 1559$ write tf "#endif" 1560$ write tf "#endif" 1561$ goto cfgh_in_loop1 1562$ endif 1563$! 1564$! Process GETNAMEINFO directives 1565$!------------------------------------- 1566$ if key2a .eqs. "GETNAMEINFO" 1567$ then 1568$ if key2 .eqs. "GETNAMEINFO_QUAL_ARG1" 1569$ then 1570$ write tf "#ifndef ''key2'" 1571$ write tf "#define ''key2' const" 1572$ write tf "#endif" 1573$ goto cfgh_in_loop1 1574$ endif 1575$ if key2 .eqs. "GETNAMEINFO_TYPE_ARG1" 1576$ then 1577$ write tf "#ifndef ''key2'" 1578$ write tf "#define ''key2' struct sockaddr *" 1579$ write tf "#endif" 1580$ goto cfgh_in_loop1 1581$ endif 1582$ if key2 .eqs. "GETNAMEINFO_TYPE_ARG2" 1583$ then 1584$ write tf "#ifndef ''key2'" 1585$ write tf "#define ''key2' size_t" 1586$ write tf "#endif" 1587$ goto cfgh_in_loop1 1588$ endif 1589$ if key2 .eqs. "GETNAMEINFO_TYPE_ARG46" 1590$ then 1591$ write tf "#ifndef ''key2'" 1592$ write tf "#define ''key2' size_t" 1593$ write tf "#endif" 1594$ goto cfgh_in_loop1 1595$ endif 1596$ if key2 .eqs. "GETNAMEINFO_TYPE_ARG7" 1597$ then 1598$ write tf "#ifndef ''key2'" 1599$ write tf "#define ''key2' int" 1600$ write tf "#endif" 1601$ goto cfgh_in_loop1 1602$ endif 1603$ endif 1604$! 1605$! Process RECV directives 1606$!------------------------------------- 1607$ if key2a .eqs. "RECV" 1608$ then 1609$ if key2 .eqs. "RECV_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. "RECV_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. "RECV_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. "RECV_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. "RECV_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$! Process SEND directives 1647$!------------------------------------- 1648$ if key2a .eqs. "SEND" 1649$ then 1650$ if key2 .eqs. "SEND_QUAL_ARG2" 1651$ then 1652$ write tf "#ifndef ''key2'" 1653$ write tf "#define ''key2' const" 1654$ write tf "#endif" 1655$ goto cfgh_in_loop1 1656$ endif 1657$ if key2 .eqs. "SEND_TYPE_ARG1" 1658$ then 1659$ write tf "#ifndef ''key2'" 1660$ write tf "#define ''key2' int" 1661$ write tf "#endif" 1662$ goto cfgh_in_loop1 1663$ endif 1664$ if key2 .eqs. "SEND_TYPE_ARG2" 1665$ then 1666$ write tf "#ifndef ''key2'" 1667$ write tf "#define ''key2' void *" 1668$ write tf "#endif" 1669$ goto cfgh_in_loop1 1670$ endif 1671$ if key2 .eqs. "SEND_TYPE_ARG3" 1672$ then 1673$ write tf "#ifndef ''key2'" 1674$ write tf "#define ''key2' size_t" 1675$ write tf "#endif" 1676$ goto cfgh_in_loop1 1677$ endif 1678$ if key2 .eqs. "SEND_TYPE_ARG4" 1679$ then 1680$ write tf "#ifndef ''key2'" 1681$ write tf "#define ''key2' int" 1682$ write tf "#endif" 1683$ goto cfgh_in_loop1 1684$ endif 1685$ if key2 .eqs. "SEND_TYPE_RETV" 1686$ then 1687$ write tf "#ifndef ''key2'" 1688$ write tf "#define ''key2' int" 1689$ write tf "#endif" 1690$ goto cfgh_in_loop1 1691$ endif 1692$ endif 1693$! 1694$! 1695$! Process STATFS directives 1696$!------------------------------- 1697$! if key2a .eqs. "STATFS" 1698$! then 1699$! write tf "/* ", xline, " */" 1700$! goto cfgh_in_loop1 1701$! endif 1702$! 1703$! Process inline directive 1704$!------------------------------ 1705$ if key2 .eqs. "inline" 1706$ then 1707$ write tf "#ifndef inline" 1708$ write tf "#define inline __inline" 1709$ write tf "#endif" 1710$ goto cfgh_in_loop1 1711$ endif 1712$! 1713$! Process restrict directive 1714$!-------------------------------- 1715$ if key2 .eqs. "restrict" 1716$ then 1717$ write tf "#ifndef restrict" 1718$ write tf "#define restrict __restrict" 1719$ write tf "#endif" 1720$ goto cfgh_in_loop1 1721$ endif 1722$! 1723$! Process STDC_HEADERS (SAMBA!) 1724$!--------------------------- 1725$ if key2 .eqs. "STDC_HEADERS" 1726$ then 1727$ write tf "#ifndef STDC_HEADERS" 1728$ write tf "#define STDC_HEADERS 1" 1729$ write tf "#endif" 1730$ goto cfgh_in_loop1 1731$ endif 1732$! 1733$! Process PROTOTYPES directive 1734$!------------------------------------- 1735$ if key2 .eqs. "PROTOTYPES" 1736$ then 1737$ write tf "#ifndef PROTOTYPES" 1738$ write tf "#define PROTOTYPES 1" 1739$ write tf "#endif" 1740$ goto cfgh_in_loop1 1741$ endif 1742$! 1743$! Special for SEEKDIR_RETURNS_VOID 1744$!--------------------------------------- 1745$ if key2 .eqs. "SEEKDIR_RETURNS_VOID" 1746$ then 1747$ write tf "#ifndef SEEKDIR_RETURNS_VOID" 1748$ write tf "#define SEEKDIR_RETURNS_VOID 1" 1749$ write tf "#endif" 1750$ endif 1751$! 1752$! Unknown - See if CONFIGURE can give a clue for this 1753$!---------------------------------------------------------- 1754$ pflag = 0 1755$ set_flag = 0 1756$! gproj_name = proj_name - "_VMS" - "-VMS" 1757$ if f$search(tfile1) .nes. "" then delete 'tfile1';* 1758$ define/user sys$output nl: 1759$ define/user sys$error nl: 1760$! if f$locate("FILE", key2) .lt. key2_len then pflag = 1 1761$! if f$locate("DIR", key2) .eq. key2_len - 3 then pflag = 1 1762$! if f$locate("PATH", key2) .eq. key2_len - 4 then pflag = 1 1763$! 1764$ search/out='tfile1' 'configure_script' "''key2'="/exact 1765$ search_sev = '$severity' 1766$ if 'search_sev' .eq. 1 1767$ then 1768$ open/read/err=unknown_cf_rd_error sf 'tfile1' 1769$search_file_rd_loop: 1770$ read/end=unknown_cf_rd_err sf line_in 1771$ line_in = f$edit(line_in, "TRIM") 1772$ skey1 = f$element(0,"=",line_in) 1773$ if skey1 .eqs. key2 1774$ then 1775$ skey2 = f$element(1,"=",line_in) 1776$ skey2a = f$extract(0,2,skey2) 1777$! 1778$! 1779$! We can not handle assignment to shell symbols. 1780$! For now skip them. 1781$!------------------------------------------------------------ 1782$ if f$locate("$", skey2) .lt. f$length(skey2) 1783$ then 1784$ write tf "/* ", xline, " */" 1785$ set_flag = 1 1786$ goto found_in_configure 1787$ endif 1788$! 1789$! Keep these two cases separate to make it easier to add 1790$! more future intelligence to this routine 1791$!---------------------------------------------------------------------- 1792$ if skey2a .eqs. """`" 1793$ then 1794$! if pflag .eq. 1 1795$! then 1796$! write tf "#ifndef ''key2'" 1797$! write tf "#define ",key2," """,gproj_name,"_",key2,"""" 1798$! write tf "#endif" 1799$! else 1800$! Ignore this for now 1801$!------------------------------------------ 1802$ write tf "/* ", xline, " */" 1803$! endif 1804$ set_flag = 1 1805$ goto found_in_configure 1806$ endif 1807$ if skey2a .eqs. """$" 1808$ then 1809$! if pflag .eq. 1 1810$! then 1811$! write tf "#ifndef ''key2'" 1812$! write tf "#define ",key2," """,gproj_name,"_",key2,"""" 1813$! write tf "#endif" 1814$! else 1815$! Ignore this for now 1816$!------------------------------------------- 1817$ write tf "/* ", xline, " */" 1818$! endif 1819$ set_flag = 1 1820$ goto found_in_configure 1821$ endif 1822$! 1823$! Remove multiple layers of quotes if present 1824$!---------------------------------------------------------- 1825$ if f$extract(0, 1, skey2) .eqs. "'" 1826$ then 1827$ skey2 = skey2 - "'" - "'" - "'" - "'" 1828$ endif 1829$ if f$extract(0, 1, skey2) .eqs. """" 1830$ then 1831$ skey2 = skey2 - """" - """" - """" - """" 1832$ endif 1833$ write tf "#ifndef ''key2'" 1834$ if skey2 .eqs. "" 1835$ then 1836$ write tf "#define ",key2 1837$ else 1838$! Only quote non-numbers 1839$!---------------------------------------- 1840$ if f$string(skey2+0) .eqs. skey2 1841$ then 1842$ write tf "#define ",key2," ",skey2 1843$ else 1844$ write tf "#define ",key2," """,skey2,"""" 1845$ endif 1846$ endif 1847$ write tf "#endif" 1848$ set_flag = 1 1849$ else 1850$ goto search_file_rd_loop 1851$! if pflag .eq. 1 1852$! then 1853$! write tf "#ifndef ''key2'" 1854$! write tf "#define ",key2," """,gproj_name,"_",key2,"""" 1855$! write tf "#endif" 1856$! set_flag = 1 1857$! endif 1858$ endif 1859$found_in_configure: 1860$unknown_cf_rd_err: 1861$ if f$trnlnm("sf","lnm$process",,"SUPERVISOR") .nes. "" 1862$ then 1863$ close sf 1864$ endif 1865$ if f$search(tfile1) .nes. "" then delete 'tfile1';* 1866$ if set_flag .eq. 1 then goto cfgh_in_loop1 1867$ endif 1868$ endif 1869$! 1870$! 1871$! 1872$! If it falls through everything else, comment it out 1873$!----------------------------------------------------- 1874$ write tf "/* ", xline, " */" 1875$ goto cfgh_in_loop1 1876$cfgh_in_loop1_end: 1877$close inf 1878$! 1879$! 1880$! Write out the tail 1881$!-------------------- 1882$write_tail: 1883$gosub write_config_h_tail 1884$! 1885$! Exit and clean up 1886$!-------------------- 1887$general_error: 1888$status = '$status' 1889$all_exit: 1890$set noon 1891$if f$trnlnm("sf","lnm$process",,"SUPERVISOR") .nes. "" then close sf 1892$if f$trnlnm("tf","lnm$process",,"SUPERVISOR") .nes. "" then close tf 1893$if f$trnlnm("inf","lnm$process",,"SUPERVISOR") .nes. "" then close inf 1894$if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1 1895$if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2 1896$if f$trnlnm("tfcv","lnm$process",,"SUPERVISOR") .nes. "" then close tfcv 1897$if f$type(tfile1) .eqs. "STRING" 1898$then 1899$ if f$search(tfile1) .nes. "" then delete 'tfile1';* 1900$endif 1901$if f$type(dchfile) .eqs. "STRING" 1902$then 1903$ if f$search(dchfile) .nes. "" then delete 'dchfile';* 1904$endif 1905$if f$type(starhfile) .eqs. "STRING" 1906$then 1907$ if f$search(starhfile) .nes. "" then delete 'starhfile';* 1908$endif 1909$if f$type(configure_script) .eqs. "STRING" 1910$then 1911$ if f$search(configure_script) .nes. "" then delete 'configure_script';* 1912$endif 1913$exit 'status' 1914$! 1915$! 1916$control_y: 1917$ status = ss_control_y 1918$ goto all_exit 1919$! 1920$! 1921$! 1922$! Gosub to write a new config_vms.h 1923$!----------------------------------- 1924$write_config_vms: 1925$outfile = "sys$disk:[]config_vms.h" 1926$create 'outfile' 1927$open/append tf 'outfile' 1928$write tf "/* File: config_vms.h" 1929$write tf "**" 1930$write tf "** This file contains the manual edits needed for porting" 1931$!write tf "** the ''proj_name' package to OpenVMS. 1932$write tf "**" 1933$write tf "** Edit this file as needed. The procedure that automatically" 1934$write tf "** generated this header stub will not overwrite or make any" 1935$write tf "** changes to this file." 1936$write tf "**" 1937$write tf - 1938 "** ", datetime, tab, username, tab, "Generated by ''my_proc_file'" 1939$write tf "**" 1940$write tf - 1941 "**========================================================================*/" 1942$write tf "" 1943$close tf 1944$return 1945$! 1946$! gosub to write out a documentation header for config.h 1947$!---------------------------------------------------------------- 1948$write_config_h_header: 1949$outfile = "sys$disk:[]config.h" 1950$create 'outfile' 1951$open/append tf 'outfile' 1952$write tf "#ifndef CONFIG_H" 1953$write tf "#define CONFIG_H" 1954$write tf "/* File: config.h" 1955$write tf "**" 1956$write tf - 1957 "** This file contains the options needed for porting " 1958$write tf "** the project on a VMS system." 1959$write tf "**" 1960$write tf "** Try not to make any edits to this file, as it is" 1961$write tf "** automagically generated." 1962$write tf "**" 1963$write tf "** Manual edits should be made to the config_vms.h file." 1964$write tf "**" 1965$write tf - 1966 "** ", datetime, tab, username, tab, "Generated by ''my_proc_file'" 1967$write tf "**" 1968$write tf - 1969 "**========================================================================*/" 1970$write tf "" 1971$write tf "#if (__CRTL_VER >= 70200000) && !defined (__VAX)" 1972$write tf "#define _LARGEFILE 1" 1973$write tf "#endif" 1974$write tf "" 1975$write tf "#ifndef __VAX" 1976$write tf "#ifdef __CRTL_VER" 1977$write tf "#if __CRTL_VER >= 80200000" 1978$write tf "#define _USE_STD_STAT 1" 1979$write tf "#endif" 1980$write tf "#endif" 1981$write tf "#endif" 1982$write tf "" 1983$! 1984$write tf " /* Allow compiler builtins */" 1985$write tf "/*-------------------------*/" 1986$write tf "#ifdef __DECC_VER" 1987$write tf "#include <non_existent_dir:builtins.h>" 1988$write tf "#endif" 1989$! 1990$write tf "" 1991$return 1992$! 1993$! gosub to write out the tail for config.h and close it 1994$!--------------------------------------------------------- 1995$write_config_h_tail: 1996$write tf "" 1997$write tf " /* Include the hand customized settings */" 1998$write tf "/*--------------------------------------*/" 1999$write tf "#include ""config_vms.h""" 2000$write tf "" 2001$write tf "#endif /* CONFIG_H */" 2002$close tf 2003$return 2004$! 2005