generate_config_vms_h_curl.com 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. $! File: GENERATE_CONFIG_H_CURL.COM
  2. $!
  3. $! Curl like most open source products uses a variant of a config.h file.
  4. $! Depending on the curl version, this could be config.h or curl_config.h.
  5. $!
  6. $! For GNV based builds, the configure script is run and that produces
  7. $! a [curl_]config.h file. Configure scripts on VMS generally do not
  8. $! know how to do everything, so there is also a [-.lib]config-vms.h file
  9. $! that has VMS specific code that compensates for bugs in some of the
  10. $! VMS shared images.
  11. $!
  12. $! This generates a [curl_]config.h file and also a config_vms.h file,
  13. $! which is used to supplement that file. Note that the config_vms.h file
  14. $! and the [.lib]config-vms.h file do two different tasks and that the
  15. $! filenames are slightly different.
  16. $!
  17. $! Copyright (C) John Malmberg
  18. $!
  19. $! Permission to use, copy, modify, and/or distribute this software for any
  20. $! purpose with or without fee is hereby granted, provided that the above
  21. $! copyright notice and this permission notice appear in all copies.
  22. $!
  23. $! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  24. $! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  25. $! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  26. $! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  27. $! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  28. $! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  29. $! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  30. $!
  31. $! SPDX-License-Identifier: ISC
  32. $!
  33. $!=========================================================================
  34. $!
  35. $! Allow arguments to be grouped together with comma or separated by spaces
  36. $! Do no know if we will need more than 8.
  37. $args = "," + p1 + "," + p2 + "," + p3 + "," + p4 + ","
  38. $args = args + p5 + "," + p6 + "," + p7 + "," + p8 + ","
  39. $!
  40. $! Provide lower case version to simplify parsing.
  41. $args_lower = f$edit(args, "LOWERCASE")
  42. $!
  43. $args_len = f$length(args)
  44. $!
  45. $if (f$getsyi("HW_MODEL") .lt. 1024)
  46. $then
  47. $ arch_name = "VAX"
  48. $else
  49. $ arch_name = ""
  50. $ arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
  51. $ if (arch_name .eqs. "") then arch_name = "UNK"
  52. $endif
  53. $!
  54. $!
  55. $nossl = 0
  56. $nohpssl = 1
  57. $hpssl = 0
  58. $libidn = 0
  59. $libssh2 = 0
  60. $noldap = 0
  61. $nozlib = 0
  62. $nokerberos = 0
  63. $!
  64. $! First check to see if SSL is disabled.
  65. $!---------------------------------------
  66. $if f$locate(",nossl,", args_lower) .lt. args_len then nossl = 1
  67. $if .not. nossl
  68. $then
  69. $!
  70. $! ssl$* logicals means HP ssl is present
  71. $!----------------------------------------
  72. $ if f$trnlnm("ssl$root") .nes. ""
  73. $ then
  74. $ nohpssl = 0
  75. $ hpssl = 1
  76. $ endif
  77. $!
  78. $! HP defines OPENSSL as SSL$INCLUDE as a convenience for linking.
  79. $! As it is a violation of VMS standards for this to be provided,
  80. $! some sites may have removed it, but if present, assume that
  81. $! it indicates which OpenSSL to use.
  82. $!------------------------------------
  83. $ openssl_lnm = f$trnlnm("OPENSSL")
  84. $ if (openssl_lnm .nes. "SYS$INCLUDE")
  85. $ then
  86. $! Non HP SSL is installed, default to use it.
  87. $ nohpssl = 1
  88. $ hpssl = 0
  89. $ endif
  90. $!
  91. $! Now check to see if hpssl has been specifically disabled
  92. $!----------------------------------------------------------
  93. $ if f$locate(",nohpssl,", args_lower) .lt. args_len
  94. $ then
  95. $ nohpssl = 1
  96. $ hpssl = 0
  97. $ endif
  98. $!
  99. $! Finally check to see if hp ssl has been specifically included.
  100. $!----------------------------------------------------------------
  101. $ if f$locate(",nohpssl,", args_lower) .lt. args_len
  102. $ then
  103. $ nohpssl = 1
  104. $ hpssl = 0
  105. $ endif
  106. $endif
  107. $!
  108. $! Did someone port LIBIDN in the GNV compatible way?
  109. $!------------------------------------------------------
  110. $if f$trnlnm("GNV$LIBIDNSHR") .nes. ""
  111. $then
  112. $ write sys$output "NOTICE: A LIBIDN port has been detected."
  113. $ write sys$output " This port of curl for VMS has not been tested with it."
  114. $ if f$locate(",libidn,", args_lower) .lt. args_len
  115. $ then
  116. $ libidn = 1
  117. $ endif
  118. $ if .not. libidn
  119. $ then
  120. $ write sys$output " LIBIDN support is not enabled."
  121. $ write sys$output "Run with the ""libidn"" parameter to attempt to use."
  122. $ else
  123. $ write sys$output " Untested LIBIDN support requested."
  124. $ endif
  125. $endif
  126. $!
  127. $! Did someone port LIBSSH2 in the GNV compatible way?
  128. $!------------------------------------------------------
  129. $if f$trnlnm("GNV$LIBSSH2SHR") .nes. ""
  130. $then
  131. $ write sys$output "NOTICE: A LIBSSH2 port has been detected."
  132. $ write sys$output " This port of curl for VMS has not been tested with it."
  133. $ if f$locate(",libssh2,", args_lower) .lt. args_len
  134. $ then
  135. $ libssh2 = 1
  136. $ endif
  137. $ if .not. libssh2
  138. $ then
  139. $ write sys$output " LIBSSH2 support is not enabled."
  140. $ write sys$output "Run with the ""libssh2"" parameter to attempt to use."
  141. $ else
  142. $ write sys$output " Untested LIBSSH2 support requested."
  143. $ endif
  144. $endif
  145. $!
  146. $! LDAP suppressed?
  147. $if f$locate(",noldap,", args_lower) .lt. args_len
  148. $then
  149. $ noldap = 1
  150. $endif
  151. $if f$search("SYS$SHARE:LDAP$SHR.EXE") .eqs. ""
  152. $then
  153. $ noldap = 1
  154. $endif
  155. $!
  156. $if f$locate(",nokerberos,", args_lower) .lt. args_len then nokerberos = 1
  157. $if .not. nokerberos
  158. $then
  159. $! If kerberos is installed: sys$share:gss$rtl.exe exists.
  160. $ if f$search("sys$shsare:gss$rtl.exe") .eqs. ""
  161. $ then
  162. $ nokerberos = 1
  163. $ endif
  164. $endif
  165. $!
  166. $!
  167. $! Is GNV compatible LIBZ present?
  168. $!------------------------------------------------------
  169. $if f$trnlnm("GNV$LIBZSHR") .nes. ""
  170. $then
  171. $ if f$locate(",nozlib,", args_lower) .lt. args_len
  172. $ then
  173. $ nozlib = 1
  174. $ endif
  175. $! if .not. nozlib
  176. $! then
  177. $! write sys$output " GNV$LIBZSHR support is enabled."
  178. $! else
  179. $! write sys$output " GNV$LIBZSHR support is disabled by nozlib."
  180. $! endif
  181. $else
  182. $ nozlib = 1
  183. $endif
  184. $!
  185. $!
  186. $! Start the configuration file.
  187. $! Need to do a create and then an append to make the file have the
  188. $! typical file attributes of a VMS text file.
  189. $create sys$disk:[curl.lib]config_vms.h
  190. $open/append cvh sys$disk:[curl.lib]config_vms.h
  191. $!
  192. $! Write the defines to prevent multiple includes.
  193. $! These are probably not needed in this case,
  194. $! but are best practice to put on all header files.
  195. $write cvh "#ifndef __CONFIG_VMS_H__"
  196. $write cvh "#define __CONFIG_VMS_H__"
  197. $write cvh ""
  198. $write cvh "/* Define cpu-machine-OS */"
  199. $!
  200. $! Curl uses an OS macro to set the build environment.
  201. $!----------------------------------------------------
  202. $! Now the DCL builds usually say xxx-HP-VMS and configure scripts
  203. $! may put DEC or COMPAQ or HP for the middle part.
  204. $!
  205. $write cvh "#if defined(__alpha)"
  206. $write cvh "#define OS ""ALPHA-HP-VMS"""
  207. $write cvh "#elif defined(__vax)"
  208. $write cvh "#define OS ""VAX-HP-VMS"""
  209. $write cvh "#elif defined(__ia64)"
  210. $write cvh "#define OS ""IA64-HP-VMS""
  211. $write cvh "#else"
  212. $write cvh "#define OS ""UNKNOWN-HP-VMS""
  213. $write cvh "#endif"
  214. $write cvh ""
  215. $!
  216. $! We are now setting this on the GNV build, so also do this
  217. $! for compatibility.
  218. $write cvh "/* Location of default ca path */"
  219. $write cvh "#define curl_ca_path ""gnv$curl_ca_path"""
  220. $!
  221. $! NTLM_WB_ENABLED requires fork() but configure does not know this
  222. $! We have to disable this in the configure command line.
  223. $! config_h.com finds that configure defaults to it being enabled so
  224. $! reports it. So we need to turn it off here.
  225. $!
  226. $write cvh "#ifdef NTLM_WB_ENABLED"
  227. $write cvh "#undef NTLM_WB_ENABLED"
  228. $write cvh "#endif"
  229. $!
  230. $! The config_h.com finds a bunch of default disable commands in
  231. $! configure and will incorrectly disable these options. The config_h.com
  232. $! is a generic procedure and it would break more things to try to fix it
  233. $! to special case it for curl. So we will fix it here.
  234. $!
  235. $! We do them all here, even the ones that config_h.com currently gets correct.
  236. $!
  237. $write cvh "#ifdef CURL_DISABLE_COOKIES"
  238. $write cvh "#undef CURL_DISABLE_COOKIES"
  239. $write cvh "#endif"
  240. $write cvh "#ifdef CURL_DISABLE_DICT"
  241. $write cvh "#undef CURL_DISABLE_DICT"
  242. $write cvh "#endif"
  243. $write cvh "#ifdef CURL_DISABLE_FILE"
  244. $write cvh "#undef CURL_DISABLE_FILE"
  245. $write cvh "#endif"
  246. $write cvh "#ifdef CURL_DISABLE_FTP"
  247. $write cvh "#undef CURL_DISABLE_FTP"
  248. $write cvh "#endif"
  249. $write cvh "#ifdef CURL_DISABLE_GOPHER"
  250. $write cvh "#undef CURL_DISABLE_GOPHER"
  251. $write cvh "#endif"
  252. $write cvh "#ifdef CURL_DISABLE_HTTP"
  253. $write cvh "#undef CURL_DISABLE_HTTP"
  254. $write cvh "#endif"
  255. $write cvh "#ifdef CURL_DISABLE_IMAP"
  256. $write cvh "#undef CURL_DISABLE_IMAP"
  257. $write cvh "#endif"
  258. $if .not. noldap
  259. $then
  260. $ write cvh "#ifdef CURL_DISABLE_LDAP"
  261. $ write cvh "#undef CURL_DISABLE_LDAP"
  262. $ write cvh "#endif"
  263. $ if .not. nossl
  264. $ then
  265. $ write cvh "#ifdef CURL_DISABLE_LDAPS"
  266. $ write cvh "#undef CURL_DISABLE_LDAPS"
  267. $ write cvh "#endif"
  268. $ endif
  269. $endif
  270. $write cvh "#ifdef CURL_DISABLE_LIBCURL_OPTION"
  271. $write cvh "#undef CURL_DISABLE_LIBCURL_OPTION"
  272. $write cvh "#endif"
  273. $write cvh "#ifndef __VAX"
  274. $write cvh "#ifdef CURL_DISABLE_NTLM"
  275. $write cvh "#undef CURL_DISABLE_NTLM"
  276. $write cvh "#endif"
  277. $write cvh "#else"
  278. $! NTLM needs long long or int64 support, missing from DECC C.
  279. $write cvh "#ifdef __DECC
  280. $write cvh "#ifndef CURL_DISABLE_NTLM"
  281. $write cvh "#define CURL_DISABLE_NTLM 1"
  282. $write cvh "#endif"
  283. $write cvh "#endif"
  284. $write cvh "#endif"
  285. $write cvh "#ifdef CURL_DISABLE_POP3"
  286. $write cvh "#undef CURL_DISABLE_POP3"
  287. $write cvh "#endif"
  288. $write cvh "#ifdef CURL_DISABLE_PROXY"
  289. $write cvh "#undef CURL_DISABLE_PROXY"
  290. $write cvh "#endif"
  291. $write cvh "#ifdef CURL_DISABLE_RTSP"
  292. $write cvh "#undef CURL_DISABLE_RTSP"
  293. $write cvh "#endif"
  294. $write cvh "#ifdef CURL_DISABLE_SMTP"
  295. $write cvh "#undef CURL_DISABLE_SMTP"
  296. $write cvh "#endif"
  297. $write cvh "#ifdef CURL_DISABLE_TELNET"
  298. $write cvh "#undef CURL_DISABLE_TELNET"
  299. $write cvh "#endif"
  300. $write cvh "#ifdef CURL_DISABLE_TFTP"
  301. $write cvh "#undef CURL_DISABLE_TFTP"
  302. $write cvh "#endif"
  303. $write cvh "#ifdef CURL_DISABLE_POP3"
  304. $write cvh "#undef CURL_DISABLE_POP3"
  305. $write cvh "#endif"
  306. $if .not. nossl
  307. $then
  308. $ write cvh "#ifdef CURL_DISABLE_TLS_SRP"
  309. $ write cvh "#undef CURL_DISABLE_TLS_SRP"
  310. $ write cvh "#endif"
  311. $!
  312. $endif
  313. $write cvh "#ifdef CURL_DISABLE_VERBOSE_STRINGS"
  314. $write cvh "#undef CURL_DISABLE_VERBOSE_STRINGS"
  315. $write cvh "#endif"
  316. $!
  317. $! configure defaults to USE_*, a real configure on VMS chooses different.
  318. $write cvh "#ifdef USE_ARES"
  319. $write cvh "#undef USE_ARES"
  320. $write cvh "#endif"
  321. $write cvh "#ifdef USE_WOLFSSL"
  322. $write cvh "#undef USE_WOLFSSL"
  323. $write cvh "#endif"
  324. $write cvh "#ifdef USE_GNUTLS"
  325. $write cvh "#undef USE_GNUTLS"
  326. $write cvh "#endif"
  327. $write cvh "#ifdef USE_LIBRTMP"
  328. $write cvh "#undef USE_LIBRTMP"
  329. $write cvh "#endif"
  330. $write cvh "#ifdef USE_MANUAL"
  331. $write cvh "#undef USE_MANUAL"
  332. $write cvh "#endif"
  333. $write cvh "#ifdef USE_NGHTTP2"
  334. $write cvh "#undef USE_NGHTTP2"
  335. $write cvh "#endif"
  336. $write cvh "#ifdef USE_OPENLDAP"
  337. $write cvh "#undef USE_OPENLDAP"
  338. $write cvh "#endif"
  339. $write cvh "#ifdef USE_THREADS_POSIX"
  340. $write cvh "#undef USE_THREADS_POSIX"
  341. $write cvh "#endif"
  342. $write cvh "#ifdef USE_TLS_SRP"
  343. $write cvh "#undef USE_TLS_SRP"
  344. $write cvh "#endif"
  345. $write cvh "#ifdef USE_UNIX_SOCKETS"
  346. $write cvh "#undef USE_UNIX_SOCKETS"
  347. $write cvh "#endif"
  348. $!
  349. $write cvh "#ifndef HAVE_OLD_GSSMIT"
  350. $write cvh "#define gss_nt_service_name GSS_C_NT_HOSTBASED_SERVICE"
  351. $write cvh "#endif"
  352. $!
  353. $!
  354. $! Note:
  355. $! The CURL_EXTERN_SYMBOL is used for platforms that need the compiler
  356. $! to know about universal symbols. VMS does not need this support so
  357. $! we do not set it here.
  358. $!
  359. $!
  360. $! I can not figure out where the C compiler is finding the ALLOCA.H file
  361. $! in the text libraries, so CONFIG_H.COM can not find it either.
  362. $! Usually the header file name is the module name in the text library.
  363. $! It does not appear to hurt anything to not find header file, so we
  364. $! are not overriding it here.
  365. $!
  366. $!
  367. $! Check to see if OpenSSL is present.
  368. $!----------------------------------
  369. $ssl_include = f$trnlnm("OPENSSL")
  370. $if ssl_include .eqs. ""
  371. $then
  372. $ ssl_include = f$trnlnm("ssl$include")
  373. $endif
  374. $if ssl_include .eqs. "" then nossl = 1
  375. $!
  376. $if .not. nossl
  377. $then
  378. $!
  379. $ write cvh "#ifndef USE_OPENSSL"
  380. $ write cvh "#define USE_OPENSSL 1"
  381. $ write cvh "#endif"
  382. $ if arch_name .eqs. "VAX"
  383. $ then
  384. $ old_mes = f$environment("message")
  385. $ set message/notext/nofaci/noseve/noident
  386. $ search/output=nla0: ssl$include:*.h CONF_MFLAGS_IGNORE_MISSING_FILE
  387. $ status = $severity
  388. $ set message'old_mes'
  389. $ if status .nes. "1"
  390. $ then
  391. $ write cvh "#define VMS_OLD_SSL 1"
  392. $ endif
  393. $ endif
  394. $endif
  395. $!
  396. $!
  397. $! LibIDN not ported to VMS at this time.
  398. $! This is for international domain name support.
  399. $! Allow explicit experimentation.
  400. $if libidn
  401. $then
  402. $ write cvh "#define HAVE_IDNA_STRERROR 1"
  403. $ write cvh "#define HAVE_IDNA_FREE 1"
  404. $ write cvh "#define HAVE_IDNA_FREE_H 1"
  405. $ write cvh "#define HAVE_LIBIDN 1"
  406. $else
  407. $ write cvh "#ifdef HAVE_LIBIDN"
  408. $ write cvh "#undef HAVE_LIBIDN"
  409. $ write cvh "#endif"
  410. $endif
  411. $!
  412. $!
  413. $! LibSSH2 not ported to VMS at this time.
  414. $! Allow explicit experimentation.
  415. $if libssh2
  416. $then
  417. $ write cvh "#define HAVE_LIBSSH2_EXIT 1"
  418. $ write cvh "#define HAVE_LIBSSH2_INIT 1"
  419. $ write cvh "#define HAVE_LIBSSH2_SCP_SEND64 1"
  420. $ write cvh "#define HAVE_LIBSSH2_SESSION_HANDSHAKE 1"
  421. $ write cvh "#define HAVE_LIBSSH2_VERSION 1
  422. $!
  423. $ write cvh "#ifndef USE_LIBSSH2"
  424. $ write cvh "#define USE_LIBSSH2 1"
  425. $ write cvh "#endif"
  426. $else
  427. $ write cvh "#ifdef USE_LIBSSH2"
  428. $ write cvh "#undef USE_LIBSSH2"
  429. $ write cvh "#endif"
  430. $endif
  431. $!
  432. $!
  433. $!
  434. $if .not. nozlib
  435. $then
  436. $ write cvh "#define HAVE_LIBZ 1"
  437. $endif
  438. $!
  439. $!
  440. $! Suppress a message in curl_gssapi.c compile.
  441. $write cvh "#pragma message disable notconstqual"
  442. $!
  443. $! Close out the file
  444. $!
  445. $write cvh ""
  446. $write cvh "#endif /* __CONFIG_VMS_H__ */"
  447. $close cvh
  448. $!
  449. $all_exit:
  450. $exit