113498266Sopenharmony_ci$! build_curl-config_script.com
213498266Sopenharmony_ci$!
313498266Sopenharmony_ci$! This generates the curl-config. script from the curl-config.in file.
413498266Sopenharmony_ci$!
513498266Sopenharmony_ci$! Copyright (C) John Malmberg
613498266Sopenharmony_ci$!
713498266Sopenharmony_ci$! Permission to use, copy, modify, and/or distribute this software for any
813498266Sopenharmony_ci$! purpose with or without fee is hereby granted, provided that the above
913498266Sopenharmony_ci$! copyright notice and this permission notice appear in all copies.
1013498266Sopenharmony_ci$!
1113498266Sopenharmony_ci$! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1213498266Sopenharmony_ci$! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1313498266Sopenharmony_ci$! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1413498266Sopenharmony_ci$! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1513498266Sopenharmony_ci$! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1613498266Sopenharmony_ci$! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
1713498266Sopenharmony_ci$! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1813498266Sopenharmony_ci$!
1913498266Sopenharmony_ci$! SPDX-License-Identifier: ISC
2013498266Sopenharmony_ci$!
2113498266Sopenharmony_ci$!===========================================================================
2213498266Sopenharmony_ci$!
2313498266Sopenharmony_ci$! Skip this if the curl-config. already exists.
2413498266Sopenharmony_ci$ if f$search("[--]curl-config.") .nes. "" then goto all_exit
2513498266Sopenharmony_ci$!
2613498266Sopenharmony_ci$ if (f$getsyi("HW_MODEL") .lt. 1024)
2713498266Sopenharmony_ci$ then
2813498266Sopenharmony_ci$    arch_name = "VAX"
2913498266Sopenharmony_ci$ else
3013498266Sopenharmony_ci$    arch_name = ""
3113498266Sopenharmony_ci$    arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
3213498266Sopenharmony_ci$    if (arch_name .eqs. "") then arch_name = "UNK"
3313498266Sopenharmony_ci$ endif
3413498266Sopenharmony_ci$!
3513498266Sopenharmony_ci$ x_prefix = "/usr"
3613498266Sopenharmony_ci$ x_exec_prefix = "/usr"
3713498266Sopenharmony_ci$ x_includedir = "${prefix}/include"
3813498266Sopenharmony_ci$ x_cppflag_curl_staticlib = "-DCURL_STATICLIB"
3913498266Sopenharmony_ci$ x_enabled_shared = "no"
4013498266Sopenharmony_ci$ x_curl_ca_bundle = ""
4113498266Sopenharmony_ci$ x_cc = "cc"
4213498266Sopenharmony_ci$ x_support_features = "SSL IPv6 libz NTLM"
4313498266Sopenharmony_ci$ x_support_protocols1 = "DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP"
4413498266Sopenharmony_ci$ x_support_protocols2 = " LDAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP"
4513498266Sopenharmony_ci$ x_support_protocols = x_support_protocols1 + x_support_protocols2
4613498266Sopenharmony_ci$ x_curlversion = "0.0.0.0"
4713498266Sopenharmony_ci$ x_versionnum = ""
4813498266Sopenharmony_ci$ x_libdir = "${prefix}/lib"
4913498266Sopenharmony_ci$ x_require_lib_deps = ""
5013498266Sopenharmony_ci$ x_enable_static = ""
5113498266Sopenharmony_ci$ x_ldflags = ""
5213498266Sopenharmony_ci$ part1 = "-L/usr/lib -L/SSL_LIB -lssl -lcrypto -lz"
5313498266Sopenharmony_ci$ if arch_name .eqs. "VAX"
5413498266Sopenharmony_ci$ then
5513498266Sopenharmony_ci$   x_libcurl_libs = part1
5613498266Sopenharmony_ci$ else
5713498266Sopenharmony_ci$   x_libcurl_libs = part1 + " -lgssapi"
5813498266Sopenharmony_ci$ endif
5913498266Sopenharmony_ci$ x_libext = "a"
6013498266Sopenharmony_ci$!
6113498266Sopenharmony_ci$! Get the version number
6213498266Sopenharmony_ci$!-----------------------
6313498266Sopenharmony_ci$ i = 0
6413498266Sopenharmony_ci$ open/read/error=version_loop_end vhf [--.include.curl]curlver.h
6513498266Sopenharmony_ci$ version_loop:
6613498266Sopenharmony_ci$   read/end=version_loop_end vhf line_in
6713498266Sopenharmony_ci$   if line_in .eqs. "" then goto version_loop
6813498266Sopenharmony_ci$   if f$locate("#define LIBCURL_VERSION ", line_in) .eq. 0
6913498266Sopenharmony_ci$   then
7013498266Sopenharmony_ci$       x_curlversion = f$element(2," ", line_in) - """" - """"
7113498266Sopenharmony_ci$       i = i + 1
7213498266Sopenharmony_ci$   endif
7313498266Sopenharmony_ci$   if f$locate("#define LIBCURL_VERSION_NUM ", line_in) .eq. 0
7413498266Sopenharmony_ci$   then
7513498266Sopenharmony_ci$       x_versionnum = f$element(2," ", line_in) - """" - """"
7613498266Sopenharmony_ci$       i = i + 1
7713498266Sopenharmony_ci$   endif
7813498266Sopenharmony_ci$   if i .lt 2 then goto version_loop
7913498266Sopenharmony_ci$ version_loop_end:
8013498266Sopenharmony_ci$ close vhf
8113498266Sopenharmony_ci$!
8213498266Sopenharmony_ci$ kit_type = "V"
8313498266Sopenharmony_ci$ if f$locate("-", x_curlversion) .lt. f$length(x_curlversion)
8413498266Sopenharmony_ci$ then
8513498266Sopenharmony_ci$   kit_type = "D"
8613498266Sopenharmony_ci$   x_prefix = "/beta"
8713498266Sopenharmony_ci$   x_exec_prefix = "/beta"
8813498266Sopenharmony_ci$ endif
8913498266Sopenharmony_ci$!
9013498266Sopenharmony_ci$ if kit_type .nes. "D"
9113498266Sopenharmony_ci$ then
9213498266Sopenharmony_ci$    part1 = "        echo "" '--prefix=/usr' '--exec-prefix=/usr' "
9313498266Sopenharmony_ci$ else
9413498266Sopenharmony_ci$    part1 = "        echo "" '--prefix=/beta' '--exec_prefix=/beta' "
9513498266Sopenharmony_ci$ endif
9613498266Sopenharmony_ci$ if arch_name .eqs. "VAX"
9713498266Sopenharmony_ci$ then
9813498266Sopenharmony_ci$    part3 = ""
9913498266Sopenharmony_ci$ else
10013498266Sopenharmony_ci$    part3 = "'--with-gssapi' "
10113498266Sopenharmony_ci$ endif
10213498266Sopenharmony_ci$ part2 = "'--disable-dependency-tracking' '--disable-libtool-lock' "
10313498266Sopenharmony_ci$ part4 = "'--disable-ntlm-wb' '--with-ca-path=gnv$curl_ca_path'"""
10413498266Sopenharmony_ci$!
10513498266Sopenharmony_ci$ x_configure_options = part1 + part2 + part3 + part4
10613498266Sopenharmony_ci$!
10713498266Sopenharmony_ci$!
10813498266Sopenharmony_ci$ open/read/error=read_loop_end c_c_in sys$disk:[--]curl-config.in
10913498266Sopenharmony_ci$ create sys$disk:[--]curl-config.
11013498266Sopenharmony_ci$ open/append c_c_out sys$disk:[--]curl-config.
11113498266Sopenharmony_ci$read_loop:
11213498266Sopenharmony_ci$   read/end=read_loop_end c_c_in line_in
11313498266Sopenharmony_ci$   line_in_len = f$length(line_in)
11413498266Sopenharmony_ci$   if f$locate("@", line_in) .ge. line_in_len
11513498266Sopenharmony_ci$   then
11613498266Sopenharmony_ci$       write c_c_out line_in
11713498266Sopenharmony_ci$       goto read_loop
11813498266Sopenharmony_ci$   endif
11913498266Sopenharmony_ci$   i = 0
12013498266Sopenharmony_ci$   line_out = ""
12113498266Sopenharmony_ci$sub_loop:
12213498266Sopenharmony_ci$       ! Replace between pairs of @ by alternating the elements.
12313498266Sopenharmony_ci$       ! If mis-matched pairs, do not substitute anything.
12413498266Sopenharmony_ci$       section1 = f$element(i, "@", line_in)
12513498266Sopenharmony_ci$       if section1 .eqs. "@"
12613498266Sopenharmony_ci$       then
12713498266Sopenharmony_ci$           goto sub_loop_end
12813498266Sopenharmony_ci$       endif
12913498266Sopenharmony_ci$       i = i + 1
13013498266Sopenharmony_ci$       section2 = f$element(i, "@", line_in)
13113498266Sopenharmony_ci$       if section2 .eqs. "@"
13213498266Sopenharmony_ci$       then
13313498266Sopenharmony_ci$           goto sub_loop_end
13413498266Sopenharmony_ci$       endif
13513498266Sopenharmony_ci$       i = i + 1
13613498266Sopenharmony_ci$       section3 = f$element(i, "@", line_in)
13713498266Sopenharmony_ci$       if section3 .eqs. "@"
13813498266Sopenharmony_ci$       then
13913498266Sopenharmony_ci$           if line_out .eqs. "" then line_out = line_in
14013498266Sopenharmony_ci$           goto sub_loop_end
14113498266Sopenharmony_ci$       endif
14213498266Sopenharmony_ci$       line_out = line_out + section1
14313498266Sopenharmony_ci$       if f$type(x_'section2') .eqs. "STRING"
14413498266Sopenharmony_ci$       then
14513498266Sopenharmony_ci$           line_out = line_out + x_'section2'
14613498266Sopenharmony_ci$       endif
14713498266Sopenharmony_ci$       goto sub_loop
14813498266Sopenharmony_ci$sub_loop_end:
14913498266Sopenharmony_ci$   write c_c_out line_out
15013498266Sopenharmony_ci$   goto read_loop
15113498266Sopenharmony_ci$read_loop_end:
15213498266Sopenharmony_ci$ close c_c_in
15313498266Sopenharmony_ci$ close c_c_out
154