config_h.com 55 KB

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