• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1$! build_curl-config_script.com
2$!
3$! This generates the curl-config. script from the curl-config.in file.
4$!
5$! Copyright (C) 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$!===========================================================================
22$!
23$! Skip this if the curl-config. already exists.
24$ if f$search("[--]curl-config.") .nes. "" then goto all_exit
25$!
26$ if (f$getsyi("HW_MODEL") .lt. 1024)
27$ then
28$    arch_name = "VAX"
29$ else
30$    arch_name = ""
31$    arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
32$    if (arch_name .eqs. "") then arch_name = "UNK"
33$ endif
34$!
35$ x_prefix = "/usr"
36$ x_exec_prefix = "/usr"
37$ x_includedir = "${prefix}/include"
38$ x_cppflag_curl_staticlib = "-DCURL_STATICLIB"
39$ x_enabled_shared = "no"
40$ x_curl_ca_bundle = ""
41$ x_cc = "cc"
42$ x_support_features = "SSL IPv6 libz NTLM"
43$ x_support_protocols1 = "DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP"
44$ x_support_protocols2 = " LDAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP"
45$ x_support_protocols = x_support_protocols1 + x_support_protocols2
46$ x_curlversion = "0.0.0.0"
47$ x_versionnum = ""
48$ x_libdir = "${prefix}/lib"
49$ x_require_lib_deps = ""
50$ x_enable_static = ""
51$ x_ldflags = ""
52$ part1 = "-L/usr/lib -L/SSL_LIB -lssl -lcrypto -lz"
53$ if arch_name .eqs. "VAX"
54$ then
55$   x_libcurl_libs = part1
56$ else
57$   x_libcurl_libs = part1 + " -lgssapi"
58$ endif
59$ x_libext = "a"
60$!
61$! Get the version number
62$!-----------------------
63$ i = 0
64$ open/read/error=version_loop_end vhf [--.include.curl]curlver.h
65$ version_loop:
66$   read/end=version_loop_end vhf line_in
67$   if line_in .eqs. "" then goto version_loop
68$   if f$locate("#define LIBCURL_VERSION ", line_in) .eq. 0
69$   then
70$       x_curlversion = f$element(2," ", line_in) - """" - """"
71$       i = i + 1
72$   endif
73$   if f$locate("#define LIBCURL_VERSION_NUM ", line_in) .eq. 0
74$   then
75$       x_versionnum = f$element(2," ", line_in) - """" - """"
76$       i = i + 1
77$   endif
78$   if i .lt 2 then goto version_loop
79$ version_loop_end:
80$ close vhf
81$!
82$ kit_type = "V"
83$ if f$locate("-", x_curlversion) .lt. f$length(x_curlversion)
84$ then
85$   kit_type = "D"
86$   x_prefix = "/beta"
87$   x_exec_prefix = "/beta"
88$ endif
89$!
90$ if kit_type .nes. "D"
91$ then
92$    part1 = "        echo "" '--prefix=/usr' '--exec-prefix=/usr' "
93$ else
94$    part1 = "        echo "" '--prefix=/beta' '--exec_prefix=/beta' "
95$ endif
96$ if arch_name .eqs. "VAX"
97$ then
98$    part3 = ""
99$ else
100$    part3 = "'--with-gssapi' "
101$ endif
102$ part2 = "'--disable-dependency-tracking' '--disable-libtool-lock' "
103$ part4 = "'--disable-ntlm-wb' '--with-ca-path=gnv$curl_ca_path'"""
104$!
105$ x_configure_options = part1 + part2 + part3 + part4
106$!
107$!
108$ open/read/error=read_loop_end c_c_in sys$disk:[--]curl-config.in
109$ create sys$disk:[--]curl-config.
110$ open/append c_c_out sys$disk:[--]curl-config.
111$read_loop:
112$   read/end=read_loop_end c_c_in line_in
113$   line_in_len = f$length(line_in)
114$   if f$locate("@", line_in) .ge. line_in_len
115$   then
116$       write c_c_out line_in
117$       goto read_loop
118$   endif
119$   i = 0
120$   line_out = ""
121$sub_loop:
122$       ! Replace between pairs of @ by alternating the elements.
123$       ! If mis-matched pairs, do not substitute anything.
124$       section1 = f$element(i, "@", line_in)
125$       if section1 .eqs. "@"
126$       then
127$           goto sub_loop_end
128$       endif
129$       i = i + 1
130$       section2 = f$element(i, "@", line_in)
131$       if section2 .eqs. "@"
132$       then
133$           goto sub_loop_end
134$       endif
135$       i = i + 1
136$       section3 = f$element(i, "@", line_in)
137$       if section3 .eqs. "@"
138$       then
139$           if line_out .eqs. "" then line_out = line_in
140$           goto sub_loop_end
141$       endif
142$       line_out = line_out + section1
143$       if f$type(x_'section2') .eqs. "STRING"
144$       then
145$           line_out = line_out + x_'section2'
146$       endif
147$       goto sub_loop
148$sub_loop_end:
149$   write c_c_out line_out
150$   goto read_loop
151$read_loop_end:
152$ close c_c_in
153$ close c_c_out
154