1 $! build_curl-config_script.com
3 $! This generates the curl-config. script from the curl-config.in file.
5 $! Copyright 2014, John Malmberg
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.
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.
20 $! 16-Dec-2014 J. Malmberg
22 $!===========================================================================
24 $! Skip this if the curl-config. already exists.
25 $ if f$search("[--]curl-config.") .nes. "" then goto all_exit
27 $ if (f$getsyi("HW_MODEL") .lt. 1024)
32 $ arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
33 $ if (arch_name .eqs. "") then arch_name = "UNK"
37 $ x_exec_prefix = "/usr"
38 $ x_includedir = "${prefix}/include"
39 $ x_cppflag_curl_staticlib = "-DCURL_STATICLIB"
40 $ x_enabled_shared = "no"
41 $ x_curl_ca_bundle = ""
43 $ x_support_features = "SSL IPv6 libz NTLM"
44 $ x_support_protocols1 = "DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP"
45 $ x_support_protocols2 = " LDAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP"
46 $ x_support_protocols = x_support_protocols1 + x_support_protocols2
47 $ x_curlversion = "0.0.0.0"
49 $ x_libdir = "${prefix}/lib"
50 $ x_require_lib_deps = ""
51 $ x_enable_static = ""
53 $ part1 = "-L/usr/lib -L/SSL_LIB -lssl -lcrypto -lz"
54 $ if arch_name .eqs. "VAX"
56 $ x_libcurl_libs = part1
58 $ x_libcurl_libs = part1 + " -lgssapi"
62 $! Get the version number
63 $!-----------------------
65 $ open/read/error=version_loop_end vhf [--.include.curl]curlver.h
67 $ read/end=version_loop_end vhf line_in
68 $ if line_in .eqs. "" then goto version_loop
69 $ if f$locate("#define LIBCURL_VERSION ", line_in) .eq. 0
71 $ x_curlversion = f$element(2," ", line_in) - """" - """"
74 $ if f$locate("#define LIBCURL_VERSION_NUM ", line_in) .eq. 0
76 $ x_versionnum = f$element(2," ", line_in) - """" - """"
79 $ if i .lt 2 then goto version_loop
84 $ if f$locate("-", x_curlversion) .lt. f$length(x_curlversion)
88 $ x_exec_prefix = "/beta"
91 $ if kit_type .nes. "D"
93 $ part1 = " echo "" '--prefix=/usr' '--exec-prefix=/usr' "
95 $ part1 = " echo "" '--prefix=/beta' '--exec_prefix=/beta' "
97 $ if arch_name .eqs. "VAX"
101 $ part3 = "'--with-gssapi' "
103 $ part2 = "'--disable-dependency-tracking' '--disable-libtool-lock' "
104 $ part4 = "'--disable-ntlm-wb' '--with-ca-path=gnv$curl_ca_path'"""
106 $ x_configure_options = part1 + part2 + part3 + part4
109 $ open/read/error=read_loop_end c_c_in sys$disk:[--]curl-config.in
110 $ create sys$disk:[--]curl-config.
111 $ open/append c_c_out sys$disk:[--]curl-config.
113 $ read/end=read_loop_end c_c_in line_in
114 $ line_in_len = f$length(line_in)
115 $ if f$locate("@", line_in) .ge. line_in_len
117 $ write c_c_out line_in
123 $ ! Replace between pairs of @ by alternating the elements.
124 $ ! If mis-matched pairs, do not substitute anything.
125 $ section1 = f$element(i, "@", line_in)
126 $ if section1 .eqs. "@"
131 $ section2 = f$element(i, "@", line_in)
132 $ if section2 .eqs. "@"
137 $ section3 = f$element(i, "@", line_in)
138 $ if section3 .eqs. "@"
140 $ if line_out .eqs. "" then line_out = line_in
143 $ line_out = line_out + section1
144 $ if f$type(x_'section2') .eqs. "STRING"
146 $ line_out = line_out + x_'section2'
150 $ write c_c_out line_out