3
$! $Id: config_h.com,v 1.1.1.1 2012/12/02 19:25:21 wb8tyw Exp $
5
$! This procedure attempts to figure out how to build a config.h file
6
$! for the current project.
8
$! P1 specifies the config.h.in file or equivalent. If it is not specified
9
$! then this procedure will search for several common names of the file.
11
$! The CONFIGURE shell script will be examined for hints and a few symbols
12
$! but most of the tests will not produce valid results on OpenVMS. Some
13
$! will produce false positives and some will produce false negatives.
15
$! It is easier to just read the config.h_in file and make up tests based
18
$! This file will create an empty config_vms.h file if one does not exist.
19
$! The config_vms.h is intended for manual edits to handle things that
20
$! this procedure can not.
22
$! The config_vms.h will be invoked by the resulting config.h file.
24
$! This procedure knows about the DEC C RTL on the system it is on.
25
$! Future versions may be handle the GNV, the OpenVMS porting library,
28
$! This procedure may not guess the options correctly for all architectures,
29
$! and is a work in progress.
31
$! Copyright 2011, John Malmberg
33
$! Permission to use, copy, modify, and/or distribute this software for any
34
$! purpose with or without fee is hereby granted, provided that the above
35
$! copyright notice and this permission notice appear in all copies.
37
$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
38
$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
39
$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
40
$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
41
$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
42
$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
43
$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
45
$! 15-Jan-2001 J. Malmberg Original
46
$! 29-Apr-2001 J. Malmberg Also look for config.*in* in a [.include]
48
$! 30-Apr-2001 J. Malmberg Update for SAMBA checks
49
$! 09-Apr-2005 J. Malmberg Update for RSYNC and large file.
50
$! 29-Sep-2011 J. Malmberg Update for Bash 4.2
51
$! 01-Mar-2012 J. Malmberg Warn about getcwd(0,0)
52
$! 21-Dec-2012 J. Malmberg Update for gawk
53
$! 29-Dec-2012 J. Malmberg Update for curl
54
$!============================================================================
60
$on control_y then goto control_y
61
$on warning then goto general_error
62
$!on warning then set ver
64
$! Some information for writing timestamps to created files
65
$!----------------------------------------------------------
66
$my_proc = f$environment("PROCEDURE")
67
$my_proc_file = f$parse(my_proc,,,"NAME") + f$parse(my_proc,,,"TYPE")
69
$datetime = f$element(0,".",f$cvtime(,"ABSOLUTE","DATETIME"))
70
$username = f$edit(f$getjpi("","USERNAME"),"TRIM")
72
$pid = f$getjpi("","PID")
73
$tfile1 = "SYS$SCRATCH:config_h_temp1_''pid'.TEMP"
74
$dchfile = "SYS$SCRATCH:config_h_decc_''pid'.TEMP"
75
$starhfile = "SYS$SCRATCH:config_h_starlet_''pid'.TEMP"
76
$configure_script = "SYS$SCRATCH:configure_script_''pid'.TEMP"
78
$! Get the system type
79
$!----------------------
80
$arch_type = f$getsyi("arch_type")
82
$! Does config_vms.h exist?
83
$!-------------------------
84
$update_config_vms = 0
85
$file = f$search("sys$disk:[]config_vms.h")
88
$ write sys$output "Found existing custom file ''file'."
90
$ update_config_vms = 1
91
$ write sys$output "Creating new sys$disk:[]config_vms.h for you."
92
$ gosub write_config_vms
96
$! On some platforms, DCL search has problems with searching a file
97
$! on a NFS mounted volume. So copy it to sys$scratch:
99
$if f$search(configure_script) .nes. "" then delete 'configure_script';*
100
$copy sys$disk:[]configure 'configure_script'
102
$ssl_header_dir = "OPENSSL:"
103
$if f$trnlnm("OPENSSL") .eqs. ""
105
$ ssl_header_dir = "SSL$INCLUDE:"
109
$! Write out the header
110
$!----------------------
111
$gosub write_config_h_header
115
$! config.h.in could have at least five different names depending
116
$! on how it was transferred to OpenVMS
117
$!------------------------------------------------------------------
122
$ cfile = f$search("sys$disk:[]config.h.in")
125
$ cfile = f$search("sys$disk:[]config.h_in")
128
$ cfile = f$search("sys$disk:[]configh.in")
131
$ cfile = f$search("sys$disk:[]config__2eh.in")
134
$ cfile = f$search("sys$disk:[]config.h__2ein")
140
$if f$trnlnm("PRJ_INCLUDE") .nes. ""
142
$ cfile = f$search("PRJ_INCLUDE:config.h.in")
145
$ cfile = f$search("PRJ_INCLUDE:config.h_in")
148
$ cfile = f$search("PRJ_INCLUDE:config__2eh.in")
151
$ cfile = f$search("PRJ_INCLUDE:config__2eh.in")
154
$ cfile = f$search("PRJ_INCLUDE:config.h__2ein")
162
$ write sys$output "Can not find sys$disk:config.h.in"
163
$ line_out = "Looked for config.h.in, config.h_in, configh.in, "
164
$ line_out = line_out + "config__2eh.in, config.h__2ein"
165
$ write/symbol sys$output line_out
166
$ if f$trnlnm("PRJ_INCLUDE") .nes. ""
168
$ write sys$output "Also looked in PRJ_INCLUDE: for these files."
173
" /* Could not find sys$disk:config.h.in */"
175
" /* Looked also for config.h_in, configh.in, config__2eh.in, */"
177
" /* config.h__2ein */"
178
$ if f$trnlnm("PRJ_INCLUDE") .nes. ""
181
" /* Also looked in PRJ_INCLUDE: for these files. */"
184
"/*--------------------------------------------------------------*/
190
$! Locate the DECC libraries in use
191
$!-----------------------------------
192
$decc_rtldef = f$parse("decc$rtldef","sys$library:.tlb;0")
193
$decc_starletdef = f$parse("sys$starlet_c","sys$library:.tlb;0")
194
$decc_shr = f$parse("decc$shr","sys$share:.exe;0")
196
$! Dump the DECC header names into a file
197
$!----------------------------------------
198
$if f$search(dchfile) .nes. "" then delete 'dchfile';*
199
$if f$search(tfile1) .nes. "" then delete 'tfile1';*
200
$define/user sys$output 'tfile1'
201
$library/list 'decc_rtldef'
202
$open/read/error=rtldef_loop1_end tf1 'tfile1'
203
$open/write/error=rtldef_loop1_end tf2 'dchfile'
205
$ read/end=rtldef_loop1_end tf1 line_in
206
$ line_in = f$edit(line_in,"TRIM,COMPRESS")
207
$ key1 = f$element(0," ",line_in)
208
$ key2 = f$element(1," ",line_in)
209
$ if key1 .eqs. " " .or. key1 .eqs. "" then goto rtldef_loop1
210
$ if key2 .nes. " " .and. key2 .nes. "" then goto rtldef_loop1
211
$ write tf2 "|",key1,"|"
214
$if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1
215
$if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2
216
$if f$search(tfile1) .nes. "" then delete 'tfile1';*
218
$! Dump the STARLET header names into a file
219
$!----------------------------------------
220
$if f$search(starhfile) .nes. "" then delete 'starhfile';*
221
$if f$search(tfile1) .nes. "" then delete 'tfile1';*
222
$define/user sys$output 'tfile1'
223
$library/list 'decc_starletdef'
224
$open/read/error=stardef_loop1_end tf1 'tfile1'
225
$open/write/error=stardef_loop1_end tf2 'starhfile'
227
$ read/end=stardef_loop1_end tf1 line_in
228
$ line_in = f$edit(line_in,"TRIM,COMPRESS")
229
$ key1 = f$element(0," ",line_in)
230
$ key2 = f$element(1," ",line_in)
231
$ if key1 .eqs. " " .or. key1 .eqs. "" then goto stardef_loop1
232
$ if key2 .nes. " " .and. key2 .nes. "" then goto stardef_loop1
233
$ write tf2 "|",key1,"|"
236
$if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1
237
$if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2
238
$if f$search(tfile1) .nes. "" then delete 'tfile1';*
241
$! Now calculate what should be in the file from reading
242
$! config.h.in and CONFIGURE.
243
$!---------------------------------------------------------------
244
$open/read inf 'cfile'
249
$ read/end=cfgh_in_loop1_end inf line_in
250
$ xline = f$edit(line_in,"TRIM,COMPRESS")
252
$! Blank line handling
253
$!---------------------
259
$ xlen = f$length(xline)
260
$ key = f$extract(0,2,xline)
262
$! deal with comments by copying exactly
263
$!-----------------------------------------
264
$ if (do_comment .eq. 1) .or. (key .eqs. "/*")
268
$ key = f$extract(xlen - 2, 2, xline)
269
$ if key .eqs. "*/" then do_comment = 0
273
$! Some quick parsing
274
$!----------------------
275
$ keyif = f$extract(0,3,xline)
276
$ key1 = f$element(0," ",xline)
277
$ key2 = f$element(1," ",xline)
278
$ key2a = f$element(0,"_",key2)
279
$ key2b = f$element(1,"_",key2)
280
$ key2_len = f$length(key2)
281
$ key2_h = f$extract(key2_len - 2, 2, key2)
282
$ key2_t = f$extract(key2_len - 5, 5, key2)
283
$ if key2_t .eqs. "_TYPE" then key2_h = "_T"
285
$ if f$locate("64", xline) .lt. xlen then key64 = 1
287
$!write sys$output "xline = ''xline'"
289
$! Comment out this section of the ifblock
290
$!-----------------------------------------
293
$ write tf "/* ", xline, " */"
294
$ if keyif .eqs. "#en" then if_block = 0
298
$! Handle the end of an ifblock
299
$!-------------------------------
300
$ if keyif .eqs. "#en"
307
$ if key1 .eqs. "#ifndef"
309
$! Manual check for _ALL_SOURCE on AIX error
310
$!-----------------------------------------------
311
$ if key2 .eqs. "_ALL_SOURCE"
313
$ write tf "/* ", xline, " */"
315
$! Ignore the rest of the block
316
$!--------------------------------------
323
$! Default action for an #if/#else/#endif
324
$!------------------------------------------
325
$ if keyif .eqs. "#if" .or. keyif .eqs. "#el"
333
$! Process "normal?" stuff
334
$!---------------------------
335
$ if key1 .eqs. "#undef"
337
$ key2c = f$element(2, "_", key2)
338
$ if (key2c .eqs. "_") .or. (key2c .eqs. "H") then key2c = ""
339
$ key2d = f$element(3, "_", key2)
340
$ if (key2d .eqs. "_") .or. (key2d .eqs. "H") then key2d = ""
341
$ key2e = f$element(4, "_", key2)
342
$ if (key2e .eqs. "_") .or. (key2e .eqs. "H") then key2e = ""
345
$ if key2e .eqs. "TYPE"
354
$! Process FCNTL directives
355
$!-------------------------------------
356
$ if (key2b .eqs. "FCNTL") .and. (key2c .eqs. "O") .and. -
357
(key2d .eqs. "NONBLOCK")
359
$ write tf "#ifndef ''key2'"
360
$ write tf "#define ''key2' 1"
365
$! Process GETADDRINFO directives
366
$!-------------------------------------
367
$ if key2 .eqs. "GETADDRINFO_THREADSAFE"
369
$ write tf "#ifndef ''key2'"
370
$ write tf "#define ''key2' 1"
375
$! Process IOCTL directives
376
$!-------------------------------------
377
$ if (key2b .eqs. "IOCTL") .and. (key2c .nes. "")
379
$ if (key2c .eqs. "FIONBIO") .or. (key2c .eqs. "SIOCGIFADDR")
381
$ write tf "#ifndef ''key2'"
382
$ write tf "#define ''key2' 1"
389
$! Manual check for LL on
390
$!-----------------------------------------------
393
$ write tf "#ifndef __VAX
394
$ write tf "#define HAVE_''key2' 1"
399
$ if key2 .eqs. "bool_t"
401
$ write tf "#ifndef ''key2'"
402
$ write tf "#define ''key2' short"
407
$ if key2 .eqs. "bits16_t"
409
$ write tf "#ifndef ''key2'"
410
$ write tf "#define ''key2' short"
415
$ if key2 .eqs. "u_bits16_t"
417
$ write tf "#ifndef ''key2'"
418
$ write tf "#define ''key2' unsigned short"
423
$ if key2 .eqs. "bits32_t"
425
$ write tf "#ifndef ''key2'"
426
$ write tf "#define ''key2' int"
431
$ if key2 .eqs. "u_bits32_t"
433
$ write tf "#ifndef ''key2'"
434
$ write tf "#define ''key2' unsigned int"
439
$ if key2 .eqs. "intmax_t"
441
$ write tf "#ifndef ''key2'"
442
$ write tf "#ifdef __VAX"
443
$ write tf "#define ''key2' long"
445
$ write tf "#define ''key2' long long"
451
$ if key2 .eqs. "uintmax_t"
453
$ write tf "#ifndef ''key2'"
454
$ write tf "#ifdef __VAX"
455
$ write tf "#define ''key2' unsigned long"
457
$ write tf "#define ''key2' unsigned long long"
463
$ if key2 .eqs. "socklen_t"
465
$ write tf "#ifndef ''key2'"
466
$ write tf "#define ''key2' int"
471
$ if key2 .eqs. "GETGROUPS_T"
473
$ write tf "#ifndef ''key2'"
474
$ write tf "#define ''key2' gid_t"
479
$ if key2 .eqs. "HAVE_DECL_SYS_SIGLIST"
481
$ write tf "#ifndef ''key2'"
482
$ write tf "#define ''key2' 0"
487
$ if key2 .eqs. "HAVE_SYS_ERRLIST"
489
$ write tf "#ifndef ''key2'"
490
$ write tf "#define ''key2' 1"
495
$ if key2 .eqs. "HAVE_STRUCT_DIRENT_D_INO"
497
$ write tf "#ifndef ''key2'"
498
$ write tf "#define ''key2' 1"
503
$ if key2 .eqs. "HAVE_STRUCT_TIMEVAL"
505
$ write tf "#ifndef ''key2'"
506
$ write tf "#define ''key2' 1"
511
$! ! The header files have this information, however
512
$! ! The ioctl() call only works on sockets.
513
$! if key2 .eqs. "FIONREAD_IN_SYS_IOCTL"
515
$! write tf "#ifndef ''key2'"
516
$! write tf "#define ''key2' 1"
518
$! goto cfgh_in_loop1
521
$! ! The header files have this information, however
522
$! ! The ioctl() call only works on sockets.
523
$! if key2 .eqs. "GWINSZ_IN_SYS_IOCTL"
525
$! write tf "#ifndef ''key2'"
526
$! write tf "#define ''key2' 1"
528
$! goto cfgh_in_loop1
531
$! ! The header files have this information, however
532
$! ! The ioctl() call only works on sockets.
533
$! if key2 .eqs. "STRUCT_WINSIZE_IN_SYS_IOCTL"
535
$! write tf "#ifndef ''key2'"
536
$! write tf "#define ''key2' 0"
538
$! goto cfgh_in_loop1
541
$ if key2 .eqs. "HAVE_STRUCT_TM_TM_ZONE"
543
$ write tf "#ifndef ''key2'"
544
$ write tf "#define ''key2' 1"
549
$ if key2 .eqs. "HAVE_TM_ZONE"
551
$ write tf "#ifndef ''key2'"
552
$ write tf "#define ''key2' 1"
557
$ if key2 .eqs. "HAVE_TIMEVAL"
559
$ write tf "#ifndef ''key2'"
560
$ write tf "#define ''key2' 1"
565
$ if key2 .eqs. "WEXITSTATUS_OFFSET"
567
$ write tf "#ifndef ''key2'"
568
$ write tf "#define ''key2' 2"
573
$ if key2 .eqs. "HAVE_GETPW_DECLS"
575
$ write tf "#ifndef ''key2'"
576
$ write tf "#define ''key2' 1"
581
$ if key2 .eqs. "HAVE_DECL_CONFSTR"
583
$ write tf "#ifndef ''key2'"
584
$ write tf "#define ''key2' 1"
589
$ if key2 .eqs. "HAVE_DECL_PRINTF"
591
$ write tf "#ifndef ''key2'"
592
$ write tf "#define ''key2' 1"
597
$ if key2 .eqs. "HAVE_DECL_SBRK"
599
$ write tf "#ifndef ''key2'"
600
$ write tf "#define ''key2' 1"
605
$ if key2 .eqs. "HAVE_DECL_STRSIGNAL"
607
$ write tf "#ifndef ''key2'"
608
$ write tf "#define ''key2' 0"
613
$ if key2a .eqs. "HAVE_DECL_STRTOLD"
615
$ write tf "#ifndef ''key2'"
616
$ write tf "#define ''key2' 0"
621
$ if key2 .eqs. "HAVE_DECL_STRTOIMAX"
623
$ write tf "#ifndef ''key2'"
624
$ write tf "#define ''key2' 0"
629
$ if key2 .eqs. "HAVE_DECL_STRTOL"
631
$ write tf "#ifndef ''key2'"
632
$ write tf "#define ''key2' 1"
637
$ if key2 .eqs. "HAVE_DECL_STRTOLL"
639
$ write tf "#ifndef ''key2'"
640
$ write tf "#define ''key2' 1"
645
$ if key2 .eqs. "HAVE_DECL_STRTOUL"
647
$ write tf "#ifndef ''key2'"
648
$ write tf "#define ''key2' 1"
653
$ if key2 .eqs. "HAVE_DECL_STRTOULL"
655
$ write tf "#ifndef ''key2'"
656
$ write tf "#define ''key2' 1"
661
$ if key2 .eqs. "HAVE_DECL_STRTOUMAX"
663
$ write tf "#ifndef ''key2'"
664
$ write tf "#define ''key2' 0"
669
$ if key2 .eqs. "GETPGRP_VOID"
671
$ write tf "#ifndef ''key2'"
672
$ write tf "#define ''key2' 1"
677
$ if key2 .eqs. "NAMED_PIPES_MISSING"
679
$ write tf "#ifndef ''key2'"
680
$ write tf "#define ''key2' 1"
685
$ if key2 .eqs. "OPENDIR_NOT_ROBUST"
687
$ write tf "#ifndef ''key2'"
688
$ write tf "#define ''key2' 1"
693
$ if key2 .eqs. "PGRP_PIPE"
695
$ write tf "#ifndef ''key2'"
696
$ write tf "#define ''key2' 1"
701
$ if key2 .eqs. "CAN_REDEFINE_GETENV"
703
$ write tf "#ifndef ''key2'"
704
$ write tf "#define ''key2' 1"
709
$ if key2 .eqs. "HAVE_PRINTF_A_FORMAT"
711
$ write tf "#ifndef ''key2'"
712
$ write tf "#define ''key2' 1"
717
$ if key2 .eqs. "CTYPE_NON_ASCII"
719
$ write tf "#ifndef ''key2'"
720
$ write tf "#define ''key2' 1"
725
$ if key2 .eqs. "HAVE_LANGINFO_CODESET"
727
$ write tf "#ifndef ''key2'"
728
$ write tf "#define ''key2' 0"
733
$! This wants execve() to do this automagically to pass.
734
$! if key2 .eqs. "HAVE_HASH_BANG_EXEC"
736
$! write tf "#ifndef ''key2'"
737
$! write tf "#define ''key2' 1"
739
$! goto cfgh_in_loop1
742
$ if key2 .eqs. "ICONV_CONST"
744
$ write tf "#ifndef ''key2'"
745
$ write tf "#define ''key2'"
750
$ if key2 .eqs. "VOID_SIGHANDLER"
752
$ write tf "#ifndef ''key2'"
753
$ write tf "#define ''key2' 1"
758
$ if key2 .eqs. "HAVE_POSIX_SIGNALS"
760
$ write tf "#ifndef ''key2'"
761
$ write tf "#define ''key2' 1"
766
$ if key2 .eqs. "UNUSABLE_RT_SIGNALS"
768
$ write tf "#ifndef ''key2'"
769
$ write tf "#define ''key2' 1"
774
$ if key2a .eqs. "HAVE_DECL_FPURGE"
776
$ write tf "#ifndef ''key2a'"
777
$ write tf "#define ''key2a' 1"
782
$ if key2 .eqs. "HAVE_DECL_SETREGID"
784
$ write tf "#ifndef ''key2'"
785
$ write tf "#define ''key2' 1"
790
$ if key2 .eqs. "HAVE_POSIX_SIGSETJMP"
792
$ write tf "#ifndef ''key2'"
793
$ write tf "#define ''key2' 1"
798
$ if key2 .eqs. "HAVE_LIBDL"
800
$ write tf "#ifndef ''key2'"
801
$ write tf "#define ''key2' 1"
806
$ if key2 .eqs. "HAVE_ENGINE_LOAD_BUILTIN_ENGINES"
808
$ if f$search("''ssl_header_dir'engine.h") .nes. ""
810
$ search_key = key2 - "HAVE_"
811
$ define/user sys$output nl:
812
$ define/user sys$error nl:
813
$ search/output=nl: 'ssl_header_dir'engine.h 'search_key'
814
$ if '$severity' .eq. 1
816
$ write tf "#ifndef ''key2'"
817
$ write tf "#define ''key2' 1"
820
$ write tf "/* #undef ''key2' */"
823
$ write tf "/* #undef ''key2' */"
828
$ if key2 .eqs. "HAVE_SSL_GET_SHUTDOWN"
830
$ if f$search("''ssl_header_dir'ssl.h") .nes. ""
832
$ write tf "#ifndef ''key2'"
833
$ write tf "#define ''key2' 1"
836
$ write tf "/* #undef ''key2' */"
841
$ if key2b .eqs. "RAND" .and. key2c .nes. "" .and. key2d .eqs. ""
843
$ if (key2c .eqs. "EGD") .or. -
844
(key2c .eqs. "STATUS") .or. -
845
(key2c .eqs. "SCREEN")
847
$ if f$search("''ssl_header_dir'rand.h") .nes. ""
849
$ write tf "#ifndef ''key2'"
850
$ write tf "#define ''key2' 1"
853
$ write tf "/* #undef ''key2' */"
858
$ if key2 .eqs. "STRCOLL_BROKEN"
860
$ write tf "#ifndef ''key2'"
861
$ write tf "#define ''key2' 1"
866
$ if key2 .eqs. "DUP_BROKEN"
868
$ write tf "#ifndef ''key2'"
869
$ write tf "#define ''key2' 1"
874
$! This is for a test that getcwd(0,0) works.
875
$! It does not on VMS.
876
$!--------------------------
877
$ if key2 .eqs. "GETCWD_BROKEN"
879
$ write sys$output ""
881
"%CONFIG_H-I-NONPORT, ''key2' being tested for!"
883
"-CONFIG_H-I-GETCWD, GETCWD(0,0) does not work on VMS."
885
"-CONFIG_H-I-GETCWD2, Work around hack probably required."
887
"-CONFIG_H-I-REVIEW, Manual Code review required!"
888
$ if update_config_vms
890
$ open/append tfcv sys$disk:[]config_vms.h
893
"/* Check config.h for use of ''key2' settings */"
901
$ if (key2a .eqs. "HAVE") .or. (key2a .eqs. "STAT") .or. -
902
(key2 .eqs. "ENABLE_IPV6") .or. (key2b .eqs. "LDAP")
905
$! Process extra underscores
906
$!------------------------------------
907
$ if f$locate("HAVE___", key2) .lt. key2_len
909
$ key2b = "__" + key2d
913
$ if f$locate("HAVE__", key2) .lt. key2_len
915
$ key2b = "_" + key2c
921
$ if (key2_h .eqs. "_H") .or. (key2 .eqs. "ENABLE_IPV6") .or. -
925
$! Looking for a header file
926
$!---------------------------------------
928
$ if key2c .nes. "" then headf = headf + "_" + key2c
929
$ if key2d .nes. "" then headf = headf + "_" + key2d
931
$! (key2b .eqs. "READLINE")
933
$! Some special parsing
934
$!------------------------------------------
935
$ if (key2b .eqs. "SYS") .or. (key2b .eqs. "ARPA") .or. -
936
(key2b .eqs. "NET") .or. (key2b .eqs. "NETINET")
941
$ if key2d .nes. "" then headf = key2c + "_" + key2d
945
$! And of course what's life with out some special cases
946
$!--------------------------------------------------------------------
947
$ if key2 .eqs. "ENABLE_IPV6"
952
$ if key2b .eqs. "LDAP"
954
$ if (key2 .eqs. "HAVE_LDAP_SSL") .or. -
955
(key2 .eqs. "HAVE_LDAP_URL_PARSE")
962
$ if key2b .eqs. "FILE"
964
$ write sys$output ""
966
"%CONFIG_H-I-NONPORT, ''key2' being asked for!"
968
"-CONFIG_H-I-FILE_OLD, file.h will not be configured as is obsolete!"
970
"-CONFIG_H_I-FCNTL_NEW, "Expecting fcntl.h to be configured instead!"
972
"-CONFIG_H_I-FCNTL_CHK, "Unable to verify at this time!"
974
"-CONFIG_H-I-REVIEW, Manual Code review required!"
976
$ if update_config_vms
978
$ open/append tfcv sys$disk:[]config_vms.h
981
"/* Check config.h for use of fcntl.h instead of file.h */"
987
$! Now look it up in the DEC C RTL
988
$!---------------------------------------------
989
$ define/user sys$output nl:
990
$ define/user sys$error nl:
991
$ search/output=nl: 'dchfile' |'headf'|/exact
992
$ if '$severity' .eq. 1
994
$ if key64 then write tf "#ifndef __VAX"
995
$ write tf "#ifndef ''key2'"
996
$ write tf "#define ''key2' 1"
997
$if p2 .nes. "" then write sys$output "''dchfile' - #define ''key2' 1"
999
$ if key64 then write tf "#endif"
1001
$ goto cfgh_in_loop1
1005
$! Now look it up in the DEC C STARLET_C
1006
$!---------------------------------------------
1007
$ define/user sys$output nl:
1008
$ define/user sys$error nl:
1009
$ search/output=nl: 'starhfile' |'headf'|/exact
1010
$ if '$severity' .eq. 1
1012
$ if key64 then write tf "#ifndef __VAX"
1013
$ write tf "#ifndef ''key2'"
1014
$ write tf "#define ''key2' 1"
1015
$if p2 .nes. "" then write sys$output "''starfile' - #define ''key2' 1"
1017
$ if key64 then write tf "#endif"
1019
$ goto cfgh_in_loop1
1022
$! Now look for OPENSSL headers
1023
$!---------------------------------------------------------
1024
$ if key2b .eqs. "OPENSSL"
1026
$ headf = headf - "OPENSSL_"
1027
$ header = f$search("''ssl_header_dir'''headf'.h")
1028
$ if header .nes. ""
1030
$ write tf "#ifndef ''key2'"
1031
$ write tf "#define ''key2' 1"
1034
$ goto cfgh_in_loop1
1038
$! Now look for Kerberos
1039
$!------------------------------------------------------------
1040
$ if key2b .eqs. "GSSAPI"
1042
$ header_dir = "sys$sysroot:[kerberos.include]"
1043
$ headf = headf - "GSSAPI_"
1044
$ header = f$search("''header_dir'''headf'.h")
1045
$ if header .nes. ""
1047
$ write tf "#ifndef ''key2'"
1048
$ write tf "#define ''key2' 1"
1051
$ goto cfgh_in_loop1
1058
$! Looking for a routine or a symbol
1059
$!------------------------------------------------
1060
$ if key2c .eqs. "MACRO"
1062
$ if (key2b .eqs. "FILE") .or. (key2b .eqs. "DATE") -
1063
.or. (key2b .eqs. "LINE") .or. (key2b .eqs. "TIME")
1065
$ write tf "#ifndef HAVE_''key2b'"
1066
$ write tf "#define HAVE_''key2b' 1"
1069
$ goto cfgh_in_loop1
1072
$! Special false tests
1073
$!-------------------------------------
1076
$ if key2b .eqs. "_FCNTL" .or. key2b .eqs. "__FCNTL"
1078
$ write tf "/* #undef HAVE_''key2b' */"
1079
$ goto cfgh_in_loop1
1082
$ if key2b .eqs. "_STAT" .or. key2b .eqs. "__STAT"
1084
$ write tf "/* #undef HAVE_''key2b' */"
1085
$ goto cfgh_in_loop1
1088
$ if key2b .eqs. "_READ" .or. key2b .eqs. "__READ"
1090
$ write tf "/* #undef HAVE_''key2b' */"
1091
$ goto cfgh_in_loop1
1096
$ if key2c .nes. "" then keysym = keysym + "_" + key2c
1097
$ if key2d .nes. "" then keysym = keysym + "_" + key2d
1098
$ if key2e .nes. "" then keysym = keysym + "_" + key2e
1101
$! Stat structure members
1102
$!-------------------------------------
1103
$ if key2b .eqs. "STRUCT"
1105
$ if key2c .eqs. "STAT" .and (key2d .nes. "")
1107
$ key2b = key2b + "_" + key2c + "_" + key2d
1113
$ if (key2b .eqs. "ST") .or. (key2b .eqs. "STRUCT_STAT_ST")
1115
$ keysym = "ST" + "_" + key2c
1116
$ keysym = f$edit(keysym,"LOWERCASE")
1118
$ if key2a .eqs. "STAT"
1120
$ if (f$locate("STATVFS", key2b) .eq. 0) .and. key2c .eqs. ""
1122
$ keysym = f$edit(key2b, "LOWERCASE")
1124
$!$ if (key2b .eqs. "STATVFS" .or. key2b .eqs. "STATFS2" -
1125
$! .or. key2b .eqs. "STATFS3") .and. key2c .nes. ""
1127
$ if (key2b .eqs. "STATVFS") .and. key2c .nes. ""
1129
$! Should really verify that the structure
1130
$! named by key2b actually exists first.
1131
$!------------------------------------------------------------
1133
$! Statvfs structure members
1134
$!-------------------------------------------------
1135
$ keysym = "f_" + f$edit(key2c,"LOWERCASE")
1139
$! UTMPX structure members
1140
$!--------------------------------------
1141
$ if key2b .eqs. "UT" .and. key2c .eqs. "UT"
1143
$ keysym = "ut_" + f$edit(key2d,"LOWERCASE")
1146
$ if f$locate("MMAP",key2) .lt. key2_len
1148
$ write sys$output ""
1149
$ write sys$output -
1150
"%CONFIG_H-I-NONPORT, ''key2' being asked for!"
1151
$ write sys$output -
1152
"-CONFIG_H-I-MMAP, MMAP operations only work on STREAM and BINARY files!"
1153
$ write sys$output -
1154
"-CONFIG_H-I-REVIEW, Manual Code review required!"
1155
$ if update_config_vms
1157
$ open/append tfcv sys$disk:[]config_vms.h
1160
"/* Check config.h for use of ''key2' settings */"
1167
$ if keysym .eqs. "CRYPT"
1169
$ write sys$output ""
1170
$ write sys$output -
1171
"%CONFIG_H-I-NONPORT, ''key2' being asked for!"
1172
$ write sys$output -
1173
"-CONFIG_H-I-CRYPT, CRYPT operations on the VMS SYSUAF may not work!"
1174
$ write sys$output -
1175
"-CONFIG_H-I-REVIEW, Manual Code review required!"
1176
$ if update_config_vms
1178
$ open/append tfcv sys$disk:[]config_vms.h
1181
"/* Check config.h for use of ''keysym' */"
1188
$ if keysym .eqs. "EXECL"
1190
$ write sys$output ""
1191
$ write sys$output -
1192
"%CONFIG_H-I-NONPORT, ''key2' being asked for!"
1193
$ write sys$output -
1194
"-CONFIG_H-I-EXCEL, EXECL configured, Will probably not work."
1195
$ write sys$output -
1196
"-CONFIG_H-I-REVIEW, Manual Code review required!"
1197
$ if update_config_vms
1199
$ open/append tfcv sys$disk:[]config_vms.h
1202
"/* Check config.h for use of ''keysym' */"
1209
$! Process if cpp supports ANSI-C stringizing '#' operator
1210
$!-----------------------------------------------------------------------
1211
$ if keysym .eqs. "STRINGIZE"
1213
$ write tf "#ifndef HAVE_STRINGIZE"
1214
$ write tf "#define HAVE_STRINGSIZE 1"
1216
$ goto cfgh_in_loop1
1219
$ if keysym .eqs. "VOLATILE"
1221
$ write tf "#ifndef HAVE_VOLATILE"
1222
$ write tf "#define HAVE_VOLATILE 1"
1224
$ goto cfgh_in_loop1
1227
$ if keysym .eqs. "ALLOCA"
1229
$ write tf "#ifndef HAVE_ALLOCA"
1230
$ write tf "#define HAVE_ALLOCA 1"
1232
$ goto cfgh_in_loop1
1235
$ if keysym .eqs. "ERRNO_DECL"
1237
$ write tf "#ifndef HAVE_ERRNO_DECL"
1238
$ write tf "#define HAVE_ERRNO_DECL 1"
1240
$ goto cfgh_in_loop1
1243
$ if keysym .eqs. "LONGLONG"
1245
$ write tf "#ifndef __VAX"
1246
$ write tf "#pragma message disable longlongtype"
1247
$ write tf "#ifndef HAVE_LONGLONG"
1248
$ write tf "#define HAVE_LONGLONG 1"
1251
$ goto cfgh_in_loop1
1254
$! May need to test compiler version
1255
$!-----------------------------------------------
1256
$ if keysym .eqs. "LONG_LONG"
1258
$ write tf "#ifndef __VAX"
1259
$ write tf "#pragma message disable longlongtype"
1260
$ write tf "#ifndef HAVE_LONG_LONG"
1261
$ write tf "#define HAVE_LONG_LONG 1"
1264
$ goto cfgh_in_loop1
1267
$! May need to test compiler version
1268
$!-----------------------------------------------
1269
$ if keysym .eqs. "UNSIGNED_LONG_LONG"
1271
$ write tf "#ifndef __VAX"
1272
$ write tf "#pragma message disable longlongtype"
1273
$ write tf "#ifndef HAVE_UNSIGNED_LONG_LONG"
1274
$ write tf "#define HAVE_UNSIGNED_LONG_LONG 1"
1277
$ goto cfgh_in_loop1
1280
$! May need to test compiler version
1281
$!-----------------------------------------------
1282
$ if keysym .eqs. "UNSIGNED_LONG_LONG_INT"
1284
$ write tf "#ifndef __VAX"
1285
$ write tf "#pragma message disable longlongtype"
1286
$ write tf "#ifndef HAVE_UNSIGNED_LONG_LONG_INT"
1287
$ write tf "#define HAVE_UNSIGNED_LONG_LONG_INT 1"
1290
$ goto cfgh_in_loop1
1293
$! May need to test compiler version
1294
$!-----------------------------------------------
1295
$ if keysym .eqs. "LONG_DOUBLE"
1297
$ write tf "#ifndef __VAX"
1298
$ write tf "#pragma message disable longlongtype"
1299
$ write tf "#ifndef HAVE_LONG_DOUBLE"
1300
$ write tf "#define HAVE_LONG_DOUBLE 1"
1303
$ goto cfgh_in_loop1
1306
$ if keysym .eqs. "FCNTL_LOCK"
1308
$ write sys$output -
1309
"%CONFIG_H-I-NONPORT, ''key2' being asked for!
1310
$ write sys$output -
1311
"-CONFIG_H-I-REVIEW, Manual Code review required!"
1312
$ goto cfgh_in_loop1
1316
$! These libraries are provided by the DEC C RTL
1317
$!-------------------------------------------------------------
1318
$ if keysym .eqs. "LIBINET" .or. keysym .eqs. "LIBSOCKET"
1320
$ write tf "#ifndef HAVE_''keysym'"
1321
$ write tf "#define HAVE_''keysym' 1"
1322
$if p2 .nes. "" then write sys$output "''decc_shr' #define ''keysym' 1"
1324
$ goto cfgh_in_loop1
1327
$ if keysym .eqs. "HERRNO" then keysym = "h_errno"
1328
$ if keysym .eqs. "UTIMBUF" then keysym = "utimbuf"
1329
$ if key2c .eqs. "STRUCT"
1331
$ keysym = f$edit(key2d,"LOWERCASE")
1333
$ if key2_h .eqs. "_T"
1335
$ if key2_t .eqs. "_TYPE"
1337
$ keysym = f$extract(0, key2_len - 5, key2) - "HAVE_"
1339
$ keysym = f$edit(keysym,"LOWERCASE")
1343
$! Check the DEC C RTL shared image first
1344
$!------------------------------------------------------
1345
$ if f$search(tfile1) .nes. "" then delete 'tfile1';*
1346
$ define/user sys$output nl:
1347
$ define/user sys$error nl:
1348
$ search/format=nonull/out='tfile1' 'decc_shr' 'keysym'
1349
$ if '$severity' .eq. 1
1352
$! Not documented, but from observation
1353
$!------------------------------------------------------
1354
$ define/user sys$output nl:
1355
$ define/user sys$error nl:
1356
$ if arch_type .eq. 3
1358
$ keyterm = "''keysym'<SOH>"
1360
$ if arch_type .eq. 2
1362
$ keyterm = "''keysym'<BS>"
1364
$ keyterm = "''keysym'<STX>"
1367
$ search/out=nl: 'tfile1' -
1368
"$''keyterm'","$g''keyterm'","$__utc_''keyterm'",-
1369
"$__utctz_''keyterm'","$__bsd44_''keyterm'","$bsd_''keyterm'",-
1370
"$''keysym'decc$","$G''keysym'decc$","$GX''keyterm'"
1371
$ severity = '$severity'
1374
$! Of course the 64 bit stuff is different
1375
$!---------------------------------------------------------
1376
$ if severity .ne. 1 .and. key64
1378
$ define/user sys$output nl:
1379
$ define/user sys$error nl:
1380
$ search/out=nl: 'tfile1' "$_''keyterm'"
1381
$! search/out 'tfile1' "$_''keyterm'"
1382
$ severity = '$severity'
1385
$! UNIX compatability routines
1386
$!---------------------------------------------
1387
$ if severity .ne. 1
1389
$ define/user sys$output nl:
1390
$ define/user sys$error nl:
1391
$ search/out=nl: 'tfile1' -
1392
"$__unix_''keyterm'","$__vms_''keyterm'","$_posix_''keyterm'"
1393
$ severity = '$severity'
1396
$! Show the result of the search
1397
$!------------------------------------------------
1398
$ if 'severity' .eq. 1
1400
$ if key64 then write tf "#ifndef __VAX"
1401
$ write tf "#ifndef ''key2'"
1402
$ write tf "#define ''key2' 1"
1403
$if p2 .nes. "" then write sys$output "''decc_shr' #define ''key2' 1"
1405
$ if key64 then write tf "#endif"
1406
$ goto cfgh_in_loop1
1409
$ if f$search(tfile1) .nes. "" then delete 'tfile1';*
1411
$! Check the DECC Header files next
1412
$!----------------------------------------------
1413
$ define/user sys$output nl:
1414
$ define/user sys$error nl:
1415
$ search/out=nl: 'decc_rtldef' -
1416
"''keysym';", "''keysym'[", "struct ''keysym'"/exact
1417
$ severity = '$severity'
1418
$ if severity .eq. 1
1420
$ if key64 then write tf "#ifndef __VAX"
1421
$ write tf "#ifndef ''key2'"
1422
$ write tf "#define ''key2' 1"
1423
$if p2 .nes. "" then write sys$output "''decc_rtldef' #define ''key2' 1"
1425
$ if key64 then write tf "#endif"
1426
$ goto cfgh_in_loop1
1430
$!--------------------------------------------
1431
$ if f$search("SYS$SYSROOT:[kerberos]include.dir") .nes. ""
1433
$ test_mit = "SYS$SYSROOT:[kerberos.include]gssapi_krb5.h"
1434
$ if (key2 .eqs. "HAVE_GSSAPI")
1436
$ write tf "#ifndef ''key2'"
1437
$ write tf "#define ''key2' 1"
1439
$ goto cfgh_in_loop1
1442
$! This is really do we have the newer MIT Kerberos
1443
$!----------------------------------------------------------------------
1444
$ if (key2 .eqs. "HAVE_GSSMIT")
1446
$ if f$search(test_mit) .nes. ""
1448
$ write tf "#ifndef ''key2'"
1449
$ write tf "#define ''key2' 1"
1451
$ write tf "#ifdef ''key2'"
1452
$ write tf "#undef ''key2'"
1455
$ goto cfgh_in_loop1
1458
$! Older MIT looks like Heimdal
1459
$!------------------------------------------------
1460
$ if (key2 .eqs. "HAVE_HEIMDAL")
1462
$ if f$search(test_mit) .eqs. ""
1464
$ write tf "#ifndef ''key2'"
1465
$ write tf "#define ''key2' 1"
1467
$ write tf "#ifdef ''key2'"
1468
$ write tf "#undef ''key2'"
1471
$ goto cfgh_in_loop1
1476
$ write tf "/* ", xline, " */"
1477
$ goto cfgh_in_loop1
1481
$! Process SIZEOF directives found in SAMBA and others
1482
$!----------------------------------------------------------
1483
$ if key2a .eqs. "SIZEOF"
1485
$ if key2b .eqs. "INO" .and. key2_h .eqs. "_T"
1487
$ write tf "#ifndef SIZEOF_INO_T"
1488
$ write tf "#if !__USING_STD_STAT
1489
$ write tf "#define SIZEOF_INO_T 6"
1491
$ write tf "#define SIZEOF_INO_T 8"
1494
$ goto cfgh_in_loop1
1496
$ if key2b .eqs. "INTMAX" .and. key2_h .eqs. "_T"
1498
$ write tf "#ifndef SIZEOF_INTMAX_T"
1499
$ write tf "#ifdef __VAX"
1500
$ write tf "#define SIZEOF_INTMAX_T 4"
1502
$ write tf "#define SIZEOF_INTMAX_T 8"
1505
$ goto cfgh_in_loop1
1507
$ if key2b .eqs. "OFF" .and. key2_h .eqs. "_T"
1509
$ write tf "#ifndef SIZEOF_OFF_T"
1510
$ write tf "#if __USE_OFF64_T"
1511
$ write tf "#define SIZEOF_OFF_T 8"
1513
$ write tf "#define SIZEOF_OFF_T 4"
1516
$ goto cfgh_in_loop1
1518
$ if key2b .eqs. "CHAR" .and. key2_h .eqs. "_P"
1520
$ write tf "#ifndef SIZEOF_CHAR_P"
1521
$ write tf "#if __INITIAL_POINTER_SIZE == 64"
1522
$ write tf "#define SIZEOF_CHAR_P 8"
1524
$ write tf "#define SIZEOF_CHAR_P 4"
1526
$ goto cfgh_in_loop1
1528
$ if key2b .eqs. "VOIDP"
1530
$ write tf "#ifndef SIZEOF_VOIDP"
1531
$ write tf "#if __INITIAL_POINTER_SIZE == 64"
1532
$ write tf "#define SIZEOF_VOIDP 8"
1534
$ write tf "#define SIZEOF_VOIDP 4"
1537
$ goto cfgh_in_loop1
1539
$ if key2b .eqs. "INT"
1541
$ write tf "#ifndef SIZEOF_INT"
1542
$ write tf "#define SIZEOF_INT 4"
1544
$ goto cfgh_in_loop1
1546
$ if key2b .eqs. "SIZE" .and. key2_h .eqs. "_T"
1548
$ write tf "#ifndef SIZEOF_SIZE_T"
1549
$ write tf "#define SIZEOF_SIZE_T 4"
1551
$ goto cfgh_in_loop1
1553
$ if key2b .eqs. "TIME" .and. key2_h .eqs. "_T"
1555
$ write tf "#ifndef SIZEOF_TIME_T"
1556
$ write tf "#define SIZEOF_TIME_T 4"
1558
$ goto cfgh_in_loop1
1560
$ if key2b .eqs. "DOUBLE"
1562
$ write tf "#ifndef SIZEOF_DOUBLE"
1563
$ write tf "#define SIZEOF_DOUBLE 8"
1565
$ goto cfgh_in_loop1
1567
$ if key2b .eqs. "LONG"
1571
$ write tf "#ifndef SIZEOF_LONG"
1572
$ write tf "#define SIZEOF_LONG 4"
1575
$ write tf "#ifndef SIZEOF_LONG_LONG"
1576
$ write tf "#ifndef __VAX"
1577
$ write tf "#define SIZEOF_LONG_LONG 8"
1581
$ goto cfgh_in_loop1
1583
$ if key2b .eqs. "SHORT"
1585
$ write tf "#ifndef SIZEOF_SHORT"
1586
$ write tf "#define SIZEOF_SHORT 2"
1588
$ goto cfgh_in_loop1
1590
$ write tf "/* ", xline, " */"
1591
$ goto cfgh_in_loop1
1594
$! Process NEED directives
1595
$!-------------------------------
1596
$ if key2a .eqs. "NEED"
1598
$ if key2b .eqs. "STRINGS" .and. key2_h .eqs. "_H"
1600
$ write tf "#ifndef NEED_STRINGS_H"
1601
$ write tf "#define NEED_STRINGS_H 1"
1603
$ goto cfgh_in_loop1
1605
$ write tf "/* ", xline, " */"
1606
$ goto cfgh_in_loop1
1609
$! Process GETHOSTNAME directives
1610
$!-------------------------------------
1611
$ if key2 .eqs. "GETHOSTNAME_TYPE_ARG2"
1613
$ write tf "#ifndef ''key2'"
1614
$ write tf "#ifdef _DECC_V4_SOURCE"
1615
$ write tf "#define ''key2' int"
1617
$ write tf "#define ''key2' size_t"
1620
$ goto cfgh_in_loop1
1623
$! Process GETNAMEINFO directives
1624
$!-------------------------------------
1625
$ if key2a .eqs. "GETNAMEINFO"
1627
$ if key2 .eqs. "GETNAMEINFO_QUAL_ARG1"
1629
$ write tf "#ifndef ''key2'"
1630
$ write tf "#define ''key2' const"
1632
$ goto cfgh_in_loop1
1634
$ if key2 .eqs. "GETNAMEINFO_TYPE_ARG1"
1636
$ write tf "#ifndef ''key2'"
1637
$ write tf "#define ''key2' struct sockaddr *"
1639
$ goto cfgh_in_loop1
1641
$ if key2 .eqs. "GETNAMEINFO_TYPE_ARG2"
1643
$ write tf "#ifndef ''key2'"
1644
$ write tf "#define ''key2' size_t"
1646
$ goto cfgh_in_loop1
1648
$ if key2 .eqs. "GETNAMEINFO_TYPE_ARG46"
1650
$ write tf "#ifndef ''key2'"
1651
$ write tf "#define ''key2' size_t"
1653
$ goto cfgh_in_loop1
1655
$ if key2 .eqs. "GETNAMEINFO_TYPE_ARG7"
1657
$ write tf "#ifndef ''key2'"
1658
$ write tf "#define ''key2' int"
1660
$ goto cfgh_in_loop1
1664
$! Process RECV directives
1665
$!-------------------------------------
1666
$ if key2a .eqs. "RECV"
1668
$ if key2 .eqs. "RECV_TYPE_ARG1"
1670
$ write tf "#ifndef ''key2'"
1671
$ write tf "#define ''key2' int"
1673
$ goto cfgh_in_loop1
1675
$ if key2 .eqs. "RECV_TYPE_ARG2"
1677
$ write tf "#ifndef ''key2'"
1678
$ write tf "#define ''key2' void *"
1680
$ goto cfgh_in_loop1
1682
$ if key2 .eqs. "RECV_TYPE_ARG3"
1684
$ write tf "#ifndef ''key2'"
1685
$ write tf "#define ''key2' size_t"
1687
$ goto cfgh_in_loop1
1689
$ if key2 .eqs. "RECV_TYPE_ARG4"
1691
$ write tf "#ifndef ''key2'"
1692
$ write tf "#define ''key2' int"
1694
$ goto cfgh_in_loop1
1696
$ if key2 .eqs. "RECV_TYPE_RETV"
1698
$ write tf "#ifndef ''key2'"
1699
$ write tf "#define ''key2' int"
1701
$ goto cfgh_in_loop1
1706
$! Process RECVFROM directives
1707
$!-------------------------------------
1708
$ if key2a .eqs. "RECVFROM"
1710
$ if key2 .eqs. "RECVFROM_QUAL_ARG5"
1712
$ write tf "#ifndef ''key2'"
1713
$ write tf "#define ''key2'"
1715
$ goto cfgh_in_loop1
1717
$ if key2 .eqs. "RECVFROM_TYPE_ARG1"
1719
$ write tf "#ifndef ''key2'"
1720
$ write tf "#define ''key2' int"
1722
$ goto cfgh_in_loop1
1724
$ if key2 .eqs. "RECVFROM_TYPE_ARG2"
1726
$ write tf "#ifndef ''key2'"
1727
$ write tf "#define ''key2' void *"
1729
$ goto cfgh_in_loop1
1731
$ if key2 .eqs. "RECVFROM_TYPE_ARG3"
1733
$ write tf "#ifndef ''key2'"
1734
$ write tf "#define ''key2' size_t"
1736
$ goto cfgh_in_loop1
1738
$ if key2 .eqs. "RECVFROM_TYPE_ARG4"
1740
$ write tf "#ifndef ''key2'"
1741
$ write tf "#define ''key2' int"
1743
$ goto cfgh_in_loop1
1745
$ if key2 .eqs. "RECVFROM_TYPE_ARG5"
1747
$ write tf "#ifndef ''key2'"
1748
$ write tf "#define ''key2' struct sockaddr"
1750
$ goto cfgh_in_loop1
1752
$ if key2 .eqs. "RECVFROM_TYPE_ARG6"
1754
$ write tf "#ifndef ''key2'"
1755
$ write tf "#define ''key2' unsigned int"
1757
$ goto cfgh_in_loop1
1759
$ if key2 .eqs. "RECVFROM_TYPE_RETV"
1761
$ write tf "#ifndef ''key2'"
1762
$ write tf "#define ''key2' int"
1764
$ goto cfgh_in_loop1
1768
$! Process SELECT directives
1769
$!-------------------------------------
1770
$ if key2a .eqs. "SELECT"
1772
$ if key2 .eqs. "SELECT_QUAL_ARG5"
1774
$ write tf "#ifndef ''key2'"
1775
$ write tf "#define ''key2' const"
1777
$ goto cfgh_in_loop1
1779
$ if key2 .eqs. "SELECT_TYPE_ARG1"
1781
$ write tf "#ifndef ''key2'"
1782
$ write tf "#define ''key2' int"
1784
$ goto cfgh_in_loop1
1786
$ if key2 .eqs. "SELECT_TYPE_ARG2"
1788
$ write tf "#ifndef ''key2'"
1789
$ write tf "#define ''key2' void *"
1791
$ goto cfgh_in_loop1
1793
$ if key2 .eqs. "SELECT_TYPE_ARG234"
1795
$ write tf "#ifndef ''key2'"
1796
$ write tf "#define ''key2' fd_set *"
1798
$ goto cfgh_in_loop1
1800
$ if key2 .eqs. "SELECT_TYPE_ARG5"
1802
$ write tf "#ifndef ''key2'"
1803
$ write tf "#define ''key2' struct timeval *"
1805
$ goto cfgh_in_loop1
1807
$ if key2 .eqs. "SELECT_TYPE_RETV"
1809
$ write tf "#ifndef ''key2'"
1810
$ write tf "#define ''key2' int"
1812
$ goto cfgh_in_loop1
1816
$! Process SEND directives
1817
$!-------------------------------------
1818
$ if key2a .eqs. "SEND"
1820
$ if key2 .eqs. "SEND_QUAL_ARG2"
1822
$ write tf "#ifndef ''key2'"
1823
$ write tf "#define ''key2' const"
1825
$ goto cfgh_in_loop1
1827
$ if key2 .eqs. "SEND_TYPE_ARG1"
1829
$ write tf "#ifndef ''key2'"
1830
$ write tf "#define ''key2' int"
1832
$ goto cfgh_in_loop1
1834
$ if key2 .eqs. "SEND_TYPE_ARG2"
1836
$ write tf "#ifndef ''key2'"
1837
$ write tf "#define ''key2' void *"
1839
$ goto cfgh_in_loop1
1841
$ if key2 .eqs. "SEND_TYPE_ARG3"
1843
$ write tf "#ifndef ''key2'"
1844
$ write tf "#define ''key2' size_t"
1846
$ goto cfgh_in_loop1
1848
$ if key2 .eqs. "SEND_TYPE_ARG4"
1850
$ write tf "#ifndef ''key2'"
1851
$ write tf "#define ''key2' int"
1853
$ goto cfgh_in_loop1
1855
$ if key2 .eqs. "SEND_TYPE_RETV"
1857
$ write tf "#ifndef ''key2'"
1858
$ write tf "#define ''key2' int"
1860
$ goto cfgh_in_loop1
1865
$! Process STATFS directives
1866
$!-------------------------------
1867
$! if key2a .eqs. "STATFS"
1869
$! write tf "/* ", xline, " */"
1870
$! goto cfgh_in_loop1
1873
$! Process inline directive
1874
$!------------------------------
1875
$ if key2 .eqs. "inline"
1877
$ write tf "#ifndef inline"
1878
$ write tf "#define inline __inline"
1880
$ goto cfgh_in_loop1
1883
$! Process restrict directive
1884
$!--------------------------------
1885
$ if key2 .eqs. "restrict"
1887
$ write tf "#ifndef restrict"
1888
$ write tf "#define restrict __restrict"
1890
$ goto cfgh_in_loop1
1893
$! Process RETSIGTYPE directive
1894
$!----------------------------------
1895
$ if key2 .eqs. "RETSIGTYPE"
1897
$ write tf "#ifndef RETSIGTYPE"
1898
$ write tf "#define RETSIGTYPE void"
1900
$ goto cfgh_in_loop1
1903
$! Process STDC_HEADERS (SAMBA!)
1904
$!---------------------------
1905
$ if key2 .eqs. "STDC_HEADERS"
1907
$ write tf "#ifndef STDC_HEADERS"
1908
$ write tf "#define STDC_HEADERS 1"
1910
$ goto cfgh_in_loop1
1913
$! Process PROTOTYPES directive
1914
$!-------------------------------------
1915
$ if key2 .eqs. "PROTOTYPES"
1917
$ write tf "#ifndef PROTOTYPES"
1918
$ write tf "#define PROTOTYPES 1"
1920
$ goto cfgh_in_loop1
1923
$! Special for SEEKDIR_RETURNS_VOID
1924
$!---------------------------------------
1925
$ if key2 .eqs. "SEEKDIR_RETURNS_VOID"
1927
$ write tf "#ifndef SEEKDIR_RETURNS_VOID"
1928
$ write tf "#define SEEKDIR_RETURNS_VOID 1"
1932
$! Unknown - See if CONFIGURE can give a clue for this
1933
$!----------------------------------------------------------
1936
$! gproj_name = proj_name - "_VMS" - "-VMS"
1937
$ if f$search(tfile1) .nes. "" then delete 'tfile1';*
1938
$ define/user sys$output nl:
1939
$ define/user sys$error nl:
1940
$! if f$locate("FILE", key2) .lt. key2_len then pflag = 1
1941
$! if f$locate("DIR", key2) .eq. key2_len - 3 then pflag = 1
1942
$! if f$locate("PATH", key2) .eq. key2_len - 4 then pflag = 1
1944
$ search/out='tfile1' 'configure_script' "''key2'="/exact
1945
$ search_sev = '$severity'
1946
$ if 'search_sev' .eq. 1
1948
$ open/read/err=unknown_cf_rd_error sf 'tfile1'
1949
$search_file_rd_loop:
1950
$ read/end=unknown_cf_rd_err sf line_in
1951
$ line_in = f$edit(line_in, "TRIM")
1952
$ skey1 = f$element(0,"=",line_in)
1953
$ if skey1 .eqs. key2
1955
$ skey2 = f$element(1,"=",line_in)
1956
$ skey2a = f$extract(0,2,skey2)
1959
$! We can not handle assignment to shell symbols.
1960
$! For now skip them.
1961
$!------------------------------------------------------------
1962
$ if f$locate("$", skey2) .lt. f$length(skey2)
1964
$ write tf "/* ", xline, " */"
1966
$ goto found_in_configure
1969
$! Keep these two cases separate to make it easier to add
1970
$! more future intelligence to this routine
1971
$!----------------------------------------------------------------------
1972
$ if skey2a .eqs. """`"
1976
$! write tf "#ifndef ''key2'"
1977
$! write tf "#define ",key2," """,gproj_name,"_",key2,""""
1978
$! write tf "#endif"
1980
$! Ignore this for now
1981
$!------------------------------------------
1982
$ write tf "/* ", xline, " */"
1985
$ goto found_in_configure
1987
$ if skey2a .eqs. """$"
1991
$! write tf "#ifndef ''key2'"
1992
$! write tf "#define ",key2," """,gproj_name,"_",key2,""""
1993
$! write tf "#endif"
1995
$! Ignore this for now
1996
$!-------------------------------------------
1997
$ write tf "/* ", xline, " */"
2000
$ goto found_in_configure
2003
$! Remove multiple layers of quotes if present
2004
$!----------------------------------------------------------
2005
$ if f$extract(0, 1, skey2) .eqs. "'"
2007
$ skey2 = skey2 - "'" - "'" - "'" - "'"
2009
$ if f$extract(0, 1, skey2) .eqs. """"
2011
$ skey2 = skey2 - """" - """" - """" - """"
2013
$ write tf "#ifndef ''key2'"
2016
$ write tf "#define ",key2
2018
$! Only quote non-numbers
2019
$!----------------------------------------
2020
$ if f$string(skey2+0) .eqs. skey2
2022
$ write tf "#define ",key2," ",skey2
2024
$ write tf "#define ",key2," """,skey2,""""
2030
$ goto search_file_rd_loop
2033
$! write tf "#ifndef ''key2'"
2034
$! write tf "#define ",key2," """,gproj_name,"_",key2,""""
2035
$! write tf "#endif"
2039
$found_in_configure:
2041
$ if f$trnlnm("sf","lnm$process",,"SUPERVISOR") .nes. ""
2045
$ if f$search(tfile1) .nes. "" then delete 'tfile1';*
2046
$ if set_flag .eq. 1 then goto cfgh_in_loop1
2052
$! If it falls through everything else, comment it out
2053
$!-----------------------------------------------------
2054
$ write tf "/* ", xline, " */"
2055
$ goto cfgh_in_loop1
2060
$! Write out the tail
2061
$!--------------------
2063
$gosub write_config_h_tail
2065
$! Exit and clean up
2066
$!--------------------
2071
$if f$trnlnm("sf","lnm$process",,"SUPERVISOR") .nes. "" then close sf
2072
$if f$trnlnm("tf","lnm$process",,"SUPERVISOR") .nes. "" then close tf
2073
$if f$trnlnm("inf","lnm$process",,"SUPERVISOR") .nes. "" then close inf
2074
$if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1
2075
$if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2
2076
$if f$trnlnm("tfcv","lnm$process",,"SUPERVISOR") .nes. "" then close tfcv
2077
$if f$type(tfile1) .eqs. "STRING"
2079
$ if f$search(tfile1) .nes. "" then delete 'tfile1';*
2081
$if f$type(dchfile) .eqs. "STRING"
2083
$ if f$search(dchfile) .nes. "" then delete 'dchfile';*
2085
$if f$type(starhfile) .eqs. "STRING"
2087
$ if f$search(starhfile) .nes. "" then delete 'starhfile';*
2089
$if f$type(configure_script) .eqs. "STRING"
2091
$ if f$search(configure_script) .nes. "" then delete 'configure_script';*
2097
$ status = ss_control_y
2102
$! Gosub to write a new config_vms.h
2103
$!-----------------------------------
2105
$outfile = "sys$disk:[]config_vms.h"
2107
$open/append tf 'outfile'
2108
$write tf "/* File: config_vms.h"
2110
$write tf "** This file contains the manual edits needed for porting"
2111
$!write tf "** the ''proj_name' package to OpenVMS.
2113
$write tf "** Edit this file as needed. The procedure that automatically"
2114
$write tf "** generated this header stub will not overwrite or make any"
2115
$write tf "** changes to this file."
2118
"** ", datetime, tab, username, tab, "Generated by ''my_proc_file'"
2121
"**========================================================================*/"
2126
$! gosub to write out a documentation header for config.h
2127
$!----------------------------------------------------------------
2128
$write_config_h_header:
2129
$outfile = "sys$disk:[]config.h"
2131
$open/append tf 'outfile'
2132
$write tf "#ifndef CONFIG_H"
2133
$write tf "#define CONFIG_H"
2134
$write tf "/* File: config.h"
2137
"** This file contains the options needed for porting "
2138
$write tf "** the project on a VMS system."
2140
$write tf "** Try not to make any edits to this file, as it is"
2141
$write tf "** automagically generated."
2143
$write tf "** Manual edits should be made to the config_vms.h file."
2146
"** ", datetime, tab, username, tab, "Generated by ''my_proc_file'"
2149
"**========================================================================*/"
2151
$write tf "#if (__CRTL_VER >= 70200000) && !defined (__VAX)"
2152
$write tf "#define _LARGEFILE 1"
2155
$write tf "#ifndef __VAX"
2156
$write tf "#ifdef __CRTL_VER"
2157
$write tf "#if __CRTL_VER >= 80200000"
2158
$write tf "#define _USE_STD_STAT 1"
2164
$write tf " /* Allow compiler builtins */"
2165
$write tf "/*-------------------------*/"
2166
$write tf "#ifdef __DECC_VER"
2167
$write tf "#include <non_existant_dir:builtins.h>"
2173
$! gosub to write out the tail for config.h and close it
2174
$!---------------------------------------------------------
2175
$write_config_h_tail:
2177
$write tf " /* Include the hand customized settings */"
2178
$write tf "/*--------------------------------------*/"
2179
$write tf "#include ""config_vms.h"""
2181
$write tf "#endif /* CONFIG_H */"