Debian Codegraph @

vms/config_h.com

raw
1 $! File: config_h.com
2 $!
3 $! $Id: config_h.com,v 1.1.1.1 2012/12/02 19:25:21 wb8tyw Exp $
4 $!
5 $! This procedure attempts to figure out how to build a config.h file
6 $! for the current project.
7 $!
8 $! The P1 parameter of "NOBUILTINS" inhibits the default #include <builtins.h>
9 $! that is normally added. This include can cause side effects if
10 $! special VMS compiler settings are used.
11 $!
12 $! The CONFIGURE shell script will be examined for hints and a few symbols
13 $! but most of the tests will not produce valid results on OpenVMS. Some
14 $! will produce false positives and some will produce false negatives.
15 $!
16 $! It is easier to just read the config.h_in file and make up tests based
17 $! on what is in it!
18 $!
19 $! This file will create an empty config_vms.h file if one does not exist.
20 $! The config_vms.h is intended for manual edits to handle things that
21 $! this procedure can not.
22 $!
23 $! The config_vms.h will be invoked by the resulting config.h file.
24 $!
25 $! This procedure knows about the DEC C RTL on the system it is on.
26 $! Future versions may be handle the GNV, the OpenVMS porting library,
27 $! and others.
28 $!
29 $! This procedure may not guess the options correctly for all architectures,
30 $! and is a work in progress.
31 $!
32 $! Copyright (C) 2014-2023 the Free Software Foundation, Inc.
33 $!
34 $! This file is part of GAWK, the GNU implementation of the
35 $! AWK Progamming Language.
36 $!
37 $! GAWK is free software; you can redistribute it and/or modify
38 $! it under the terms of the GNU General Public License as published by
39 $! the Free Software Foundation; either version 3 of the License, or
40 $! (at your option) any later version.
41 $!
42 $! GAWK is distributed in the hope that it will be useful,
43 $! but WITHOUT ANY WARRANTY; without even the implied warranty of
44 $! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45 $! GNU General Public License for more details.
46 $!
47 $! You should have received a copy of the GNU General Public License
48 $! along with this program; if not, write to the Free Software
49 $! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
50 $! USA
51 $!
52 $! Per assignment agreement with FSF, similar procedures may be present
53 $! in other packages under other licensing agreements and copyrights
54 $!
55 $! 15-Jan-2001 J. Malmberg Original
56 $! 29-Apr-2001 J. Malmberg Also look for config.*in* in a [.include]
57 $! subdirectory
58 $! 30-Apr-2001 J. Malmberg Update for SAMBA checks
59 $! 09-Apr-2005 J. Malmberg Update for RSYNC and large file.
60 $! 29-Sep-2011 J. Malmberg Update for Bash 4.2
61 $! 01-Mar-2012 J. Malmberg Warn about getcwd(0,0)
62 $! 21-Dec-2012 J. Malmberg Update for gawk
63 $! 02-Feb-2023` J. Malmberg Add HAVE_C_BOOL special case
64 $!============================================================================
65 $!
66 $ss_normal = 1
67 $ss_abort = 44
68 $ss_control_y = 1556
69 $status = ss_normal
70 $on control_y then goto control_y
71 $on warning then goto general_error
72 $!
73 $! Some information for writing timestamps to created files
74 $!----------------------------------------------------------
75 $my_proc = f$environment("PROCEDURE")
76 $my_proc_file = f$parse(my_proc,,,"NAME") + f$parse(my_proc,,,"TYPE")
77 $tab[0,8] = 9
78 $datetime = f$element(0,".",f$cvtime(,"ABSOLUTE","DATETIME"))
79 $username = f$edit(f$getjpi("","USERNAME"),"TRIM")
80 $!
81 $pid = f$getjpi("","PID")
82 $tfile1 = "SYS$SCRATCH:config_h_temp1_''pid'.TEMP"
83 $dchfile = "SYS$SCRATCH:config_h_decc_''pid'.TEMP"
84 $configure_script = "SYS$SCRATCH:configure_script_''pid'.TEMP"
85 $!
86 $! Get the system type
87 $!----------------------
88 $arch_type = f$getsyi("arch_type")
89 $!
90 $! Does config_vms.h exist?
91 $!-------------------------
92 $update_config_vms = 0
93 $file = f$search("sys$disk:[]config_vms.h")
94 $if file .nes. ""
95 $then
96 $ write sys$output "Found existing custom file ''file'."
97 $else
98 $ update_config_vms = 1
99 $ write sys$output "Creating new sys$disk:[]config_vms.h for you."
100 $ gosub write_config_vms
101 $endif
102 $!
103 $!
104 $! On some platforms, DCL search has problems with searching a file
105 $! on a NFS mounted volume. So copy it to sys$scratch:
106 $!
107 $if f$search(configure_script) .nes. "" then delete 'configure_script';*
108 $copy sys$disk:configure 'configure_script'
109 $!
110 $!
111 $! Write out the header
112 $!----------------------
113 $gosub write_config_h_header
114 $!
115 $!
116 $!
117 $! config.h.in could have at least five different names depending
118 $! on how it was transferred to OpenVMS
119 $!------------------------------------------------------------------
120 $cfile = f$search("sys$disk:[]config.h.in")
121 $if cfile .eqs. ""
122 $then
123 $ cfile = f$search("sys$disk:[]config.h_in")
124 $ if cfile .eqs. ""
125 $ then
126 $ cfile = f$search("sys$disk:[]configh.in")
127 $ if cfile .eqs. ""
128 $ then
129 $ cfile = f$search("sys$disk:[]config__2eh.in")
130 $ if cfile .eqs. ""
131 $ then
132 $ cfile = f$search("sys$disk:[]config.h__2ein")
133 $ endif
134 $ endif
135 $ endif
136 $endif
137 $if f$trnlnm("PRJ_INCLUDE") .nes. ""
138 $then
139 $ cfile = f$search("PRJ_INCLUDE:config.h.in")
140 $ if cfile .eqs. ""
141 $ then
142 $ cfile = f$search("PRJ_INCLUDE:config.h_in")
143 $ if cfile .eqs. ""
144 $ then
145 $ cfile = f$search("PRJ_INCLUDE:config__2eh.in")
146 $ if cfile .eqs. ""
147 $ then
148 $ cfile = f$search("PRJ_INCLUDE:config__2eh.in")
149 $ if cfile .eqs. ""
150 $ then
151 $ cfile = f$search("PRJ_INCLUDE:config.h__2ein")
152 $ endif
153 $ endif
154 $ endif
155 $ endif
156 $endif
157 $if cfile .eqs. ""
158 $then
159 $ write sys$output "Can not find sys$disk:config.h.in"
160 $ line_out = "Looked for config.h.in, config.h_in, configh.in, "
161 $ line_out = line_out + "config__2eh.in, "config.h__2ein"
162 $ write/symbol sys$output line_out
163 $ if f$trnlnm("PRJ_INCLUDE") .nes. ""
164 $ then
165 $ write sys$output "Also looked in PRJ_INCLUDE: for these files."
166 $ endif
167 $!
168 $ write tf ""
169 $ write tf -
170 " /* Could not find sys$disk:config.h.in */"
171 $ write tf -
172 " /* Looked also for config.h_in, configh.in, config__2eh.in, */"
173 $ write tf -
174 " /* config.h__2ein */"
175 $ if f$trnlnm("PRJ_INCLUDE") .nes. ""
176 $ then
177 $ write tf -
178 " /* Also looked in PRJ_INCLUDE: for these files. */"
179 $ endif
180 $ write tf -
181 "/*--------------------------------------------------------------*/
182 $ write tf ""
183 $ goto write_tail
184 $endif
185 $!
186 $!
187 $! Locate the DECC libraries in use
188 $!-----------------------------------
189 $decc_rtldef = f$parse("decc$rtldef","sys$library:.tlb;0")
190 $decc_shr = f$parse("decc$shr","sys$share:.exe;0")
191 $!
192 $! Dump the DECC header names into a file
193 $!----------------------------------------
194 $if f$search(dchfile) .nes. "" then delete 'dchfile';*
195 $if f$search(tfile1) .nes. "" then delete 'tfile1';*
196 $define/user sys$output 'tfile1'
197 $library/list 'decc_rtldef'
198 $open/read/error=rtldef_loop1_end tf1 'tfile1'
199 $open/write/error=rtldef_loop1_end tf2 'dchfile'
200 $rtldef_loop1:
201 $ read/end=rtldef_loop1_end tf1 line_in
202 $ line_in = f$edit(line_in,"TRIM,COMPRESS")
203 $ key1 = f$element(0," ",line_in)
204 $ key2 = f$element(1," ",line_in)
205 $ if key1 .eqs. " " .or. key1 .eqs. "" then goto rtldef_loop1
206 $ if key2 .nes. " " .and. key2 .nes. "" then goto rtldef_loop1
207 $ write tf2 "|",key1,"|"
208 $ goto rtldef_loop1
209 $rtldef_loop1_end:
210 $if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1
211 $if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2
212 $if f$search(tfile1) .nes. "" then delete 'tfile1';*
213 $!
214 $!
215 $! Now calculate what should be in the file from reading
216 $! config.h.in and CONFIGURE.
217 $!---------------------------------------------------------------
218 $open/read inf 'cfile'
219 $do_comment = 0
220 $if_block = 0
221 $cfgh_in_loop1:
222 $!set nover
223 $ read/end=cfgh_in_loop1_end inf line_in
224 $ xline = f$edit(line_in,"TRIM,COMPRESS")
225 $!
226 $! Blank line handling
227 $!---------------------
228 $ if xline .eqs. ""
229 $ then
230 $ write tf ""
231 $ goto cfgh_in_loop1
232 $ endif
233 $ xlen = f$length(xline)
234 $ key = f$extract(0,2,xline)
235 $!
236 $! deal with comments by copying exactly
237 $!-----------------------------------------
238 $ if (do_comment .eq. 1) .or. (key .eqs. "/*")
239 $ then
240 $ do_comment = 1
241 $ write tf line_in
242 $ key = f$extract(xlen - 2, 2, xline)
243 $ if key .eqs. "*/" then do_comment = 0
244 $ goto cfgh_in_loop1
245 $ endif
246 $!
247 $! Some quick parsing
248 $!----------------------
249 $ keyif = f$extract(0,3,xline)
250 $ key1 = f$element(0," ",xline)
251 $ key2 = f$element(1," ",xline)
252 $ key2a = f$element(0,"_",key2)
253 $ key2b = f$element(1,"_",key2)
254 $ key2_len = f$length(key2)
255 $ key2_h = f$extract(key2_len - 2, 2, key2)
256 $ key2_t = f$extract(key2_len - 5, 5, key2)
257 $ if key2_t .eqs. "_TYPE" then key2_h = "_T"
258 $ key64 = 0
259 $ if f$locate("64", xline) .lt. xlen then key64 = 1
260 $!
261 $!write sys$output "xline = ''xline'"
262 $!
263 $! Comment out this section of the ifblock
264 $!-----------------------------------------
265 $ if if_block .ge. 3
266 $ then
267 $ write tf "/* ", xline, " */"
268 $ if keyif .eqs. "#en" then if_block = 0
269 $ goto cfgh_in_loop1
270 $ endif
271 $!
272 $! Handle the end of an ifblock
273 $!-------------------------------
274 $ if keyif .eqs. "#en"
275 $ then
276 $ write tf xline
277 $ if_block = 0
278 $ goto cfgh_in_loop1
279 $ endif
280 $!
281 $ if key1 .eqs. "#ifndef"
282 $ then
283 $! Manual check for _ALL_SOURCE on AIX error
284 $!-----------------------------------------------
285 $ if key2 .eqs. "_ALL_SOURCE"
286 $ then
287 $ write tf "/* ", xline, " */"
288 $!
289 $! Ignore the rest of the block
290 $!--------------------------------------
291 $ if_block = 3
292 $ goto cfgh_in_loop1
293 $ endif
294 $ endif
295 $!
296 $!
297 $! Default action for an #if/#else/#endif
298 $!------------------------------------------
299 $ if keyif .eqs. "#if" .or. keyif .eqs. "#el"
300 $ then
301 $ if_block = 1
302 $ write tf xline
303 $ goto cfgh_in_loop1
304 $ endif
305 $!
306 $!
307 $! Process "normal?" stuff
308 $!---------------------------
309 $ if key1 .eqs. "#undef"
310 $ then
311 $ key2c = f$element(2, "_", key2)
312 $ if (key2c .eqs. "_") .or. (key2c .eqs. "H") then key2c = ""
313 $ key2d = f$element(3, "_", key2)
314 $ if (key2d .eqs. "_") .or. (key2d .eqs. "H") then key2d = ""
315 $ key2e = f$element(4, "_", key2)
316 $ if (key2e .eqs. "_") .or. (key2e .eqs. "H") then key2e = ""
317 $ if key2d .eqs. "T"
318 $ then
319 $ if key2e .eqs. "TYPE"
320 $ then
321 $ key2_h = "_T"
322 $ key2d = ""
323 $ endif
324 $ endif
325 $!
326 $ double_under = 0
327 $!
328 $ if key2 .eqs. "bits16_t"
329 $ then
330 $ write tf "#ifndef ''key2'"
331 $ write tf "#define ''key2' short"
332 $ write tf "#endif"
333 $ goto cfgh_in_loop1
334 $ endif
335 $!
336 $ if key2 .eqs. "u_bits16_t"
337 $ then
338 $ write tf "#ifndef ''key2'"
339 $ write tf "#define ''key2' unsigned short"
340 $ write tf "#endif"
341 $ goto cfgh_in_loop1
342 $ endif
343 $!
344 $ if key2 .eqs. "bits32_t"
345 $ then
346 $ write tf "#ifndef ''key2'"
347 $ write tf "#define ''key2' int"
348 $ write tf "#endif"
349 $ goto cfgh_in_loop1
350 $ endif
351 $!
352 $ if key2 .eqs. "u_bits32_t"
353 $ then
354 $ write tf "#ifndef ''key2'"
355 $ write tf "#define ''key2' unsigned int"
356 $ write tf "#endif"
357 $ goto cfgh_in_loop1
358 $ endif
359 $!
360 $ if key2 .eqs. "intmax_t"
361 $ then
362 $ write tf "#ifndef HAVE_INTMAX_T"
363 $ write tf "#ifndef ''key2'"
364 $ write tf "#ifdef __VAX"
365 $ write tf "#define ''key2' long"
366 $ write tf "#else"
367 $ write tf "#define ''key2' long long"
368 $ write tf "#endif"
369 $ write tf "#endif"
370 $ write tf "#endif"
371 $ goto cfgh_in_loop1
372 $ endif
373 $!
374 $ if key2 .eqs. "uintmax_t"
375 $ then
376 $ write tf "#ifndef HAVE_UINTMAX_T
377 $ write tf "#ifndef ''key2'"
378 $ write tf "#ifdef __VAX"
379 $ write tf "#define ''key2' unsigned long"
380 $ write tf "#else"
381 $ write tf "#define ''key2' unsigned long long"
382 $ write tf "#endif"
383 $ write tf "#endif"
384 $ write tf "#endif"
385 $ goto cfgh_in_loop1
386 $ endif
387 $!
388 $ if key2 .eqs. "socklen_t"
389 $ then
390 $ write tf "#if (__CRTL_VER < 80500000)"
391 $ write tf "#ifndef ''key2'"
392 $ write tf "#define ''key2' int"
393 $ write tf "#endif"
394 $ write tf "#endif"
395 $ goto cfgh_in_loop1
396 $ endif
397 $!
398 $ if key2 .eqs. "GETGROUPS_T"
399 $ then
400 $ write tf "#ifndef ''key2'"
401 $ write tf "#define ''key2' gid_t"
402 $ write tf "#endif"
403 $ goto cfgh_in_loop1
404 $ endif
405 $!
406 $ if key2 .eqs. "HAVE_C_BOOL"
407 $ then
408 $ write tf "#if (defined(__DECC) && __DECC_VER >= 60400000)"
409 $ write tf "#define ''key2' 1"
410 $ write tf "#else"
411 $ write tf "#undef HAVE_C_BOOL"
412 $ write tf "#endif"
413 $ goto cfgh_in_loop1
414 $ endif
415 $!
416 $ if key2 .eqs. "HAVE_DECL_SYS_SIGLIST"
417 $ then
418 $ write tf "#ifndef ''key2'"
419 $ write tf "#define ''key2' 0"
420 $ write tf "#endif"
421 $ goto cfgh_in_loop1
422 $ endif
423 $!
424 $ if key2 .eqs. "HAVE_SYS_ERRLIST"
425 $ then
426 $ write tf "#ifndef ''key2'"
427 $ write tf "#define ''key2' 1"
428 $ write tf "#endif"
429 $ goto cfgh_in_loop1
430 $ endif
431 $!
432 $ if key2 .eqs. "HAVE_STRUCT_DIRENT_D_INO"
433 $ then
434 $ write tf "#ifndef ''key2'"
435 $ write tf "#define ''key2' 1"
436 $ write tf "#endif"
437 $ goto cfgh_in_loop1
438 $ endif
439 $!
440 $! ! The header files have this information, however
441 $! ! The ioctl() call only works on sockets.
442 $! if key2 .eqs. "FIONREAD_IN_SYS_IOCTL"
443 $! then
444 $! write tf "#ifndef ''key2'"
445 $! write tf "#define ''key2' 1"
446 $! write tf "#endif"
447 $! goto cfgh_in_loop1
448 $! endif
449 $!
450 $! ! The header files have this information, however
451 $! ! The ioctl() call only works on sockets.
452 $! if key2 .eqs. "GWINSZ_IN_SYS_IOCTL"
453 $! then
454 $! write tf "#ifndef ''key2'"
455 $! write tf "#define ''key2' 1"
456 $! write tf "#endif"
457 $! goto cfgh_in_loop1
458 $! endif
459 $!
460 $! ! The header files have this information, however
461 $! ! The ioctl() call only works on sockets.
462 $! if key2 .eqs. "STRUCT_WINSIZE_IN_SYS_IOCTL"
463 $! then
464 $! write tf "#ifndef ''key2'"
465 $! write tf "#define ''key2' 0"
466 $! write tf "#endif"
467 $! goto cfgh_in_loop1
468 $! endif
469 $!
470 $ if key2 .eqs. "HAVE_STRUCT_TM_TM_ZONE"
471 $ then
472 $ write tf "#ifndef ''key2'"
473 $ write tf "#define ''key2' 1"
474 $ write tf "#endif"
475 $ goto cfgh_in_loop1
476 $ endif
477 $!
478 $ if key2 .eqs. "HAVE_TM_ZONE"
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_TIMEVAL"
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_TZNAME"
495 $ then
496 $ write tf "#if __CRTL_VER >= 70000000"
497 $ write tf "#ifndef ''key2'"
498 $ write tf "#define ''key2' 1"
499 $ write tf "#endif"
500 $ write tf "#endif"
501 $ goto cfgh_in_loop1
502 $ endif
503 $!
504 $ if key2 .eqs. "WEXITSTATUS_OFFSET"
505 $ then
506 $ write tf "#ifndef ''key2'"
507 $ write tf "#define ''key2' 2"
508 $ write tf "#endif"
509 $ goto cfgh_in_loop1
510 $ endif
511 $!
512 $ if key2 .eqs. "HAVE_GETPW_DECLS"
513 $ then
514 $ write tf "#ifndef ''key2'"
515 $ write tf "#define ''key2' 1"
516 $ write tf "#endif"
517 $ goto cfgh_in_loop1
518 $ endif
519 $!
520 $ if key2 .eqs. "HAVE_DECL_CONFSTR"
521 $ then
522 $ write tf "#ifndef ''key2'"
523 $ write tf "#define ''key2' 1"
524 $ write tf "#endif"
525 $ goto cfgh_in_loop1
526 $ endif
527 $!
528 $ if key2 .eqs. "HAVE_DECL_PRINTF"
529 $ then
530 $ write tf "#ifndef ''key2'"
531 $ write tf "#define ''key2' 1"
532 $ write tf "#endif"
533 $ goto cfgh_in_loop1
534 $ endif
535 $!
536 $ if key2 .eqs. "HAVE_DECL_SBRK"
537 $ then
538 $ write tf "#ifndef ''key2'"
539 $ write tf "#define ''key2' 1"
540 $ write tf "#endif"
541 $ goto cfgh_in_loop1
542 $ endif
543 $!
544 $ if key2 .eqs. "HAVE_DECL_STRSIGNAL"
545 $ then
546 $ write tf "#ifndef ''key2'"
547 $ write tf "#define ''key2' 0"
548 $ write tf "#endif"
549 $ goto cfgh_in_loop1
550 $ endif
551 $!
552 $ if key2a .eqs. "HAVE_DECL_STRTOLD"
553 $ then
554 $ write tf "#ifndef ''key2'"
555 $ write tf "#define ''key2' 0"
556 $ write tf "#endif"
557 $ goto cfgh_in_loop1
558 $ endif
559 $!
560 $ if key2 .eqs. "HAVE_DECL_STRTOIMAX"
561 $ then
562 $ write tf "#ifndef ''key2'"
563 $ write tf "#define ''key2' 0"
564 $ write tf "#endif"
565 $ goto cfgh_in_loop1
566 $ endif
567 $!
568 $ if key2 .eqs. "HAVE_DECL_STRTOL"
569 $ then
570 $ write tf "#ifndef ''key2'"
571 $ write tf "#define ''key2' 1"
572 $ write tf "#endif"
573 $ goto cfgh_in_loop1
574 $ endif
575 $!
576 $ if key2 .eqs. "HAVE_DECL_STRTOLL"
577 $ then
578 $ write tf "#ifndef ''key2'"
579 $ write tf "#define ''key2' 1"
580 $ write tf "#endif"
581 $ goto cfgh_in_loop1
582 $ endif
583 $!
584 $ if key2 .eqs. "HAVE_DECL_STRTOUL"
585 $ then
586 $ write tf "#ifndef ''key2'"
587 $ write tf "#define ''key2' 1"
588 $ write tf "#endif"
589 $ goto cfgh_in_loop1
590 $ endif
591 $!
592 $ if key2 .eqs. "HAVE_DECL_STRTOULL"
593 $ then
594 $ write tf "#ifndef ''key2'"
595 $ write tf "#define ''key2' 1"
596 $ write tf "#endif"
597 $ goto cfgh_in_loop1
598 $ endif
599 $!
600 $ if key2 .eqs. "HAVE_DECL_STRTOUMAX"
601 $ then
602 $ write tf "#ifndef ''key2'"
603 $ write tf "#define ''key2' 0"
604 $ write tf "#endif"
605 $ goto cfgh_in_loop1
606 $ endif
607 $!
608 $ if key2 .eqs. "GETPGRP_VOID"
609 $ then
610 $ write tf "#ifndef ''key2'"
611 $ write tf "#define ''key2' 1"
612 $ write tf "#endif"
613 $ goto cfgh_in_loop1
614 $ endif
615 $!
616 $ if key2 .eqs. "NAMED_PIPES_MISSING"
617 $ then
618 $ write tf "#ifndef ''key2'"
619 $ write tf "#define ''key2' 1"
620 $ write tf "#endif"
621 $ goto cfgh_in_loop1
622 $ endif
623 $!
624 $ if key2 .eqs. "OPENDIR_NOT_ROBUST"
625 $ then
626 $ write tf "#ifndef ''key2'"
627 $ write tf "#define ''key2' 1"
628 $ write tf "#endif"
629 $ goto cfgh_in_loop1
630 $ endif
631 $!
632 $ if key2 .eqs. "PGRP_PIPE"
633 $ then
634 $ write tf "#ifndef ''key2'"
635 $ write tf "#define ''key2' 1"
636 $ write tf "#endif"
637 $ goto cfgh_in_loop1
638 $ endif
639 $!
640 $ if key2 .eqs. "CAN_REDEFINE_GETENV"
641 $ then
642 $ write tf "#ifndef ''key2'"
643 $ write tf "#define ''key2' 1"
644 $ write tf "#endif"
645 $ goto cfgh_in_loop1
646 $ endif
647 $!
648 $ if key2 .eqs. "HAVE_PRINTF_A_FORMAT"
649 $ then
650 $ write tf "#ifndef ''key2'"
651 $ write tf "#define ''key2' 1"
652 $ write tf "#endif"
653 $ goto cfgh_in_loop1
654 $ endif
655 $!
656 $ if key2 .eqs. "CTYPE_NON_ASCII"
657 $ then
658 $ write tf "#ifndef ''key2'"
659 $ write tf "#define ''key2' 1"
660 $ write tf "#endif"
661 $ goto cfgh_in_loop1
662 $ endif
663 $!
664 $ if key2 .eqs. "HAVE_LANGINFO_CODESET"
665 $ then
666 $ write tf "#ifndef ''key2'"
667 $ write tf "#define ''key2' 1"
668 $ write tf "#endif"
669 $ goto cfgh_in_loop1
670 $ endif
671 $!
672 $ if key2 .eqs. "HAVE_LC_MESSAGES"
673 $ then
674 $ write tf "#ifndef ''key2'"
675 $ write tf "#define ''key2' 1"
676 $ write tf "#endif"
677 $ goto cfgh_in_loop1
678 $ endif
679 $!
680 $! This wants execve() to do this automagically to pass.
681 $! if key2 .eqs. "HAVE_HASH_BANG_EXEC"
682 $! then
683 $! write tf "#ifndef ''key2'"
684 $! write tf "#define ''key2' 1"
685 $! write tf "#endif"
686 $! goto cfgh_in_loop1
687 $! endif
688 $!
689 $ if key2 .eqs. "ICONV_CONST"
690 $ then
691 $ write tf "#ifndef ''key2'"
692 $ write tf "#define ''key2'"
693 $ write tf "#endif"
694 $ goto cfgh_in_loop1
695 $ endif
696 $!
697 $ if key2 .eqs. "VOID_SIGHANDLER"
698 $ then
699 $ write tf "#ifndef ''key2'"
700 $ write tf "#define ''key2' 1"
701 $ write tf "#endif"
702 $ goto cfgh_in_loop1
703 $ endif
704 $!
705 $ if key2 .eqs. "HAVE_POSIX_SIGNALS"
706 $ then
707 $ write tf "#ifndef ''key2'"
708 $ write tf "#define ''key2' 1"
709 $ write tf "#endif"
710 $ goto cfgh_in_loop1
711 $ endif
712 $!
713 $ if key2 .eqs. "UNUSABLE_RT_SIGNALS"
714 $ then
715 $ write tf "#ifndef ''key2'"
716 $ write tf "#define ''key2' 1"
717 $ write tf "#endif"
718 $ goto cfgh_in_loop1
719 $ endif
720 $!
721 $ if key2a .eqs. "HAVE_DECL_FPURGE"
722 $ then
723 $ write tf "#ifndef ''key2a'"
724 $ write tf "#define ''key2a' 1"
725 $ write tf "#endif"
726 $ goto cfgh_in_loop1
727 $ endif
728 $!
729 $ if key2 .eqs. "HAVE_DECL_SETREGID"
730 $ then
731 $ write tf "#ifndef ''key2'"
732 $ write tf "#define ''key2' 1"
733 $ write tf "#endif"
734 $ goto cfgh_in_loop1
735 $ endif
736 $!
737 $ if key2 .eqs. "HAVE_POSIX_SIGSETJMP"
738 $ then
739 $ write tf "#ifndef ''key2'"
740 $ write tf "#define ''key2' 1"
741 $ write tf "#endif"
742 $ goto cfgh_in_loop1
743 $ endif
744 $!
745 $ if key2 .eqs. "HAVE_LIBDL"
746 $ then
747 $ write tf "#ifndef ''key2'"
748 $ write tf "#define ''key2' 1"
749 $ write tf "#endif"
750 $ goto cfgh_in_loop1
751 $ endif
752 $!
753 $ if key2 .eqs. "STRCOLL_BROKEN"
754 $ then
755 $ write tf "#ifndef ''key2'"
756 $ write tf "#define ''key2' 1"
757 $ write tf "#endif"
758 $ goto cfgh_in_loop1
759 $ endif
760 $!
761 $ if key2 .eqs. "DUP_BROKEN"
762 $ then
763 $ write tf "#ifndef ''key2'"
764 $ write tf "#define ''key2' 1"
765 $ write tf "#endif"
766 $ goto cfgh_in_loop1
767 $ endif
768 $!
769 $! This is for a test that getcwd(0,0) works.
770 $! It does not on VMS.
771 $!--------------------------
772 $ if key2 .eqs. "GETCWD_BROKEN"
773 $ then
774 $ write sys$output ""
775 $ write sys$output -
776 "%CONFIG_H-I-NONPORT, ''key2' being tested for!"
777 $ write sys$output -
778 "-CONFIG_H-I-GETCWD, GETCWD(0,0) does not work on VMS."
779 $ write sys$output -
780 "-CONFIG_H-I-GETCWD2, Work around hack probably required."
781 $ write sys$output -
782 "-CONFIG_H-I-REVIEW, Manual Code review required!"
783 $ if update_config_vms
784 $ then
785 $ open/append tfcv sys$disk:[]config_vms.h
786 $ write tfcv ""
787 $ write tfcv -
788 "/* Check config.h for use of ''key2' settings */"
789 $ write tfcv ""
790 $ close tfcv
791 $ endif
792 $
793 $ goto cfgh_in_loop1
794 $ endif
795 $!
796 $ if key2a .eqs. "HAVE" .or. key2a .eqs. "STAT"
797 $ then
798 $!
799 $! Process extra underscores
800 $!------------------------------------
801 $ if f$locate("HAVE___", key2) .lt. key2_len
802 $ then
803 $ key2b = "__" + key2d
804 $ key2d = ""
805 $ double_under = 1
806 $ else
807 $ if f$locate("HAVE__", key2) .lt. key2_len
808 $ then
809 $ key2b = "_" + key2c
810 $ key2c = ""
811 $ double_under = 1
812 $ endif
813 $ endif
814 $!
815 $ if key2_h .eqs. "_H"
816 $ then
817 $!
818 $! Looking for a header file
819 $!---------------------------------------
820 $ headf = key2b
821 $ if key2c .nes. "" then headf = headf + "_" + key2c
822 $ if key2d .nes. "" then headf = headf + "_" + key2d
823 $!
824 $! (key2b .eqs. "READLINE")
825 $!
826 $! Some special parsing
827 $!------------------------------------------
828 $ if (key2b .eqs. "SYS") .or. (key2b .eqs. "ARPA") .or. -
829 (key2b .eqs. "NET") .or. (key2b .eqs. "NETINET")
830 $ then
831 $ if key2c .nes. ""
832 $ then
833 $ headf = key2c
834 $ if key2d .nes. "" then headf = key2c + "_" + key2d
835 $ endif
836 $ endif
837 $!
838 $! And of course what's life with out some special cases
839 $!--------------------------------------------------------------------
840 $ if key2b .eqs. "FILE"
841 $ then
842 $ write sys$output ""
843 $ write sys$output -
844 "%CONFIG_H-I-NONPORT, ''key2' being asked for!"
845 $ write sys$output -
846 "-CONFIG_H-I-FILE_OLD, file.h will not be configured as is obsolete!"
847 $ write sys$output -
848 "-CONFIG_H_I-FCNTL_NEW, "Expecting fcntl.h to be configured instead!"
849 $ write sys$output -
850 "-CONFIG_H_I-FCNTL_CHK, "Unable to verify at this time!"
851 $ write sys$output -
852 "-CONFIG_H-I-REVIEW, Manual Code review required!"
853 $!
854 $ if update_config_vms
855 $ then
856 $ open/append tfcv sys$disk:[]config_vms.h
857 $ write tfcv ""
858 $ write tfcv -
859 "/* Check config.h for use of fcntl.h instead of file.h */"
860 $ write tfcv ""
861 $ close tfcv
862 $ endif
863 $ endif
864 $!
865 $! Now look it up in the DEC C RTL
866 $!---------------------------------------------
867 $ define/user sys$output nl:
868 $ define/user sys$error nl:
869 $ search/output=nl: 'dchfile' |'headf'|/exact
870 $ if '$severity' .eq. 1
871 $ then
872 $ if key64 then write tf "#ifndef __VAX"
873 $ write tf "#ifndef ''key2'"
874 $ write tf "#define ''key2' 1"
875 $if p2 .nes. "" then write sys$output "''dchfile' - #define ''key2' 1"
876 $ write tf "#endif"
877 $ if key64 then write tf "#endif"
878 $ goto cfgh_in_loop1
879 $ endif
880 $!
881 $ else
882 $!
883 $! Looking for a routine or a symbol
884 $!------------------------------------------------
885 $ if key2c .eqs. "MACRO"
886 $ then
887 $ if (key2b .eqs. "FILE") .or. (key2b .eqs. "DATE") -
888 .or. (key2b .eqs. "LINE") .or. (key2b .eqs. "TIME")
889 $ then
890 $ write tf "#ifndef HAVE_''key2b'"
891 $ write tf "#define HAVE_''key2b' 1"
892 $ write tf "#endif"
893 $ endif
894 $ goto cfgh_in_loop1
895 $ endif
896 $!
897 $! Special false tests
898 $!-------------------------------------
899 $ if double_under
900 $ then
901 $ if key2b .eqs. "_FCNTL" .or. key2b .eqs. "__FCNTL"
902 $ then
903 $ write tf "/* #undef HAVE_''key2b' */"
904 $ goto cfgh_in_loop1
905 $ endif
906 $!
907 $ if key2b .eqs. "_STAT" .or. key2b .eqs. "__STAT"
908 $ then
909 $ write tf "/* #undef HAVE_''key2b' */"
910 $ goto cfgh_in_loop1
911 $ endif
912 $!
913 $ if key2b .eqs. "_READ" .or. key2b .eqs. "__READ"
914 $ then
915 $ write tf "/* #undef HAVE_''key2b' */"
916 $ goto cfgh_in_loop1
917 $ endif
918 $ endif
919 $!
920 $ keysym = key2b
921 $ if key2c .nes. "" then keysym = keysym + "_" + key2c
922 $ if key2d .nes. "" then keysym = keysym + "_" + key2d
923 $ if key2e .nes. "" then keysym = keysym + "_" + key2e
924 $!
925 $!
926 $! Stat structure members
927 $!-------------------------------------
928 $ if key2b .eqs. "STRUCT"
929 $ then
930 $ if key2c .eqs. "STAT" .and (key2d .nes. "")
931 $ then
932 $ key2b = key2b + "_" + key2c + "_" + key2d
933 $ key2c = key2e
934 $ key2d = ""
935 $ key2e = ""
936 $ endif
937 $ endif
938 $ if (key2b .eqs. "ST") .or. (key2b .eqs. "STRUCT_STAT_ST")
939 $ then
940 $ keysym = "ST" + "_" + key2c
941 $ keysym = f$edit(keysym,"LOWERCASE")
942 $ endif
943 $ if key2a .eqs. "STAT"
944 $ then
945 $ if (f$locate("STATVFS", key2b) .eq. 0) .and. key2c .eqs. ""
946 $ then
947 $ keysym = f$edit(key2b, "LOWERCASE")
948 $ endif
949 $!$ if (key2b .eqs. "STATVFS" .or. key2b .eqs. "STATFS2" -
950 $! .or. key2b .eqs. "STATFS3") .and. key2c .nes. ""
951 $!
952 $ if (key2b .eqs. "STATVFS") .and. key2c .nes. ""
953 $ then
954 $! Should really verify that the structure
955 $! named by key2b actually exists first.
956 $!------------------------------------------------------------
957 $!
958 $! Statvfs structure members
959 $!-------------------------------------------------
960 $ keysym = "f_" + f$edit(key2c,"LOWERCASE")
961 $ endif
962 $ endif
963 $!
964 $! UTMPX structure members
965 $!--------------------------------------
966 $ if key2b .eqs. "UT" .and. key2c .eqs. "UT"
967 $ then
968 $ keysym = "ut_" + f$edit(key2d,"LOWERCASE")
969 $ endif
970 $!
971 $ if f$locate("MMAP",key2) .lt. key2_len
972 $ then
973 $ write sys$output ""
974 $ write sys$output -
975 "%CONFIG_H-I-NONPORT, ''key2' being asked for!"
976 $ write sys$output -
977 "-CONFIG_H-I-MMAP, MMAP operations only work on STREAM and BINARY files!"
978 $ write sys$output -
979 "-CONFIG_H-I-REVIEW, Manual Code review required!"
980 $ if update_config_vms
981 $ then
982 $ open/append tfcv sys$disk:[]config_vms.h
983 $ write tfcv ""
984 $ write tfcv -
985 "/* Check config.h for use of ''key2' settings */"
986 $ write tfcv ""
987 $ close tfcv
988 $ endif
989 $ endif
990 $!
991 $!
992 $ if keysym .eqs. "CRYPT"
993 $ then
994 $ write sys$output ""
995 $ write sys$output -
996 "%CONFIG_H-I-NONPORT, ''key2' being asked for!"
997 $ write sys$output -
998 "-CONFIG_H-I-CRYPT, CRYPT operations on the VMS SYSUAF may not work!"
999 $ write sys$output -
1000 "-CONFIG_H-I-REVIEW, Manual Code review required!"
1001 $ if update_config_vms
1002 $ then
1003 $ open/append tfcv sys$disk:[]config_vms.h
1004 $ write tfcv ""
1005 $ write tfcv -
1006 "/* Check config.h for use of ''keysym' */"
1007 $ write tfcv ""
1008 $ close tfcv
1009 $ endif
1010 $ endif
1011 $!
1012 $!
1013 $ if keysym .eqs. "EXECL"
1014 $ then
1015 $ write sys$output ""
1016 $ write sys$output -
1017 "%CONFIG_H-I-NONPORT, ''key2' being asked for!"
1018 $ write sys$output -
1019 "-CONFIG_H-I-EXCEL, EXECL configured, Will probably not work."
1020 $ write sys$output -
1021 "-CONFIG_H-I-REVIEW, Manual Code review required!"
1022 $ if update_config_vms
1023 $ then
1024 $ open/append tfcv sys$disk:[]config_vms.h
1025 $ write tfcv ""
1026 $ write tfcv -
1027 "/* Check config.h for use of ''keysym' */"
1028 $ write tfcv ""
1029 $ close tfcv
1030 $ endif
1031 $ endif
1032 $!
1033 $!
1034 $! Process if cpp supports ANSI-C stringizing '#' operator
1035 $!-----------------------------------------------------------------------
1036 $ if keysym .eqs. "STRINGIZE"
1037 $ then
1038 $ write tf "#ifndef HAVE_STRINGIZE"
1039 $ write tf "#define HAVE_STRINGSIZE 1"
1040 $ write tf "#endif"
1041 $ goto cfgh_in_loop1
1042 $ endif
1043 $!
1044 $ if keysym .eqs. "VOLATILE"
1045 $ then
1046 $ write tf "#ifndef HAVE_VOLATILE"
1047 $ write tf "#define HAVE_VOLATILE 1"
1048 $ write tf "#endif"
1049 $ goto cfgh_in_loop1
1050 $ endif
1051 $!
1052 $ if keysym .eqs. "ALLOCA"
1053 $ then
1054 $ write tf "#ifndef HAVE_ALLOCA"
1055 $ write tf "#define HAVE_ALLOCA 1"
1056 $ write tf "#endif"
1057 $ goto cfgh_in_loop1
1058 $ endif
1059 $!
1060 $ if keysym .eqs. "ERRNO_DECL"
1061 $ then
1062 $ write tf "#ifndef HAVE_ERRNO_DECL"
1063 $ write tf "#define HAVE_ERRNO_DECL 1"
1064 $ write tf "#endif"
1065 $ goto cfgh_in_loop1
1066 $ endif
1067 $!
1068 $ if keysym .eqs. "LONGLONG"
1069 $ then
1070 $ write tf "#ifndef __VAX"
1071 $ write tf "#pragma message disable longlongtype"
1072 $ write tf "#ifndef HAVE_LONGLONG"
1073 $ write tf "#define HAVE_LONGLONG 1"
1074 $ write tf "#endif"
1075 $ write tf "#endif"
1076 $ goto cfgh_in_loop1
1077 $ endif
1078 $!
1079 $! May need to test compiler version
1080 $!-----------------------------------------------
1081 $ if (keysym .eqs. "LONG_LONG") .or. -
1082 (keysym .eqs. "LONG_LONG_INT")
1083 $ then
1084 $ write tf "#ifndef __VAX"
1085 $ write tf "#pragma message disable longlongtype"
1086 $ write tf "#ifndef HAVE_''keysym'"
1087 $ write tf "#define HAVE_''keysym' 1"
1088 $ write tf "#endif"
1089 $ write tf "#endif"
1090 $ goto cfgh_in_loop1
1091 $ endif
1092 $!
1093 $! May need to test compiler version
1094 $!-----------------------------------------------
1095 $ if keysym .eqs. "UNSIGNED_LONG_LONG"
1096 $ then
1097 $ write tf "#ifndef __VAX"
1098 $ write tf "#pragma message disable longlongtype"
1099 $ write tf "#ifndef HAVE_UNSIGNED_LONG_LONG"
1100 $ write tf "#define HAVE_UNSIGNED_LONG_LONG 1"
1101 $ write tf "#endif"
1102 $ write tf "#endif"
1103 $ goto cfgh_in_loop1
1104 $ endif
1105 $!
1106 $! May need to test compiler version
1107 $!-----------------------------------------------
1108 $ if keysym .eqs. "UNSIGNED_LONG_LONG_INT"
1109 $ then
1110 $ write tf "#ifndef __VAX"
1111 $ write tf "#pragma message disable longlongtype"
1112 $ write tf "#ifndef HAVE_UNSIGNED_LONG_LONG_INT"
1113 $ write tf "#define HAVE_UNSIGNED_LONG_LONG_INT 1"
1114 $ write tf "#endif"
1115 $ write tf "#endif"
1116 $ goto cfgh_in_loop1
1117 $ endif
1118 $!
1119 $! May need to test compiler version
1120 $!-----------------------------------------------
1121 $ if keysym .eqs. "LONG_DOUBLE"
1122 $ then
1123 $ write tf "#ifndef __VAX"
1124 $ write tf "#pragma message disable longlongtype"
1125 $ write tf "#ifndef HAVE_LONG_DOUBLE"
1126 $ write tf "#define HAVE_LONG_DOUBLE 1"
1127 $ write tf "#endif"
1128 $ write tf "#endif"
1129 $ goto cfgh_in_loop1
1130 $ endif
1131 $!
1132 $ if keysym .eqs. "FCNTL_LOCK"
1133 $ then
1134 $ write sys$output -
1135 "%CONFIG_H-I-NONPORT, ''key2' being asked for!
1136 $ write sys$output -
1137 "-CONFIG_H-I-REVIEW, Manual Code review required!"
1138 $ goto cfgh_in_loop1
1139 $ endif
1140 $!
1141 $!
1142 $! These libraries are provided by the DEC C RTL
1143 $!-------------------------------------------------------------
1144 $ if keysym .eqs. "LIBINET" .or. keysym .eqs. "LIBSOCKET"
1145 $ then
1146 $ write tf "#ifndef HAVE_''keysym'"
1147 $ write tf "#define HAVE_''keysym' 1"
1148 $if p2 .nes. "" then write sys$output "''decc_shr' #define ''keysym' 1"
1149 $ write tf "#endif
1150 $ goto cfgh_in_loop1
1151 $ endif
1152 $!
1153 $!
1154 $ if keysym .eqs. "HERRNO" then keysym = "h_errno"
1155 $ if keysym .eqs. "UTIMBUF" then keysym = "utimbuf"
1156 $ if key2c .eqs. "STRUCT"
1157 $ then
1158 $ keysym = f$edit(key2d,"LOWERCASE")
1159 $ else
1160 $ if key2_h .eqs. "_T"
1161 $ then
1162 $ if key2_t .eqs. "_TYPE"
1163 $ then
1164 $ keysym = f$extract(0, key2_len - 5, key2) - "HAVE_"
1165 $ endif
1166 $ keysym = f$edit(keysym,"LOWERCASE")
1167 $ endif
1168 $ endif
1169 $!
1170 $! Check the DEC C RTL shared image first
1171 $!------------------------------------------------------
1172 $ if f$search(tfile1) .nes. "" then delete 'tfile1';*
1173 $ define/user sys$output nl:
1174 $ define/user sys$error nl:
1175 $ search/format=nonull/out='tfile1' 'decc_shr' 'keysym'
1176 $ if '$severity' .eq. 1
1177 $ then
1178 $!
1179 $! Not documented, but from observation
1180 $!------------------------------------------------------
1181 $ define/user sys$output nl:
1182 $ define/user sys$error nl:
1183 $ if arch_type .eq. 3
1184 $ then
1185 $ keyterm = "''keysym'<SOH>"
1186 $ else
1187 $ if arch_type .eq. 2
1188 $ then
1189 $ keyterm = "''keysym'<BS>"
1190 $ else
1191 $ keyterm = "''keysym'<STX>"
1192 $ endif
1193 $ endif
1194 $ search/out=nl: 'tfile1' -
1195 "$''keyterm'","$g''keyterm'","$__utc_''keyterm'",-
1196 "$__utctz_''keyterm'","$__bsd44_''keyterm'","$bsd_''keyterm'",-
1197 "$''keysym'decc$","$G''keysym'decc$","$GX''keyterm'"
1198 $ severity = '$severity'
1199 $!
1200 $!
1201 $! Of course the 64 bit stuff is different
1202 $!---------------------------------------------------------
1203 $ if severity .ne. 1 .and. key64
1204 $ then
1205 $ define/user sys$output nl:
1206 $ define/user sys$error nl:
1207 $ search/out=nl: 'tfile1' "$_''keyterm'"
1208 $! search/out 'tfile1' "$_''keyterm'"
1209 $ severity = '$severity'
1210 $ endif
1211 $!
1212 $! UNIX compatability routines
1213 $!---------------------------------------------
1214 $ if severity .ne. 1
1215 $ then
1216 $ define/user sys$output nl:
1217 $ define/user sys$error nl:
1218 $ search/out=nl: 'tfile1' -
1219 "$__unix_''keyterm'","$__vms_''keyterm'","$_posix_''keyterm'"
1220 $ severity = '$severity'
1221 $ endif
1222 $!
1223 $! VAX special handling routines
1224 $!---------------------------------------------
1225 $ if (severity .ne. 1) .and. (arch_type .eq. 1)
1226 $ then
1227 $ define/user sys$output nl:
1228 $ define/user sys$error nl:
1229 $ search/out=nl: 'tfile1' "DECC$''keysym'<SOH>"
1230 $ severity = '$severity'
1231 $ endif
1232 $!
1233 $! Show the result of the search
1234 $!------------------------------------------------
1235 $ if 'severity' .eq. 1
1236 $ then
1237 $ if key64 then write tf "#ifndef __VAX"
1238 $ write tf "#ifndef ''key2'"
1239 $ write tf "#define ''key2' 1"
1240 $if p2 .nes. "" then write sys$output "''decc_shr' #define ''key2' 1"
1241 $ write tf "#endif"
1242 $ if key64 then write tf "#endif"
1243 $ goto cfgh_in_loop1
1244 $ endif
1245 $ endif
1246 $ if f$search(tfile1) .nes. "" then delete 'tfile1';*
1247 $!
1248 $! Check the DECC Header files next
1249 $!----------------------------------------------
1250 $ define/user sys$output nl:
1251 $ define/user sys$error nl:
1252 $ search/out=nl: 'decc_rtldef' -
1253 "''keysym';", "''keysym'[", "struct ''keysym'"/exact
1254 $ severity = '$severity'
1255 $ if severity .eq. 1
1256 $ then
1257 $ if key64 then write tf "#ifndef __VAX"
1258 $ write tf "#ifndef ''key2'"
1259 $ write tf "#define ''key2' 1"
1260 $if p2 .nes. "" then write sys$output "''decc_rtldef' #define ''key2' 1"
1261 $ write tf "#endif"
1262 $ if key64 then write tf "#endif"
1263 $ goto cfgh_in_loop1
1264 $ endif
1265 $!
1266 $ endif
1267 $ write tf "/* ", xline, " */"
1268 $ goto cfgh_in_loop1
1269 $ endif
1270 $!
1271 $!
1272 $! Process SIZEOF directives found in SAMBA
1273 $!------------------------------------------------
1274 $ if key2a .eqs. "SIZEOF"
1275 $ then
1276 $ if key2b .eqs. "INO" .and. key2_h .eqs. "_T"
1277 $ then
1278 $ write tf "#ifndef SIZEOF_INO_T"
1279 $ write tf "#define SIZEOF_INO_T (6)"
1280 $ write tf "#endif"
1281 $ goto cfgh_in_loop1
1282 $ endif
1283 $ if key2b .eqs. "INTMAX" .and. key2_h .eqs. "_T"
1284 $ then
1285 $ write tf "#ifndef SIZEOF_INTMAX_T"
1286 $ write tf "#ifdef __VAX"
1287 $ write tf "#define SIZEOF_INTMAX_T (4)"
1288 $ write tf "#else"
1289 $ write tf "#define SIZEOF_INTMAX_T (8)"
1290 $ write tf "#endif"
1291 $ write tf "#endif"
1292 $ goto cfgh_in_loop1
1293 $ endif
1294 $ if key2b .eqs. "OFF" .and. key2_h .eqs. "_T"
1295 $ then
1296 $ write tf "#ifndef SIZEOF_OFF_T"
1297 $ write tf "#ifdef __VAX"
1298 $ write tf "#define SIZEOF_OFF_T (4)"
1299 $ write tf "#else"
1300 $ write tf "#define SIZEOF_OFF_T (8)"
1301 $ write tf "#endif"
1302 $ write tf "#endif"
1303 $ goto cfgh_in_loop1
1304 $ endif
1305 $ if key2b .eqs. "CHAR" .and. key2_h .eqs. "_P"
1306 $ then
1307 $ write tf "#ifndef SIZEOF_CHAR_P"
1308 $ write tf "#define SIZEOF_CHAR_P (4)"
1309 $ write tf "#endif"
1310 $ goto cfgh_in_loop1
1311 $ endif
1312 $ if (key2b .eqs. "INT")
1313 $ then
1314 $ write tf "#ifndef SIZEOF_''key2b'"
1315 $ write tf "#define SIZEOF_''key2b' (4)"
1316 $ write tf "#endif"
1317 $ goto cfgh_in_loop1
1318 $ endif
1319 $ if key2b .eqs. "UNSIGNED"
1320 $ then
1321 $ if key2c .eqs. "INT" .or. key2c .eqs. "LONG"
1322 $ then
1323 $ write tf "#ifndef SIZEOF_''key2b'_''key2c'"
1324 $ write tf "#define SIZEOF_''key2b'_''key2c' (4)"
1325 $ write tf "#endif"
1326 $ goto cfgh_in_loop1
1327 $ endif
1328 $ endif
1329 $ if key2b .eqs. "DOUBLE"
1330 $ then
1331 $ write tf "#ifndef SIZEOF_DOUBLE"
1332 $ write tf "#define SIZEOF_DOUBLE (8)"
1333 $ write tf "#endif"
1334 $ goto cfgh_in_loop1
1335 $ endif
1336 $ if key2b .eqs. "LONG"
1337 $ then
1338 $ if key2c .eqs. ""
1339 $ then
1340 $ write tf "#ifndef SIZEOF_LONG"
1341 $ write tf "#define SIZEOF_LONG (4)"
1342 $ write tf "#endif"
1343 $ else
1344 $ write tf "#ifndef SIZEOF_LONG_LONG"
1345 $ write tf "#ifndef __VAX"
1346 $ write tf "#define SIZEOF_LONG_LONG (8)"
1347 $ write tf "#endif"
1348 $ write tf "#endif"
1349 $ endif
1350 $ goto cfgh_in_loop1
1351 $ endif
1352 $ if key2b .eqs. "SHORT"
1353 $ then
1354 $ write tf "#ifndef SIZEOF_SHORT"
1355 $ write tf "#define SIZEOF_SHORT (2)"
1356 $ write tf "#endif"
1357 $ goto cfgh_in_loop1
1358 $ endif
1359 $ write tf "/* ", xline, " */"
1360 $ goto cfgh_in_loop1
1361 $ endif
1362 $!
1363 $! Process NEED directives
1364 $!-------------------------------
1365 $ if key2a .eqs. "NEED"
1366 $ then
1367 $ if key2b .eqs. "STRINGS" .and. key2_h .eqs. "_H"
1368 $ then
1369 $ write tf "#ifndef NEED_STRINGS_H"
1370 $ write tf "#define NEED_STRINGS_H 1"
1371 $ write tf "#endif"
1372 $ goto cfgh_in_loop1
1373 $ endif
1374 $ write tf "/* ", xline, " */"
1375 $ goto cfgh_in_loop1
1376 $ endif
1377 $!
1378 $!
1379 $! Process STATFS directives
1380 $!-------------------------------
1381 $! if key2a .eqs. "STATFS"
1382 $! then
1383 $! write tf "/* ", xline, " */"
1384 $! goto cfgh_in_loop1
1385 $! endif
1386 $!
1387 $! Process inline directive
1388 $!------------------------------
1389 $ if key2 .eqs. "inline"
1390 $ then
1391 $ write tf "#ifndef inline"
1392 $ write tf "#define inline __inline"
1393 $ write tf "#endif"
1394 $ goto cfgh_in_loop1
1395 $ endif
1396 $!
1397 $! Process restrict directive
1398 $!--------------------------------
1399 $ if key2 .eqs. "restrict"
1400 $ then
1401 $ write tf "#ifndef restrict"
1402 $ write tf "#define restrict __restrict"
1403 $ write tf "#endif"
1404 $ goto cfgh_in_loop1
1405 $ endif
1406 $!
1407 $! Process RETSIGTYPE directive
1408 $!----------------------------------
1409 $ if key2 .eqs. "RETSIGTYPE"
1410 $ then
1411 $ write tf "#ifndef RETSIGTYPE"
1412 $ write tf "#define RETSIGTYPE void"
1413 $ write tf "#endif"
1414 $ goto cfgh_in_loop1
1415 $ endif
1416 $!
1417 $! Process STDC_HEADERS (SAMBA!)
1418 $!---------------------------
1419 $ if key2 .eqs. "STDC_HEADERS"
1420 $ then
1421 $ write tf "#ifndef STDC_HEADERS"
1422 $ write tf "#define STDC_HEADERS 1"
1423 $ write tf "#endif"
1424 $ goto cfgh_in_loop1
1425 $ endif
1426 $!
1427 $! Process PROTOTYPES directive
1428 $!-------------------------------------
1429 $ if key2 .eqs. "PROTOTYPES"
1430 $ then
1431 $ write tf "#ifndef PROTOTYPES"
1432 $ write tf "#define PROTOTYPES 1"
1433 $ write tf "#endif"
1434 $ goto cfgh_in_loop1
1435 $ endif
1436 $!
1437 $! Special for SEEKDIR_RETURNS_VOID
1438 $!---------------------------------------
1439 $ if key2 .eqs. "SEEKDIR_RETURNS_VOID"
1440 $ then
1441 $ write tf "#ifndef SEEKDIR_RETURNS_VOID"
1442 $ write tf "#define SEEKDIR_RETURNS_VOID 1"
1443 $ write tf "#endif"
1444 $ endif
1445 $!
1446 $! TIME_WITH_SYS_TIME note: On VMS time.h and sys/time.h are same module.
1447 $!
1448 $! TIME_T_IN_SYS_TYPES_H
1449 $!------------------------------
1450 $ if key2 .eqs. "TIME_T_IN_TYPES_H"
1451 $ then
1452 $ write tf "#ifndef ''key2'"
1453 $ write tf "#define ''key2' 1"
1454 $ write tf "#endif"
1455 $ endif
1456 $!
1457 $! Unknown - See if CONFIGURE can give a clue for this
1458 $!----------------------------------------------------------
1459 $ pflag = 0
1460 $ set_flag = 0
1461 $! gproj_name = proj_name - "_VMS" - "-VMS"
1462 $ if f$search(tfile1) .nes. "" then delete 'tfile1';*
1463 $ define/user sys$output nl:
1464 $ define/user sys$error nl:
1465 $! if f$locate("FILE", key2) .lt. key2_len then pflag = 1
1466 $! if f$locate("DIR", key2) .eq. key2_len - 3 then pflag = 1
1467 $! if f$locate("PATH", key2) .eq. key2_len - 4 then pflag = 1
1468 $!
1469 $ search/out='tfile1' 'configure_script' "''key2'="/exact
1470 $ search_sev = '$severity'
1471 $ if 'search_sev' .eq. 1
1472 $ then
1473 $ open/read/err=unknown_cf_rd_error sf 'tfile1'
1474 $search_file_rd_loop:
1475 $ read/end=unknown_cf_rd_err sf line_in
1476 $ line_in = f$edit(line_in, "TRIM")
1477 $ skey1 = f$element(0,"=",line_in)
1478 $ if skey1 .eqs. key2
1479 $ then
1480 $ skey2 = f$element(1,"=",line_in)
1481 $ skey2a = f$extract(0,2,skey2)
1482 $!
1483 $! Keep these two cases separate to make it easier to add
1484 $! more future intelligence to this routine
1485 $!----------------------------------------------------------------------
1486 $ if skey2a .eqs. """`"
1487 $ then
1488 $! if pflag .eq. 1
1489 $! then
1490 $! write tf "#ifndef ''key2'"
1491 $! write tf "#define ",key2," """,gproj_name,"_",key2,""""
1492 $! write tf "#endif"
1493 $! else
1494 $! Ignore this for now
1495 $!------------------------------------------
1496 $ write tf "/* ", xline, " */"
1497 $! endif
1498 $ set_flag = 1
1499 $ goto found_in_configure
1500 $ endif
1501 $ if skey2a .eqs. """$"
1502 $ then
1503 $! if pflag .eq. 1
1504 $! then
1505 $! write tf "#ifndef ''key2'"
1506 $! write tf "#define ",key2," """,gproj_name,"_",key2,""""
1507 $! write tf "#endif"
1508 $! else
1509 $! Ignore this for now
1510 $!-------------------------------------------
1511 $ write tf "/* ", xline, " */"
1512 $! endif
1513 $ set_flag = 1
1514 $ goto found_in_configure
1515 $ endif
1516 $ if f$extract(0, 1, skey2) .eqs. "'"
1517 $ then
1518 $ skey2 = skey2 - "'" - "'"
1519 $ endif
1520 $ write tf "#ifndef ''key2'"
1521 $ write tf "#define ",key2," """,skey2,""""
1522 $ write tf "#endif"
1523 $ set_flag = 1
1524 $ else
1525 $ goto search_file_rd_loop
1526 $! if pflag .eq. 1
1527 $! then
1528 $! write tf "#ifndef ''key2'"
1529 $! write tf "#define ",key2," """,gproj_name,"_",key2,""""
1530 $! write tf "#endif"
1531 $! set_flag = 1
1532 $! endif
1533 $ endif
1534 $found_in_configure:
1535 $unknown_cf_rd_err:
1536 $ if f$trnlnm("sf","lnm$process",,"SUPERVISOR") .nes. ""
1537 $ then
1538 $ close sf
1539 $ endif
1540 $ if f$search(tfile1) .nes. "" then delete 'tfile1';*
1541 $ if set_flag .eq. 1 then goto cfgh_in_loop1
1542 $ endif
1543 $ endif
1544 $!
1545 $!
1546 $!
1547 $! If it falls through everything else, comment it out
1548 $!-----------------------------------------------------
1549 $ write tf "/* ", xline, " */"
1550 $ goto cfgh_in_loop1
1551 $cfgh_in_loop1_end:
1552 $close inf
1553 $!
1554 $!
1555 $! Write out the tail
1556 $!--------------------
1557 $write_tail:
1558 $gosub write_config_h_tail
1559 $!
1560 $! Exit and clean up
1561 $!--------------------
1562 $general_error:
1563 $status = '$status'
1564 $all_exit:
1565 $set noon
1566 $if f$trnlnm("sf","lnm$process",,"SUPERVISOR") .nes. "" then close sf
1567 $if f$trnlnm("tf","lnm$process",,"SUPERVISOR") .nes. "" then close tf
1568 $if f$trnlnm("inf","lnm$process",,"SUPERVISOR") .nes. "" then close inf
1569 $if f$trnlnm("tf1","lnm$process",,"SUPERVISOR") .nes. "" then close tf1
1570 $if f$trnlnm("tf2","lnm$process",,"SUPERVISOR") .nes. "" then close tf2
1571 $if f$trnlnm("tfcv","lnm$process",,"SUPERVISOR") .nes. "" then close tfcv
1572 $if f$type(tfile1) .eqs. "STRING"
1573 $then
1574 $ if f$search(tfile1) .nes. "" then delete 'tfile1';*
1575 $endif
1576 $if f$type(dchfile) .eqs. "STRING"
1577 $then
1578 $ if f$search(dchfile) .nes. "" then delete 'dchfile';*
1579 $endif
1580 $if f$type(configure_script) .eqs. "STRING"
1581 $then
1582 $ if f$search(configure_script) .nes. "" then delete 'configure_script';*
1583 $endif
1584 $exit 'status'
1585 $!
1586 $!
1587 $control_y:
1588 $ status = ss_control_y
1589 $ goto all_exit
1590 $!
1591 $!
1592 $!
1593 $! Gosub to write a new config_vms.h
1594 $!-----------------------------------
1595 $write_config_vms:
1596 $outfile = "sys$disk:[]config_vms.h"
1597 $create 'outfile'
1598 $open/append tf 'outfile'
1599 $write tf "/* File: config_vms.h"
1600 $write tf "**"
1601 $write tf "** This file contains the manual edits needed for porting"
1602 $!write tf "** the ''proj_name' package to OpenVMS.
1603 $write tf "**"
1604 $write tf "** Edit this file as needed. The procedure that automatically"
1605 $write tf "** generated this header stub will not overwrite or make any"
1606 $write tf "** changes to this file."
1607 $write tf "**"
1608 $write tf -
1609 "** ", datetime, tab, username, tab, "Generated by ''my_proc_file'"
1610 $write tf "**"
1611 $write tf -
1612 "**========================================================================*/"
1613 $write tf ""
1614 $close tf
1615 $return
1616 $!
1617 $! gosub to write out a documentation header for config.h
1618 $!----------------------------------------------------------------
1619 $write_config_h_header:
1620 $outfile = "sys$disk:[]config.h"
1621 $create 'outfile'
1622 $open/append tf 'outfile'
1623 $write tf "#ifndef CONFIG_H"
1624 $write tf "#define CONFIG_H"
1625 $write tf "/* File: config.h"
1626 $write tf "**"
1627 $write tf -
1628 "** This file contains the options needed for porting "
1629 $write tf "** the project on a VMS system."
1630 $write tf "**"
1631 $write tf "** Try not to make any edits to this file, as it is"
1632 $write tf "** automagically generated."
1633 $write tf "**"
1634 $write tf "** Manual edits should be made to the config_vms.h file."
1635 $write tf "**"
1636 $write tf -
1637 "** ", datetime, tab, username, tab, "Generated by ''my_proc_file'"
1638 $write tf "**"
1639 $write tf -
1640 "**========================================================================*/"
1641 $write tf ""
1642 $write tf "#if (__CRTL_VER >= 70200000) && !defined (__VAX)"
1643 $write tf "#define _LARGEFILE 1"
1644 $write tf "#endif"
1645 $write tf ""
1646 $write tf "#ifndef __VAX"
1647 $write tf "#ifdef __CRTL_VER"
1648 $write tf "#if __CRTL_VER >= 80200000"
1649 $write tf "#define _USE_STD_STAT 1"
1650 $write tf "#endif"
1651 $write tf "#endif"
1652 $write tf "#endif"
1653 $write tf ""
1654 $!
1655 $if P1 .nes. "NOBUILTINS"
1656 $then
1657 $ write tf " /* Allow compiler builtins */"
1658 $ write tf "/*-------------------------*/"
1659 $ write tf "#ifdef __DECC_VER"
1660 $ write tf "#include <non_existant_dir:builtins.h>"
1661 $ write tf "#endif"
1662 $endif
1663 $!
1664 $write tf ""
1665 $return
1666 $!
1667 $! gosub to write out the tail for config.h and close it
1668 $!---------------------------------------------------------
1669 $write_config_h_tail:
1670 $write tf ""
1671 $write tf " /* Include the hand customized settings */"
1672 $write tf "/*--------------------------------------*/"
1673 $write tf "#include ""sys$disk:config_vms.h"""
1674 $write tf ""
1675 $write tf "#endif /* CONFIG_H */"
1676 $close tf
1677 $return
1678 $!