config_h.com 56 KB

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