config_h.com 56 KB

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