generate_config_vms_h_curl.com 14 KB

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