2
0

build_curl-config_script.com 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. $! build_curl-config_script.com
  2. $!
  3. $! This generates the curl-config. script from the curl-config.in file.
  4. $!
  5. $! Copyright 2014 - 2022, John Malmberg
  6. $!
  7. $! Permission to use, copy, modify, and/or distribute this software for any
  8. $! purpose with or without fee is hereby granted, provided that the above
  9. $! copyright notice and this permission notice appear in all copies.
  10. $!
  11. $! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  12. $! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  13. $! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  14. $! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  15. $! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  16. $! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  17. $! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  18. $!
  19. $! SPDX-License-Identifier: ISC
  20. $!
  21. $! 16-Dec-2014 J. Malmberg
  22. $!
  23. $!===========================================================================
  24. $!
  25. $! Skip this if the curl-config. already exists.
  26. $ if f$search("[--]curl-config.") .nes. "" then goto all_exit
  27. $!
  28. $ if (f$getsyi("HW_MODEL") .lt. 1024)
  29. $ then
  30. $ arch_name = "VAX"
  31. $ else
  32. $ arch_name = ""
  33. $ arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
  34. $ if (arch_name .eqs. "") then arch_name = "UNK"
  35. $ endif
  36. $!
  37. $ x_prefix = "/usr"
  38. $ x_exec_prefix = "/usr"
  39. $ x_includedir = "${prefix}/include"
  40. $ x_cppflag_curl_staticlib = "-DCURL_STATICLIB"
  41. $ x_enabled_shared = "no"
  42. $ x_curl_ca_bundle = ""
  43. $ x_cc = "cc"
  44. $ x_support_features = "SSL IPv6 libz NTLM"
  45. $ x_support_protocols1 = "DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP"
  46. $ x_support_protocols2 = " LDAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP"
  47. $ x_support_protocols = x_support_protocols1 + x_support_protocols2
  48. $ x_curlversion = "0.0.0.0"
  49. $ x_versionnum = ""
  50. $ x_libdir = "${prefix}/lib"
  51. $ x_require_lib_deps = ""
  52. $ x_enable_static = ""
  53. $ x_ldflags = ""
  54. $ part1 = "-L/usr/lib -L/SSL_LIB -lssl -lcrypto -lz"
  55. $ if arch_name .eqs. "VAX"
  56. $ then
  57. $ x_libcurl_libs = part1
  58. $ else
  59. $ x_libcurl_libs = part1 + " -lgssapi"
  60. $ endif
  61. $ x_libext = "a"
  62. $!
  63. $! Get the version number
  64. $!-----------------------
  65. $ i = 0
  66. $ open/read/error=version_loop_end vhf [--.include.curl]curlver.h
  67. $ version_loop:
  68. $ read/end=version_loop_end vhf line_in
  69. $ if line_in .eqs. "" then goto version_loop
  70. $ if f$locate("#define LIBCURL_VERSION ", line_in) .eq. 0
  71. $ then
  72. $ x_curlversion = f$element(2," ", line_in) - """" - """"
  73. $ i = i + 1
  74. $ endif
  75. $ if f$locate("#define LIBCURL_VERSION_NUM ", line_in) .eq. 0
  76. $ then
  77. $ x_versionnum = f$element(2," ", line_in) - """" - """"
  78. $ i = i + 1
  79. $ endif
  80. $ if i .lt 2 then goto version_loop
  81. $ version_loop_end:
  82. $ close vhf
  83. $!
  84. $ kit_type = "V"
  85. $ if f$locate("-", x_curlversion) .lt. f$length(x_curlversion)
  86. $ then
  87. $ kit_type = "D"
  88. $ x_prefix = "/beta"
  89. $ x_exec_prefix = "/beta"
  90. $ endif
  91. $!
  92. $ if kit_type .nes. "D"
  93. $ then
  94. $ part1 = " echo "" '--prefix=/usr' '--exec-prefix=/usr' "
  95. $ else
  96. $ part1 = " echo "" '--prefix=/beta' '--exec_prefix=/beta' "
  97. $ endif
  98. $ if arch_name .eqs. "VAX"
  99. $ then
  100. $ part3 = ""
  101. $ else
  102. $ part3 = "'--with-gssapi' "
  103. $ endif
  104. $ part2 = "'--disable-dependency-tracking' '--disable-libtool-lock' "
  105. $ part4 = "'--disable-ntlm-wb' '--with-ca-path=gnv$curl_ca_path'"""
  106. $!
  107. $ x_configure_options = part1 + part2 + part3 + part4
  108. $!
  109. $!
  110. $ open/read/error=read_loop_end c_c_in sys$disk:[--]curl-config.in
  111. $ create sys$disk:[--]curl-config.
  112. $ open/append c_c_out sys$disk:[--]curl-config.
  113. $read_loop:
  114. $ read/end=read_loop_end c_c_in line_in
  115. $ line_in_len = f$length(line_in)
  116. $ if f$locate("@", line_in) .ge. line_in_len
  117. $ then
  118. $ write c_c_out line_in
  119. $ goto read_loop
  120. $ endif
  121. $ i = 0
  122. $ line_out = ""
  123. $sub_loop:
  124. $ ! Replace between pairs of @ by alternating the elements.
  125. $ ! If mis-matched pairs, do not substitute anything.
  126. $ section1 = f$element(i, "@", line_in)
  127. $ if section1 .eqs. "@"
  128. $ then
  129. $ goto sub_loop_end
  130. $ endif
  131. $ i = i + 1
  132. $ section2 = f$element(i, "@", line_in)
  133. $ if section2 .eqs. "@"
  134. $ then
  135. $ goto sub_loop_end
  136. $ endif
  137. $ i = i + 1
  138. $ section3 = f$element(i, "@", line_in)
  139. $ if section3 .eqs. "@"
  140. $ then
  141. $ if line_out .eqs. "" then line_out = line_in
  142. $ goto sub_loop_end
  143. $ endif
  144. $ line_out = line_out + section1
  145. $ if f$type(x_'section2') .eqs. "STRING"
  146. $ then
  147. $ line_out = line_out + x_'section2'
  148. $ endif
  149. $ goto sub_loop
  150. $sub_loop_end:
  151. $ write c_c_out line_out
  152. $ goto read_loop
  153. $read_loop_end:
  154. $ close c_c_in
  155. $ close c_c_out