1$! build_curl-config_script.com 2$! 3$! This generates the curl-config. script from the curl-config.in file. 4$! 5$! Copyright 2014, 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$! 20$! 16-Dec-2014 J. Malmberg 21$! 22$!=========================================================================== 23$! 24$! Skip this if the curl-config. already exists. 25$ if f$search("[--]curl-config.") .nes. "" then goto all_exit 26$! 27$ if (f$getsyi("HW_MODEL") .lt. 1024) 28$ then 29$ arch_name = "VAX" 30$ else 31$ arch_name = "" 32$ arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE") 33$ if (arch_name .eqs. "") then arch_name = "UNK" 34$ endif 35$! 36$ x_prefix = "/usr" 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 = "" 42$ x_cc = "cc" 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" 48$ x_versionnum = "" 49$ x_libdir = "${prefix}/lib" 50$ x_require_lib_deps = "" 51$ x_enable_static = "" 52$ x_ldflags = "" 53$ part1 = "-L/usr/lib -L/SSL_LIB -lssl -lcrypto -lz" 54$ if arch_name .eqs. "VAX" 55$ then 56$ x_libcurl_libs = part1 57$ else 58$ x_libcurl_libs = part1 + " -lgssapi" 59$ endif 60$ x_libext = "a" 61$! 62$! Get the version number 63$!----------------------- 64$ i = 0 65$ open/read/error=version_loop_end vhf [--.include.curl]curlver.h 66$ version_loop: 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 70$ then 71$ x_curlversion = f$element(2," ", line_in) - """" - """" 72$ i = i + 1 73$ endif 74$ if f$locate("#define LIBCURL_VERSION_NUM ", line_in) .eq. 0 75$ then 76$ x_versionnum = f$element(2," ", line_in) - """" - """" 77$ i = i + 1 78$ endif 79$ if i .lt 2 then goto version_loop 80$ version_loop_end: 81$ close vhf 82$! 83$ kit_type = "V" 84$ if f$locate("-", x_curlversion) .lt. f$length(x_curlversion) 85$ then 86$ kit_type = "D" 87$ x_prefix = "/beta" 88$ x_exec_prefix = "/beta" 89$ endif 90$! 91$ if kit_type .nes. "D" 92$ then 93$ part1 = " echo "" '--prefix=/usr' '--exec-prefix=/usr' " 94$ else 95$ part1 = " echo "" '--prefix=/beta' '--exec_prefix=/beta' " 96$ endif 97$ if arch_name .eqs. "VAX" 98$ then 99$ part3 = "" 100$ else 101$ part3 = "'--with-gssapi' " 102$ endif 103$ part2 = "'--disable-dependency-tracking' '--disable-libtool-lock' " 104$ part4 = "'--disable-ntlm-wb' '--with-ca-path=gnv$curl_ca_path'""" 105$! 106$ x_configure_options = part1 + part2 + part3 + part4 107$! 108$! 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. 112$read_loop: 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 116$ then 117$ write c_c_out line_in 118$ goto read_loop 119$ endif 120$ i = 0 121$ line_out = "" 122$sub_loop: 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. "@" 127$ then 128$ goto sub_loop_end 129$ endif 130$ i = i + 1 131$ section2 = f$element(i, "@", line_in) 132$ if section2 .eqs. "@" 133$ then 134$ goto sub_loop_end 135$ endif 136$ i = i + 1 137$ section3 = f$element(i, "@", line_in) 138$ if section3 .eqs. "@" 139$ then 140$ if line_out .eqs. "" then line_out = line_in 141$ goto sub_loop_end 142$ endif 143$ line_out = line_out + section1 144$ if f$type(x_'section2') .eqs. "STRING" 145$ then 146$ line_out = line_out + x_'section2' 147$ endif 148$ goto sub_loop 149$sub_loop_end: 150$ write c_c_out line_out 151$ goto read_loop 152$read_loop_end: 153$ close c_c_in 154$ close c_c_out 155