generate_config_vms_h_curl.com 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  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 CURL_OS ""ALPHA-HP-VMS"""
  207. $write cvh "#elif defined(__vax)"
  208. $write cvh "#define CURL_OS ""VAX-HP-VMS"""
  209. $write cvh "#elif defined(__ia64)"
  210. $write cvh "#define CURL_OS ""IA64-HP-VMS""
  211. $write cvh "#else"
  212. $write cvh "#define CURL_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. $! The config_h.com finds a bunch of default disable commands in
  222. $! configure and will incorrectly disable these options. The config_h.com
  223. $! is a generic procedure and it would break more things to try to fix it
  224. $! to special case it for curl. So we will fix it here.
  225. $!
  226. $! We do them all here, even the ones that config_h.com currently gets correct.
  227. $!
  228. $write cvh "#ifdef CURL_DISABLE_COOKIES"
  229. $write cvh "#undef CURL_DISABLE_COOKIES"
  230. $write cvh "#endif"
  231. $write cvh "#ifdef CURL_DISABLE_DICT"
  232. $write cvh "#undef CURL_DISABLE_DICT"
  233. $write cvh "#endif"
  234. $write cvh "#ifdef CURL_DISABLE_FILE"
  235. $write cvh "#undef CURL_DISABLE_FILE"
  236. $write cvh "#endif"
  237. $write cvh "#ifdef CURL_DISABLE_FTP"
  238. $write cvh "#undef CURL_DISABLE_FTP"
  239. $write cvh "#endif"
  240. $write cvh "#ifdef CURL_DISABLE_GOPHER"
  241. $write cvh "#undef CURL_DISABLE_GOPHER"
  242. $write cvh "#endif"
  243. $write cvh "#ifdef CURL_DISABLE_HTTP"
  244. $write cvh "#undef CURL_DISABLE_HTTP"
  245. $write cvh "#endif"
  246. $write cvh "#ifdef CURL_DISABLE_IMAP"
  247. $write cvh "#undef CURL_DISABLE_IMAP"
  248. $write cvh "#endif"
  249. $if .not. noldap
  250. $then
  251. $ write cvh "#ifdef CURL_DISABLE_LDAP"
  252. $ write cvh "#undef CURL_DISABLE_LDAP"
  253. $ write cvh "#endif"
  254. $ if .not. nossl
  255. $ then
  256. $ write cvh "#ifdef CURL_DISABLE_LDAPS"
  257. $ write cvh "#undef CURL_DISABLE_LDAPS"
  258. $ write cvh "#endif"
  259. $ endif
  260. $endif
  261. $write cvh "#ifdef CURL_DISABLE_LIBCURL_OPTION"
  262. $write cvh "#undef CURL_DISABLE_LIBCURL_OPTION"
  263. $write cvh "#endif"
  264. $write cvh "#ifndef __VAX"
  265. $write cvh "#ifdef CURL_DISABLE_NTLM"
  266. $write cvh "#undef CURL_DISABLE_NTLM"
  267. $write cvh "#endif"
  268. $write cvh "#else"
  269. $! NTLM needs long long or int64 support, missing from DECC C.
  270. $write cvh "#ifdef __DECC
  271. $write cvh "#ifndef CURL_DISABLE_NTLM"
  272. $write cvh "#define CURL_DISABLE_NTLM 1"
  273. $write cvh "#endif"
  274. $write cvh "#endif"
  275. $write cvh "#endif"
  276. $write cvh "#ifdef CURL_DISABLE_POP3"
  277. $write cvh "#undef CURL_DISABLE_POP3"
  278. $write cvh "#endif"
  279. $write cvh "#ifdef CURL_DISABLE_PROXY"
  280. $write cvh "#undef CURL_DISABLE_PROXY"
  281. $write cvh "#endif"
  282. $write cvh "#ifdef CURL_DISABLE_RTSP"
  283. $write cvh "#undef CURL_DISABLE_RTSP"
  284. $write cvh "#endif"
  285. $write cvh "#ifdef CURL_DISABLE_SMTP"
  286. $write cvh "#undef CURL_DISABLE_SMTP"
  287. $write cvh "#endif"
  288. $write cvh "#ifdef CURL_DISABLE_TELNET"
  289. $write cvh "#undef CURL_DISABLE_TELNET"
  290. $write cvh "#endif"
  291. $write cvh "#ifdef CURL_DISABLE_TFTP"
  292. $write cvh "#undef CURL_DISABLE_TFTP"
  293. $write cvh "#endif"
  294. $write cvh "#ifdef CURL_DISABLE_POP3"
  295. $write cvh "#undef CURL_DISABLE_POP3"
  296. $write cvh "#endif"
  297. $if .not. nossl
  298. $then
  299. $ write cvh "#ifdef CURL_DISABLE_TLS_SRP"
  300. $ write cvh "#undef CURL_DISABLE_TLS_SRP"
  301. $ write cvh "#endif"
  302. $!
  303. $endif
  304. $write cvh "#ifdef CURL_DISABLE_VERBOSE_STRINGS"
  305. $write cvh "#undef CURL_DISABLE_VERBOSE_STRINGS"
  306. $write cvh "#endif"
  307. $!
  308. $! configure defaults to USE_*, a real configure on VMS chooses different.
  309. $write cvh "#ifdef USE_ARES"
  310. $write cvh "#undef USE_ARES"
  311. $write cvh "#endif"
  312. $write cvh "#ifdef USE_WOLFSSL"
  313. $write cvh "#undef USE_WOLFSSL"
  314. $write cvh "#endif"
  315. $write cvh "#ifdef USE_GNUTLS"
  316. $write cvh "#undef USE_GNUTLS"
  317. $write cvh "#endif"
  318. $write cvh "#ifdef USE_LIBRTMP"
  319. $write cvh "#undef USE_LIBRTMP"
  320. $write cvh "#endif"
  321. $write cvh "#ifdef USE_MANUAL"
  322. $write cvh "#undef USE_MANUAL"
  323. $write cvh "#endif"
  324. $write cvh "#ifdef USE_NGHTTP2"
  325. $write cvh "#undef USE_NGHTTP2"
  326. $write cvh "#endif"
  327. $write cvh "#ifdef USE_OPENLDAP"
  328. $write cvh "#undef USE_OPENLDAP"
  329. $write cvh "#endif"
  330. $write cvh "#ifdef USE_THREADS_POSIX"
  331. $write cvh "#undef USE_THREADS_POSIX"
  332. $write cvh "#endif"
  333. $write cvh "#ifdef USE_TLS_SRP"
  334. $write cvh "#undef USE_TLS_SRP"
  335. $write cvh "#endif"
  336. $write cvh "#ifdef USE_UNIX_SOCKETS"
  337. $write cvh "#undef USE_UNIX_SOCKETS"
  338. $write cvh "#endif"
  339. $!
  340. $write cvh "#ifndef HAVE_OLD_GSSMIT"
  341. $write cvh "#define gss_nt_service_name GSS_C_NT_HOSTBASED_SERVICE"
  342. $write cvh "#endif"
  343. $!
  344. $!
  345. $! Note:
  346. $! The CURL_EXTERN_SYMBOL is used for platforms that need the compiler
  347. $! to know about universal symbols. VMS does not need this support so
  348. $! we do not set it here.
  349. $!
  350. $!
  351. $! I can not figure out where the C compiler is finding the ALLOCA.H file
  352. $! in the text libraries, so CONFIG_H.COM can not find it either.
  353. $! Usually the header file name is the module name in the text library.
  354. $! It does not appear to hurt anything to not find header file, so we
  355. $! are not overriding it here.
  356. $!
  357. $!
  358. $! Check to see if OpenSSL is present.
  359. $!----------------------------------
  360. $ssl_include = f$trnlnm("OPENSSL")
  361. $if ssl_include .eqs. ""
  362. $then
  363. $ ssl_include = f$trnlnm("ssl$include")
  364. $endif
  365. $if ssl_include .eqs. "" then nossl = 1
  366. $!
  367. $if .not. nossl
  368. $then
  369. $!
  370. $ write cvh "#ifndef USE_OPENSSL"
  371. $ write cvh "#define USE_OPENSSL 1"
  372. $ write cvh "#endif"
  373. $ if arch_name .eqs. "VAX"
  374. $ then
  375. $ old_mes = f$environment("message")
  376. $ set message/notext/nofaci/noseve/noident
  377. $ search/output=nla0: ssl$include:*.h CONF_MFLAGS_IGNORE_MISSING_FILE
  378. $ status = $severity
  379. $ set message'old_mes'
  380. $ if status .nes. "1"
  381. $ then
  382. $ write cvh "#define VMS_OLD_SSL 1"
  383. $ endif
  384. $ endif
  385. $endif
  386. $!
  387. $!
  388. $! libidn not ported to VMS at this time.
  389. $! This is for international domain name support.
  390. $! Allow explicit experimentation.
  391. $if libidn
  392. $then
  393. $ write cvh "#define HAVE_IDNA_STRERROR 1"
  394. $ write cvh "#define HAVE_IDNA_FREE 1"
  395. $ write cvh "#define HAVE_IDNA_FREE_H 1"
  396. $ write cvh "#define HAVE_LIBIDN 1"
  397. $else
  398. $ write cvh "#ifdef HAVE_LIBIDN"
  399. $ write cvh "#undef HAVE_LIBIDN"
  400. $ write cvh "#endif"
  401. $endif
  402. $!
  403. $!
  404. $! libssh2 not ported to VMS at this time.
  405. $! Allow explicit experimentation.
  406. $if libssh2
  407. $then
  408. $ write cvh "#define HAVE_LIBSSH2_EXIT 1"
  409. $ write cvh "#define HAVE_LIBSSH2_INIT 1"
  410. $ write cvh "#define HAVE_LIBSSH2_SCP_SEND64 1"
  411. $ write cvh "#define HAVE_LIBSSH2_SESSION_HANDSHAKE 1"
  412. $ write cvh "#define HAVE_LIBSSH2_VERSION 1
  413. $!
  414. $ write cvh "#ifndef USE_LIBSSH2"
  415. $ write cvh "#define USE_LIBSSH2 1"
  416. $ write cvh "#endif"
  417. $else
  418. $ write cvh "#ifdef USE_LIBSSH2"
  419. $ write cvh "#undef USE_LIBSSH2"
  420. $ write cvh "#endif"
  421. $endif
  422. $!
  423. $!
  424. $!
  425. $if .not. nozlib
  426. $then
  427. $ write cvh "#define HAVE_LIBZ 1"
  428. $endif
  429. $!
  430. $!
  431. $! Suppress a message in curl_gssapi.c compile.
  432. $write cvh "#pragma message disable notconstqual"
  433. $!
  434. $! Close out the file
  435. $!
  436. $write cvh ""
  437. $write cvh "#endif /* __CONFIG_VMS_H__ */"
  438. $close cvh
  439. $!
  440. $all_exit:
  441. $exit