2
0

config_h.com 53 KB

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