1 $! File: build_libcurl_pc.com
5 $! Build the curl-config file from the config_curl.in file
7 $! Copyright 2013, John Malmberg
9 $! Permission to use, copy, modify, and/or distribute this software for any
10 $! purpose with or without fee is hereby granted, provided that the above
11 $! copyright notice and this permission notice appear in all copies.
13 $! THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 $! WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 $! MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 $! ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 $! WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 $! ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
19 $! OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 $! 15-Jun-2013 J. Malmberg
24 $!===========================================================================
26 $! Skip this if the curl-config. already exists.
27 $ if f$search("[--]curl-config.") .nes. "" then goto all_exit
29 $! Need to know the kit type.
30 $ kit_name = f$trnlnm("GNV_PCSI_KITNAME")
31 $ if kit_name .eqs. ""
33 $ write sys$output "@MAKE_PCSI_CURL_KIT_NAME.COM has not been run."
38 $! Parse the kit name into components.
39 $!---------------------------------------
40 $ producer = f$element(0, "-", kit_name)
41 $ base = f$element(1, "-", kit_name)
42 $ product = f$element(2, "-", kit_name)
43 $ mmversion = f$element(3, "-", kit_name)
44 $ majorver = f$extract(0, 3, mmversion)
45 $ minorver = f$extract(3, 2, mmversion)
46 $ updatepatch = f$element(4, "-", kit_name)
47 $ if updatepatch .eqs. "-" then updatepatch = ""
49 $! kit type of "D" means a daily build
50 $ kit_type = f$edit(f$extract(0, 1, majorver), "upcase")
52 $ cfg_file_in = "[--]curl-config.in"
54 $ if f$search(cfg_file_in) .eqs. ""
56 $ write sys$output "Can not find curl-config.in."
60 $ if (f$getsyi("HW_MODEL") .lt. 1024)
65 $ arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
66 $ if (arch_name .eqs. "") then arch_name = "UNK"
70 $ curl_version = "0.0.0"
71 $ open/read vf [--.include.curl]curlver.h
73 $ read vf/end=version_loop_end line_in
74 $ if line_in .eqs. "" then goto version_loop
75 $ key = f$element(0, " ", line_in)
76 $ if key .nes. "#define" then goto version_loop
77 $ name = f$element(1, " ", line_in)
78 $ if name .eqs. "LIBCURL_VERSION"
80 $ curl_version = f$element(2, " ", line_in) - """" - """"
83 $ if name .eqs. "LIBCURL_VERSION_NUM"
85 $ version_num_hex = f$element(2, " ", line_in)
86 $ version_num = version_num_hex - "0x"
93 $ create [--]curl-config.
94 $ open/append pco [--]curl-config.
95 $ open/read pci 'cfg_file_in'
97 $ read pci/end=cfg_file_loop_end line_in
100 $ if line_in .eqs. ""
107 $ key = f$extract(0, 1, line_in)
114 $! No substitution line
115 $ line_in_len = f$length(line_in)
116 $ if f$locate("@", line_in) .ge. line_in_len
122 $ if f$locate("@prefix@", line_in) .lt line_in_len
124 $ if kit_type .nes. "D"
126 $ write pco "prefix=/usr"
128 $ write pco "prefix=/beta"
132 $ if f$locate("@exec_prefix@", line_in) .lt line_in_len
134 $ if kit_type .nes. "D"
136 $ write pco "exec_prefix=/usr"
138 $ write pco "exec_prefix=/beta"
142 $ if f$locate("=@includedir@", line_in) .lt line_in_len
144 $ write pco "includedir=$(prefix}/include"
147 $ if f$locate("X@includedir@", line_in) .lt line_in_len
149 $ write pco " if test ""X$(prefix}/include""; then"
152 $ if f$locate("I@includedir@", line_in) .lt line_in_len
154 $ write pco " echo "${CPPFLAG_CURL_STATICLIB}-I$(prefix}/include"
157 $ if f$locate("@CPPFLAG_CURL_STATICLIB@", line_in) .lt line_in_len
159 $ write pco "cppflag_curl_staticlib=-DCURL_STATICLIB"
162 $ if f$locate("@ENABLE_SHARED@", line_in) .lt line_in_len
164 $ write pco " echo no"
167 $ if f$locate("@CURL_CA_BUNDLE@", line_in) .lt line_in_len
169 $ write pco " echo """""
172 $ if f$locate("@CC@", line_in) .lt line_in_len
174 $ write pco " echo ""cc"""
177 $ if f$locate("@SUPPORT_FEATURES@", line_in) .lt line_in_len
179 $ if arch_name .eqs. "VAX"
181 $ write pco " for feature in SSL libz NTLM ""; do"
183 $ write pco " for feature in SSL IPv6 libz NTLM ""; do"
187 $ if f$locate("@SUPPORT_PROTOCOLS@", line_in) .lt line_in_len
189 $ proto1 = "DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS"
190 $ proto2 = " LDAP LDAPS POP3 POP3S RTSP SMTP SMTPS TELNET TFTP"
191 $ proto = proto1 + proto2
192 $ write pco " for protocol in " + proto + "; do"
195 $ if f$locate("libcurl @CURLVERSION@", line_in) .lt line_in_len
197 $ write pco " echo libcurl ''curl_version'"
200 $ if f$locate("existing @CURLVERSION@", line_in) .lt line_in_len
203 " echo ""requested version $checkfor is newer than existing"
204 $ write pco "''line_start' ''curl_version'"""
207 $ if f$locate("`echo @versionnum@", line_in) .lt line_in_len
209 $ write pco " numuppercase=`echo ''version_num' | tr 'a-f' 'A-F'`"
212 $ if f$locate(" echo @versionnum@", line_in) .lt line_in_len
214 $ write pco " echo ''version_num'"
217 $ if f$locate("X@libdir@", line_in) .lt line_in_len
219 $ part1 = " if test ""$(exec_prefix}/lib"" != ""X/usr/lib"""
220 $ part2 = "-a ""X$(exec_prefix}/lib"" != ""X/usr/lib64""; then"
221 $ write pco part1,part2
224 $ if f$locate("L@libdir@", line_in) .lt line_in_len
226 $ write pco " CURLLIBDIR=""$(exec_prefix}/lib """
229 $ if f$locate("@REQUIRE_LIB_DEPS@", line_in) .lt line_in_len
231 $ write pco " if test "Xyes" = "Xyes"; then"
234 $ if f$locate("@LIBCURL_LIBS@", line_in) .lt line_in_len
236 $ if arch_name .eqs. "VAX"
238 $ write pco " echo ${CURLLIBDIR}-lssl -lcrypto -lz"
240 $ write pco " echo ${CURLLIBDIR}-lssl -lcrypto -lgssapi -lz"
244 $ if f$locate("@ENABLE_STATIC@", line_in) .lt line_in_len
246 $ write pco " if test "Xyes" != "Xno" ; then"
249 $ if f$locate("@LIBCURL_LIBS@", line_in) .lt line_in_len
251 $ part1 = " echo ${exec_prefix}/lib/libcurl.a"
252 $ part2 = "-L/usr/lib -L/SSL_LIB"
253 $ if arch_name .eqs. "VAX"
255 $ write pco "''part1' ''part2' -lssl -lcrypto -lz"
257 $ write pco "''part1' ''part2' -lssl -lcrypto -lgssapi -lz"
261 $ if f$locate("@CONFIGURE_OPTIONS@", line_in) .lt line_in_len
263 $ if kit_type .nes. "D"
265 $ part1 = " echo "" '--prefix=/usr' '--exec-prefix=/usr' "
267 $ part1 = " echo "" '--prefix=/beta' '--exec_prefix=/beta' "
269 $ if arch_name .eqs. "VAX"
273 $ part3 = "'--with-gssapi' "
275 $ part2 = "'--disable-dependency-tracking' '--disable-libtool-lock' "
276 $ part4 = "'--disable-ntlm-wb' '--with-ca-path=gnv$curl_ca_path'"""
278 $ write pco part1,part2,part3,part4