2
0

generate_config_vms_h_curl.com 14 KB

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