generate_config_vms_h_curl.com 13 KB

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