4ec7635e2fe7552ac7cd67831fd7af5a8fc710aa
[platform/upstream/curl.git] / packages / vms / build_vms.com
1 $! BUILD_VMS.COM
2 $!
3 $! I've taken the original build_vms.com, supplied by Nico Baggus, if
4 $! memory serves me correctly, and made some modifications.
5 $!
6 $! SSL support is controlled by logical names.  If SSL$INCLUDE is
7 $! defined, then it is assumed that HP's SSL product has been installed.
8 $! If OPENSSL is defined, but SSL$INCLUDE is not, then OpenSSL will be
9 $! used.  If neither logical name is defined, then SSL support will not
10 $! be compiled/linked in.  Command-line options NOHPSSL and NOSSL can be
11 $! specified to override the automatic SSL selection.
12 $!
13 $! Command-line Options:
14 $!
15 $!    CLEAN     Delete product files for this host architecture.  (No
16 $!              build done.)
17 $!    CLEAN_ALL Delete product files for all host architectures.  (No
18 $!              build done.)
19 $!
20 $!    64        Compile with 64-bit pointers.
21 $!              Note, you must match the pointer size that the OpenSSL
22 $!              shared image expects.
23 $!              Currently curl is not building properly with 64 bit pointers
24 $!              on VMS because it is trying to cast pointers to 32 bit
25 $!              integers and some OpenVMS library routines called by curl
26 $!              do not yet support 64 bit pointers.
27 $!    CCQUAL=x  Add "x" to the C compiler qualifiers.
28 $!              Default qualifiers are:
29 $!                  /standard=relaxed
30 $!                  /names=(as_is, shortened)
31 $!                  /repository=[.'arch']
32 $!                  /nested_include_directory=none
33 $!                  /define=(_LARGEFILE=1,_USE_STD_STAT=1) (non-vax)
34 $!                  /float=ieee/ieee_mode=denorm_results (non-vax)
35 $!    DEBUG     Compile debug and nooptimize
36 $!              Alpha/IA64 always compiles /debug.
37 $!              Always link a debug image.
38 $!    NOIEEE    Do not use IEEE floating point.  (Alpha/I64)
39 $!              VAX must always use DFLOAT
40 $!    NOLARGE   Disable large-file support if large file support available.
41 $!              (Non-VAX, VMS >= V7.2.)
42 $!    NOLDAP    Disable LDAP support if LDAP is available.
43 $!    NOKERBEROS   Disable Kerberos support if Kerberos is available.
44 $!    LIST      Create C compiler listings and linker maps.
45 $!                 /list/show=(expan,includ)/machine
46 $!    FULLLIST  Full detailed listing.
47 $!                 /list/show=(all, nomessages)/machine
48 $!    NOHPSSL   Don't use HP SSL, even if available.
49 $!              Note, you must match the pointer size that the OpenSSL
50 $!              shared image expects.  This procedure will select the
51 $!              correct HP OpenSSL image.
52 $!    NOSSL     Don't use any SSL, even if available.
53 $!    OSSLOLB   Use OpenSSL object libraries (.OLB), even if shared
54 $!              images (.EXE) are available.
55 $!    NOZLIB    Don't use GNV$ZLIB shared image even if available.
56 $!    REALCLEAN Delete product files for all host architectures.  (No
57 $!              build done.)  Alias for CLEAN_ALL
58 $!
59 $! DCL Symbols:
60 $!
61 $!    CURL_CCDEFS="c_macro_1=value1 [, c_macro_2=value2 [...]]"
62 $!              Compile with these additional C macros defined.
63 $!
64 $! Revisions:
65 $!
66 $!  2-DEC-2003, MSK, the "original" version.
67 $!                   It works for me.  Your mileage may vary.
68 $! 13-JAN-2004, MSK, moved this procedure to the [.packages.vms] directory
69 $!                   and updated it to do hardware dependent builds.
70 $! 29-JAN-2004, MSK, moved logical defines into defines.com
71 $!  6-FEB-2004, MSK, put in various SSL support bits
72 $!  9-MAR-2004, MSK, the config-vms.h* files are now copied to the lib and
73 $!                   src directories as curl_config.h.
74 $! 15-MAR-2004, MSK, All of the curlmsg*.* files have also been moved to
75 $!                   this build directory.  They will be copied to the src
76 $!                   directory before build.  The .msg file will be compiled
77 $!                   to get the .obj for messages, but the .h and .sdl files
78 $!                   are not automatically created since they partly rely on
79 $!                   the freeware SDL tool.
80 $!  8-FEB-2005, MSK, merged the two config-vms.h* files into one that uses
81 $!                   USE_SSLEAY to define if the target has SSL support built
82 $!                   in.  Changed the cc/define parameter accordingly.
83 $! 11-FEB-2005, MSK, If [--.LIB]AMIGAOS.C and NWLIB.C are there, rename them
84 $! 23-MAR-2005, MSK, relocated cc_qual define so that DEBUG option would work
85 $! 25-APR-2007, STL, allow compilation in 64-bit mode.
86 $! 13-DEC-2009. SMS, Changed to skip unwanted source files without
87 $!                   renaming the original files.
88 $!                   Eliminated needless, persistent logical names.
89 $!                   Added CURL_CCDEFS DCL symbol for user-specified C
90 $!                   macro definitions.
91 $!                   Added CLEAN and CLEAN_ALL options.
92 $!                   Added CCQUAL option for user-specified C compiler
93 $!                   qualifiers.
94 $!                   Added IEEE option for IEEE floating point (Alpha).
95 $!                   Added LARGE option for large-file support.
96 $!                   Added OSSLOLB option, and support for OpenSSL
97 $!                   shared images.
98 $!                   Changed to put listing and map files into lisdir:.
99 $!                   Changed to avoid case confusion on ODS5 disks.
100 $!                   Added more default dev:[dir] save+restore.
101 $!                   Moved remaining "defines.com" code (back) into
102 $!                   here, eliminating the hard-coded OpenSSL nonsense.
103 $!                   Changed to use F$GETSYI("ARCH_NAME") (or
104 $!                   equivalent) to name architecture-specific product
105 $!                   file destination directory, and to create the
106 $!                   directory if needed (obviating inclusion of these
107 $!                   directories and dummy files in the distribution
108 $!                   kit).
109 $!                   Changed the "compile" subroutine to break the CC
110 $!                   command across multiple lines to avoid DCL
111 $!                   line-too-long problems.
112 $!                   Changed "vo_c" messages to show the CC qualifiers
113 $!                   once, not with every compile command.
114 $! 01-Jan-2013  J. Malmberg
115 $!                   VMS build procedures need to be able to work with
116 $!                   the default set to a search list, with created or
117 $!                   modified files only in the first member of the search
118 $!                   list.
119 $!                   Whitespace change to be more compatible with current
120 $!                   practices.
121 $!                   One pass option parsing instead of loop.
122 $!                   GNV ZLIB shared image support.
123 $!                   KERBEROS support where available.
124 $!                   LDAP default to on where available
125 $!                   LARGEFILE default to on where available
126 $!                   IEEE float default to on where available.
127 $!                   Generate the curl_config.h file from system inspection.
128 $!                   Linker finds ldap with out option file.
129 $! 13-Mar-2013, Tom Grace
130 $!                   Added missing slash in cc_full_list.
131 $!                   Removed unwanted extra quotes inside symbol tool_main
132 $!                   for non-VAX architectures that triggered link failure.
133 $!                   Replaced curl_sys_inc with sys_inc.
134 $! 19-Mar-2013, John Malmberg
135 $!                   symbol tool_main needs to be quoted when parse style is
136 $!                   set to exended in versions of VMS greater than 7.3-1.
137 $!                   Remove curlbuild.h generation as it should be pre-built
138 $!                   in the curl release or daily tarball.
139 $! 12-Jul-2013, John Malmberg
140 $!                   Adjust to find and use ZLIB from the Jean-Francois
141 $!                   Pieronne shared image and newer GNV ZLIB kit that
142 $!                   is upward compatible with Jean-Francois's kit.
143 $!                   Remove tabs from file.
144 $!                   Fixed DCL formatting as follows:
145 $!                      * Labels have no space after leading $.
146 $!                      * 1 space after $ for first level.
147 $!                      * 3 spaces after $ for second level.  Line start + 4.
148 $!                      * 7 spaces after $ for third level.  Line start + 8.
149 $!                      * Each level after that indents 4 characters.
150 $!                      * then/else/endif same indentation as if statement.
151 $!
152 $!===========================================================================
153 $!
154 $!
155 $! Save the original default dev:[dir], and arrange for its restoration
156 $! at exit.
157 $!------------------------------------------------------------------------
158 $ curl = ""
159 $ orig_def = f$environment("DEFAULT")
160 $ on error then goto Common_Exit
161 $ on control_y then goto Common_Exit
162 $!
163 $ ctrl_y  = 1556
164 $ proc = f$environment("PROCEDURE")
165 $ proc_fid = f$file_attributes(proc, "FID")
166 $ proc_dev = f$parse(proc, , , "DEVICE")
167 $ proc_dir = f$parse(proc, , , "DIRECTORY")
168 $ proc_name = f$parse(proc, , , "NAME")
169 $ proc_type = f$parse(proc, , , "TYPE")
170 $ proc_dev_dir = proc_dev + proc_dir
171 $!
172 $! Have to manually parse the device for a search list.
173 $! Can not use the f$parse() as it will return the first name
174 $! in the search list.
175 $!
176 $ orig_def_dev = f$element(0, ":", orig_def) + ":"
177 $ if orig_def_dev .eqs. "::" then orig_def_dev = "sys$disk:"
178 $ test_proc = orig_def_dev + proc_dir + proc_name + proc_type
179 $!
180 $! If we can find this file using the default directory
181 $! then we know that we should use the original device from the
182 $! default directory which could be a search list.
183 $!
184 $ test_proc_fid = f$file_attributes(test_proc, "FID")
185 $!
186 $ if (test_proc_fid .eq. proc_fid)
187 $ then
188 $   proc_dev_dir = orig_def_dev + proc_dir
189 $ endif
190 $!
191 $!
192 $! Verbose output message stuff.  Define symbol to "write sys$output" or "!".
193 $! vo_c - verbose output for compile
194 $! vo_l - link
195 $! vo_o - object check
196 $!
197 $ vo_c := "write sys$output"
198 $ vo_l := "write sys$output"
199 $ vo_o := "!"
200 $!
201 $! Determine the main distribution directory ("[--]") in an
202 $! ODS5-tolerant (case-insensitive) way.  (We do assume that the only
203 $! "]" or ">" is the one at the end.)
204 $!
205 $! Some non-US VMS installations report ">" for the directory delimiter
206 $! so do not assume that it is "]".
207 $!
208 $ orig_def_len = f$length(orig_def)
209 $ delim = f$extract(orig_def_len - 1, 1, orig_def)
210 $!
211 $ set default 'proc_dev_dir'
212 $ set default [--]
213 $ base_dev_dir = f$environment("default")
214 $ top_dev_dir = base_dev_dir - delim
215 $!
216 $!
217 $!
218 $! Define the architecture-specific product file destination directory
219 $! name(s).
220 $!
221 $ parse_style = "TRADITIONAL"
222 $ if (f$getsyi("HW_MODEL") .lt. 1024)
223 $ then
224 $    arch_name = "VAX"
225 $ else
226 $    arch_name = ""
227 $    arch_name = arch_name + f$edit(f$getsyi("ARCH_NAME"), "UPCASE")
228 $    if (arch_name .eqs. "") then arch_name = "UNK"
229 $!
230 $!   Extended parsing option starts with VMS 7.3-1.
231 $!   There is no 7.4, so that simplifies the parse a bit.
232 $!
233 $    node_swvers = f$getsyi("node_swvers")
234 $    version_patch = f$extract(1, f$length(node_swvers), node_swvers)
235 $    maj_ver = f$element(0, ".", version_patch)
236 $    min_ver_patch = f$element(1, ".", version_patch)
237 $    min_ver = f$element(0, "-", min_ver_patch)
238 $    patch = f$element(1, "-", min_ver_patch)
239 $    if patch .eqs. "-" then patch = ""
240 $    parse_x = 0
241 $    if maj_ver .ges. "8"
242 $    then
243 $       parse_x = 1
244 $    else
245 $       if maj_ver .eqs. "7" .and. min_ver .ges. "3" .and. patch .nes. ""
246 $       then
247 $          parse_x = 1
248 $       endif
249 $    endif
250 $    if parse_x
251 $    then
252 $       parse_style = f$getjpi("", "parse_style_perm")
253 $    endif
254 $ endif
255 $!
256 $ exedir = proc_dev_dir - delim + ".''arch_name'" + delim
257 $ lisdir = exedir
258 $ objdir = exedir
259 $!
260 $! When building on a search list, need to do a create to make sure that
261 $! the output directory exists, since the clean procedure tries to delete
262 $! it.
263 $ create/dir 'exedir'/prot=o:rwed
264 $!
265 $! Interpret command-line options.
266 $!
267 $ hpssl = 0
268 $ ldap = 1
269 $ list = 0
270 $ full_list = 0
271 $ nohpssl = 0
272 $ nossl = 0
273 $ openssl = 0
274 $ osslolb = 0
275 $ nozlib = 0
276 $ nokerberos = 0
277 $ cc_names = "/names=(shortened, as_is)/repository='exedir'
278 $ cc_defs = "HAVE_CONFIG_H=1"
279 $ cc_list = "/list='objdir'/show=(expan, includ)/machine
280 $ cc_full_list = "/list='objdir'/show=(all, nomessages)/machine
281 $ link_qual = ""
282 $ if arch_name .eqs. "VAX"
283 $ then
284 $    cc_debug = "/nodebug/optimize"
285 $    !cc_defs = cc_defs + ""
286 $    cc_float = ""
287 $    cc_large = ""
288 $ else
289 $    cc_debug = "/debug/optimize"
290 $    cc_defs = cc_defs + ",_USE_STD_STAT"
291 $    cc_float = "/float=ieee/ieee_mode=denorm_results"
292 $    cc_large = ",_LARGEFILE"
293 $ endif
294 $ cc_qual1 = ""
295 $ cc_qual2 = ""
296 $ if (f$type(CURL_CCDEFS) .nes. "")
297 $ then
298 $    CURL_CCDEFS = f$edit(CURL_CCDEFS, "TRIM")
299 $    cc_defs = cc_defs + ", " + CURL_CCDEFS
300 $ endif
301 $ msg_qual = "/object = ''objdir'"
302 $ ssl_opt = ""
303 $!
304 $! Allow arguments to be grouped together with comma or separated by spaces
305 $! Do no know if we will need more than 8.
306 $ args = "," + p1 + "," + p2 + "," + p3 + "," + p4 + ","
307 $ args = args + p5 + "," + p6 + "," + p7 + "," + p8 + ","
308 $!
309 $! Provide lower case version to simplify parsing.
310 $ args_lower = f$edit(args, "LOWERCASE,COLLAPSE")
311 $!
312 $ args_len = f$length(args)
313 $ args_lower_len = f$length(args_lower)
314 $!
315 $ clean = 0
316 $ if f$locate(",clean,", args_lower) .lt. args_lower_len
317 $ then
318 $   clean = 1
319 $ endif
320 $ clean_all = 0
321 $ if f$locate(",clean_all,", args_lower) .lt. args_lower_len
322 $ then
323 $    clean = 1
324 $    clean_all = 1
325 $ endif
326 $ if f$locate(",realclean,", args_lower) .lt. args_lower_len
327 $ then
328 $    clean = 1
329 $    clean_all = 1
330 $ endif
331 $!
332 $ if clean .ne. 0
333 $ then
334 $   prods = "''exedir'*.*;*"
335 $   if (f$search(prods) .nes. "") then delete /log 'prods'
336 $   prods = proc_dev_dir + arch_name + ".DIR;1"
337 $   if (f$search(prods) .nes. "") then set prot=o:rwed 'prods'
338 $   if (f$search(prods) .nes. "") then delete /log 'prods'
339 $   file = "[]config_vms.h"
340 $   if f$search(file) .nes. "" then delete/log 'file';*
341 $   file = "[]config.h"
342 $   if f$search(file) .nes. "" then delete/log 'file';*
343 $   file = "[]curl-config."
344 $   if f$search(file) .nes. "" then delete/log 'file';*
345 $   file = "[]libcurl.pc"
346 $   if f$search(file) .nes. "" then delete/log 'file';*
347 $   file = "[.lib.cxx_repository]cxx$demangler_db."
348 $   if f$search(file) .nes. "" then delete/log 'file';*
349 $   file = "[.src.cxx_repository]cxx$demangler_db."
350 $   if f$search(file) .nes. "" then delete/log 'file';*
351 $   file = "[.lib]config_vms.h"
352 $   if f$search(file) .nes. "" then delete/log 'file';*
353 $   file = "[...]curl_crtl_init"
354 $   if f$search("''file'.lis") .nes. "" then delete/log 'file'.lis;*
355 $   if f$search("''file'.obj") .nes. "" then delete/log 'file'.obj;*
356 $   file = "[...]gnv$curlmsg"
357 $   if f$search("''file'.lis") .nes. "" then delete/log 'file'.lis;*
358 $   if f$search("''file'.obj") .nes. "" then delete/log 'file'.obj;*
359 $   if f$search("''file'.exe") .nes. "" then delete/log 'file'.exe;*
360 $   file = "[...]curlmsg"
361 $   if f$search("''file'.lis") .nes. "" then delete/log 'file'.lis;*
362 $   if f$search("''file'.obj") .nes. "" then delete/log 'file'.obj;*
363 $   if f$search("''file'.exe") .nes. "" then delete/log 'file'.exe;*
364 $   file = "[...]report_openssl_version"
365 $   if f$search("''file'.lis") .nes. "" then delete/log 'file'.lis;*
366 $   if f$search("''file'.obj") .nes. "" then delete/log 'file'.obj;*
367 $   if f$search("''file'.exe") .nes. "" then delete/log 'file'.exe;*
368 $   file = "[...]hp_ssl_release_info.txt"
369 $   if f$search(file) .nes. "" then delete/log 'file';*
370 $   file = "[...]gnv_libcurl_xfer.mar_exact"
371 $   if f$search(file) .nes. "" then delete/log 'file';*
372 $   file = "[...]gnv_libcurl_xfer"
373 $   if f$search("''file'.lis") .nes. "" then delete/log 'file'.lis;*
374 $   if f$search("''file'.obj") .nes. "" then delete/log 'file'.obj;*
375 $   if f$search("''file'.opt") .nes. "" then delete/log 'file'.opt;*
376 $   file = "[...]curl-*_original_src.bck"
377 $   if f$search(file) .nes. "" then delete/log 'file';*
378 $   file = "[...]curl-*_vms_src.bck"
379 $   if f$search(file) .nes. "" then delete/log 'file';*
380 $   file = "[...]curl-*.release_notes"
381 $   if f$search(file) .nes. "" then delete/log 'file';*
382 $   file = "[...]*curl*.pcsi$desc"
383 $   if f$search(file) .nes. "" then delete/log 'file';*
384 $   file = "[...]*curl*.pcsi$text"
385 $   if f$search(file) .nes. "" then delete/log 'file';*
386 $!
387 $   if clean_all .eq. 0 then goto Common_Exit
388 $ endif
389 $!
390 $!
391 $ if clean_all .ne. 0
392 $ then
393 $   file = "[...]gnv$libcurl"
394 $   if f$search("''file'.exe") .nes. "" then delete/log 'file'.exe;*
395 $   if f$search("''file'.map") .nes. "" then delete/log 'file'.map;*
396 $   if f$search("''file'.dsf") .nes. "" then delete/log 'file'.dsf;*
397 $   file = "[.src]curl"
398 $   if f$search("''file'.exe") .nes. "" then delete/log 'file'.exe;*
399 $   if f$search("''file'.map") .nes. "" then delete/log 'file'.map;*
400 $   if f$search("''file'.dsf") .nes. "" then delete/log 'file'.dsf;*
401 $   prods = proc_dev_dir - delim + ".ALPHA" + delim + "*.*;*"
402 $   if (f$search(prods) .nes. "") then delete /log 'prods'
403 $   prods = proc_dev_dir + "ALPHA" + ".DIR;1"
404 $   if (f$search(prods) .nes. "") then set prot=o:rwed 'prods'
405 $   if (f$search(prods) .nes. "") then delete /log 'prods'
406 $   prods = proc_dev_dir - delim + ".IA64" + delim + "*.*;*"
407 $   if (f$search(prods) .nes. "") then delete /log 'prods'
408 $   prods = proc_dev_dir + "IA64" + ".DIR;1"
409 $   if (f$search(prods) .nes. "") then set prot=o:rwed 'prods'
410 $   if (f$search(prods) .nes. "") then delete /log 'prods'
411 $   prods = proc_dev_dir - delim + ".VAX" + delim + "*.*;*"
412 $   if (f$search(prods) .nes. "") then delete /log 'prods'
413 $   prods = proc_dev_dir + "VAX"+ ".DIR;1"
414 $   if (f$search(prods) .nes. "") then set prot=o:rwed 'prods'
415 $   if (f$search(prods) .nes. "") then delete /log 'prods'
416 $   file = "[...]macro32_exactcase"
417 $   if f$search("''file'.exe") .nes. "" then delete/log 'file'.exe;*
418 $   if f$search("''file'.jnl") .nes. "" then delete/log 'file'.jnl;*
419 $   goto Common_Exit
420 $ endif
421 $!
422 $ build_64 = 0
423 $ if f$locate(",64,", args_lower) .lt. args_lower_len
424 $ then
425 $   cc_qual1 = cc_qual1 + " /POINTER = 64"
426 $   build_64 = 1
427 $ endif
428 $!
429 $ args_loc = f$locate(",ccqual=", args_lower)
430 $ if args_loc .lt. args_lower_len
431 $ then
432 $   arg = f$extract(args_loc + 1, args_lower_len, args_lower)
433 $   arg_val = f$element(0, ",", arg)
434 $   cc_qual2 = f$element(1, "=", arg_val);
435 $ endif
436 $!
437 $! On Alpha/IA64 no size penalty for compiling /debug/optimize
438 $! by default.
439 $ if f$locate(",debug,", args_lower) .lt. args_lower_len
440 $ then
441 $   cc_debug = "/debug/nooptimize"
442 $ endif
443 $!
444 $! We normally want IEEE float if it is available.  Programs that are
445 $! calling libcurl will typically prefer IEEE behavior, unless on the
446 $! VAX where we have no choice.
447 $!
448 $ if f$locate(",noieee,", args_lower) .lt. args_lower_len
449 $ then
450 $   cc_float = ""
451 $ endif
452 $!
453 $! Normally we want large file if it is available.
454 $ if f$locate(",nolarge,", args_lower) .lt. args_lower_len
455 $ then
456 $   write sys$output "Handling of large files disabled."
457 $   cc_large = ""
458 $ endif
459 $ if cc_large .nes. ""
460 $ then
461 $   cc_defs = cc_defs + cc_large
462 $ endif
463 $!
464 $ if f$locate(",noldap,", args_lower) .lt. args_lower_len
465 $ then
466 $   ldap = 0
467 $ endif
468 $!
469 $ if f$locate(",list,", args_lower) .lt. args_lower_len
470 $ then
471 $   list = 1
472 $ endif
473 $ if f$locate(",fulllist,", args_lower) .lt. args_lower_len
474 $ then
475 $    list = 1
476 $    full_list = 1
477 $ endif
478 $!
479 $ if f$locate(",nohpssl,", args_lower) .lt. args_lower_len
480 $ then
481 $   nohpssl = 1
482 $ endif
483 $!
484 $ if f$locate(",nossl,", args_lower) .lt. args_lower_len
485 $ then
486 $   nossl = 1
487 $ endif
488 $!
489 $ if f$locate(",osslolb,", args_lower) .lt. args_lower_len
490 $ then
491 $    osslolb = 1
492 $ endif
493 $!
494 $ if f$locate(",nozlib,", args_lower) .lt. args_lower_len
495 $ then
496 $   nozlib = 1
497 $ endif
498 $!
499 $ if f$locate(",nokerberos,", args_lower) .lt. args_lower_len
500 $ then
501 $   nokerberos = 1
502 $ endif
503 $!
504 $!
505 $! CC /LIST, LINK /MAP, and MESSAGE /LIST are defaults in batch mode,
506 $! so be explicit when they're not desired.
507 $!
508 $
509 $ if list .eq. 0
510 $ then
511 $   cc_qual1 = cc_qual1 + "/nolist"
512 $   msg_qual = msg_qual + "/nolist"
513 $ else
514 $   msg_qual = msg_qual + "/list='objdir'"
515 $   if (full_list .ne. 0)
516 $   then
517 $       cc_qual1 = cc_qual1 + cc_full_list
518 $   else
519 $       cc_qual1 = cc_qual1 + cc_list
520 $   endif
521 $ endif
522 $ cc_qual1 = cc_qual1 + cc_names + cc_float + cc_debug
523 $!
524 $! Create product directory, if needed.
525 $!
526 $ if (f$search(proc_dev_dir + arch_name + ".DIR;1") .eqs. "")
527 $ then
528 $    create /directory 'exedir'
529 $ endif
530 $!
531 $! Detect available (but not prohibited) SSL software.
532 $!
533 $ libsslshr_line = ""
534 $ libcryptoshr_line = ""
535 $ if (.not. nossl)
536 $ then
537 $   if (f$trnlnm("OPENSSL") .nes. "")
538 $   then
539 $!        cc_defs = cc_defs + ", USE_SSLEAY=1"
540 $        if ((f$trnlnm("SSL$INCLUDE") .nes. "") .and. (.not. nohpssl))
541 $        then
542 $!          Use HP SSL.
543 $           hpssl = 1
544 $!
545 $!          Older SSL only has lib*_shr32 images
546 $!-----------------------------------------------
547 $           libsslshr = "sys$share:ssl$libssl_shr"
548 $           if (f$search("''libsslshr'.exe") .eqs. "") .or. (.not. build_64)
549 $           then
550 $               libsslshr = libsslshr + "32"
551 $           endif
552 $           libcryptoshr = "sys$share:ssl$libcrypto_shr"
553 $           if (f$search("''libcryptoshr'.exe") .eqs. "") .or. (.not. build_64)
554 $           then
555 $               libcryptoshr = libcryptoshr + "32"
556 $           endif
557 $           libsslshr_line = "''libsslshr'.exe/share"
558 $           libcryptoshr_line = "''libcryptoshr'.exe/share"
559 $       else
560 $!          Use OpenSSL.  Assume object libraries, unless shared images
561 $!          are found (and not prohibited).
562 $!          TODO: We do not know how to automatically choose based on the
563 $!          pointer size.
564 $!
565 $           openssl = 1
566 $           libsslshr_line = "ssllib:libssl.olb/lib"
567 $           libcryptoshr_line = "ssllib:libcrypto.olb/lib"
568 $           ssl_opt = ", ssllib:libssl.olb /library" + -
569                 ", ssllib:libcrypto.olb /library"
570 $           if (osslolb .eq. 0)
571 $           then
572                 if ((f$search("ssllib:ssl_libcrypto.exe") .nes. "")  .and. -
573                     (f$search("ssllib:ssl_libssl.exe") .nes. ""))
574 $                then
575 $!                   OpenSSL shared images with "SSL_xxx.EXE names.
576 $                    openssl = 2
577 $                    libsslshr_line = "ssllib:ssl_libssl_shr.exe/share"
578 $                    libcryptoshr_line = "ssllib:ssl_libcrypto_shr.exe/share"
579 $                else
580 $                    if ((f$search("ssllib:libcrypto.exe") .nes. "") .and. -
581                          (f$search("ssllib:libssl.exe") .nes. ""))
582 $                    then
583 $!                       OpenSSL shared images with "xxx.EXE names.
584 $                        openssl = 3
585 $                        libsslshr_line = "ssllib:libssl_shr.exe/share"
586 $                        libcryptoshr_line = "ssllib:libcrypto_shr.exe/share"
587 $                    endif
588 $                endif
589 $           endif
590 $       endif
591 $   endif
592 $ endif
593 $!
594 $! LDAP.
595 $!
596 $ if f$search("SYS$SHARE:LDAP$SHR.EXE") .eqs. ""
597 $ then
598 $   ldap = 0
599 $ endif
600 $ if (ldap .eq. 0)
601 $ then
602 $!   cc_defs = cc_defs + ", CURL_DISABLE_LDAP=1"
603 $ else
604 $   'vo_c' "%CURL-I-BLDHPLDAP, building with HP LDAP support"
605 $ endif
606 $!
607 $! KERBEROS
608 $ gssrtlshr_line = ""
609 $ try_shr = "sys$share:gss$rtl"
610 $ if f$search("''try_shr'.exe") .eqs. ""
611 $ then
612 $   nokerberos = 1
613 $ endif
614 $ curl_sys_krbinc = ""
615 $ if nokerberos .eq. 0
616 $ then
617 $   'vo_c' "%CURL-I-BLDHPKERBEROS, building with HP KERBEROS support"
618 $   curl_sys_krbinc = "sys$sysroot:[kerberos.include]"
619 $   gssrtlshr_line = "''try_shr'/share"
620 $ endif
621 $!
622 $!
623 $! LIBZ
624 $ libzshr_line = ""
625 $ try_shr = "gnv$libzshr"
626 $ if build_64
627 $ then
628 $!  First look for 64 bit
629 $   if f$search("''try_shr'64") .eqs. ""
630 $   then
631 $!      Second look for the J.F. Pieronne 64 bit shared image
632 $       try_shr = "LIBZ_SHR64"
633 $       if f$search(try_shr) .eqs. "" then nozlib = 1
634 $   endif
635 $ else
636 $!  First look for 32 bit
637 $   if f$search("''try_shr'32") .eqs. ""
638 $   then
639 $!      Second look for old 32 bit image
640 $       if f$search(try_shr) .eqs. ""
641 $       then
642 $!          Third look for the J.F. Pieronne 32 bit shared image
643 $           try_shr = "LIBZ_SHR32"
644 $           if f$search(try_shr) .eqs. "" then nozlib = 1
645 $       endif
646 $   endif
647 $ endif
648 $ if f$search(try_shr) .eqs. ""
649 $ then
650 $   nozlib = 1
651 $ endif
652 $ curl_sys_zlibinc = ""
653 $ if nozlib .eq. 0
654 $ then
655 $   libzshr_line = "''try_shr'/share"
656 $   if f$locate("LIBZ", try_shr) .eq. 0
657 $   then
658 $       'vo_c' "%CURL-I-BLDJFPLIBZ, building with JFP LIBZ support"
659 $       curl_sys_zlibinc = "LIBZ:"
660 $   else
661 $       'vo_c' "%CURL-I-BLDGNVLIBZ, building with GNV LIBZ support"
662 $       curl_sys_zlibinc = "GNV$ZLIB_INCLUDE:"
663 $   endif
664 $ endif
665 $!
666 $! Form CC qualifiers.
667 $!
668 $ cc_defs = "/define = (''cc_defs')"
669 $ cc_qual2 = cc_qual2 + " /object = ''objdir'"
670 $ cc_qual2 = cc_qual2 + " /include = ([-.lib], [-.src],"
671 $ cc_qual2 = cc_qual2 + " [-.packages.vms], [-.packages.vms.''arch_name'])"
672 $ cc_qual2 = cc_qual2 + "/nested_include_directory=none"
673 $!
674 $ 'vo_c' "CC opts:", -
675   " ''cc_defs'", -
676   " ''cc_qual1'", -
677   " ''cc_qual2'"
678 $!
679 $! Inform the victim of our plans.
680 $!
681 $ if (hpssl)
682 $ then
683 $    'vo_c' "%CURL-I-BLDHPSSL, building with HP SSL support"
684 $ else
685 $    if (openssl .ne. 0)
686 $    then
687 $       if (openssl .eq. 1)
688 $       then
689 $          'vo_c' -
690  "%CURL-I-BLDOSSL_OLB, building with OpenSSL (object library) support"
691 $       else
692 $          'vo_c' -
693  "%CURL-I-BLDOSSL_EXE, building with OpenSSL (shared image) support"
694 $       endif
695 $    else
696 $       'vo_c' "%CURL-I-BLDNOSSL, building with NO SSL support"
697 $    endif
698 $ endif
699 $!
700 $! Announce destination and SSL directories.
701 $!
702 $ 'vo_c' "   OBJDIR = ''objdir'"
703 $ 'vo_c' "   EXEDIR = ''exedir'"
704 $!
705 $ if (openssl .ne. 0)
706 $ then
707 $   ssllib = f$trnlnm("ssllib")
708 $   if (ssllib .eqs. "")
709 $   then
710 $       ssllib = "(undefined)"
711 $   endif
712 $   'vo_c' "   SSLLIB = ''ssllib'"
713 $!
714 $! TODO: Why are we translating the logical name?
715 $! The logical aname used to find the shared image should just be used
716 $! as translating it could result in the wrong location at run time.
717 $   if (openssl .eq. 1)
718 $   then
719 $       ossl_lib1 = f$trnlnm("ssllib")+ "LIBSSL.OLB"
720 $       ossl_lib2 = f$trnlnm("ssllib")+ "LIBCRYPTO.OLB"
721 $       msg = "object libraries"
722 $   else
723 $       if (openssl .eq. 2)
724 $       then
725 $           ossl_lib1 = f$trnlnm("ssllib")+ "SSL_LIBSSL.EXE"
726 $           ossl_lib2 = f$trnlnm("ssllib")+ "SSL_LIBCRYPTO.EXE"
727 $       else
728 $           ossl_lib1 = f$trnlnm("ssllib")+ "LIBSSL.EXE"
729 $           ossl_lib2 = f$trnlnm("ssllib")+ "LIBCRYPTO.EXE"
730 $       endif
731 $       msg = "shared images"
732 $   endif
733 $   if ((f$search(ossl_lib1) .eqs. "") .or. -
734         (f$search(ossl_lib2) .eqs. ""))
735 $   then
736 $       write sys$output "Can't find OpenSSL ''msg':"
737 $       write sys$output "   ''ossl_lib1'"
738 $       write sys$output "   ''ossl_lib2'"
739 $       goto Common_Exit
740 $   endif
741 $ endif
742 $!
743 $! Define the "curl" (process) logical name for "#include <curl/xxx.h>".
744 $!
745 $ curl = f$trnlnm("curl", "LNM$PROCESS")
746 $ if (curl .nes. "")
747 $ then
748 $   write sys$output ""
749 $   write sys$output -
750  "Process logical name ""curl"" is already defined, but this procedure"
751 $   write sys$output -
752  "would override that definition.  Use a command like"
753 $   write sys$output -
754  "      deassign /process curl"
755 $   write sys$output -
756  "to cancel that logical name definition, and then and re-run this procedure."
757 $   write sys$output ""
758 $   goto Common_Exit
759 $ endif
760 $ curl_logical = top_dev_dir + ".include.curl" + delim
761 $ curl_sys_inc2 = curl_logical
762 $ curl_sys_inc1 = top_dev_dir + ".include" + delim
763 $! define curl 'top_dev_dir'.include.curl'delim'
764 $!
765 $! Generate config file into the product directory.
766 $!
767 $! call MoveIfDiff [.lib]config-vms.h 'objdir'curl_config.h
768 $!
769 $ conf_params = ""
770 $ if nossl .ne. 0 then conf_params = conf_params + ",nossl"
771 $ if nohpssl .ne. 0 then conf_params = conf_params + ",nohpssl,"
772 $ if ldap .eq. 0 then conf_params = conf_params + ",noldap,"
773 $ if nozlib .ne. 0 then conf_params = conf_params + ",nozlib,"
774 $ if nokerberos .ne. 0 then conf_params = conf_params + ",nokerberos"
775 $ conf_params = conf_params - ","
776 $!
777 $!
778 $ new_conf = f$search("''objdir'curl_config.h")
779 $ if new_conf .eqs. ""
780 $ then
781 $!   set ver
782 $   write sys$output "Generating curl custom config_vms.h"
783 $   @'proc_dev_dir'generate_config_vms_h_curl.com ''conf_params'
784 $!
785 $   write sys$output "Generating curl_config.h"
786 $   conf_in = f$search("[.lib]curl_config*.*in")
787 $   if conf_in .eqs. ""
788 $   then
789 $       write sys$output "Can not find [.lib]curl_config*.*in file!"
790 $       goto common_exit
791 $   endif
792 $   @'proc_dev_dir'config_h.com 'conf_in'
793 $   copy config.h 'objdir'curl_config.h
794 $   delete config.h;
795 $!   set nover
796 $ endif
797 $!
798 $!
799 $!
800 $ on control_y then goto Common_Exit
801 $!
802 $ set default 'proc_dev_dir'
803 $ sys_inc = "''curl_sys_inc1', ''curl_sys_inc2', ''curl_logical'"
804 $ if curl_sys_krbinc .nes. ""
805 $ then
806 $   sys_inc = sys_inc + ",''curl_sys_krbinc'"
807 $ endif
808 $ if curl_sys_zlibinc .nes. ""
809 $ then
810 $   sys_inc = sys_inc + ",''curl_sys_zlibinc'"
811 $ endif
812 $ call build "[--.lib]" "*.c" "''objdir'CURLLIB.OLB" "amigaos, nwlib, nwos"
813 $ if ($status .eq. ctrl_y) then goto Common_Exit
814 $ call build "[--.src]" "*.c" "''objdir'CURLSRC.OLB"
815 $ if ($status .eq. ctrl_y) then goto Common_Exit
816 $ call build "[]" "*.msg" "''objdir'CURLSRC.OLB"
817 $ if ($status .eq. ctrl_y) then goto Common_Exit
818 $!
819 $!
820 $ if (openssl .ne. 0)
821 $ then
822 $   if (openssl .eq. 1)
823 $   then
824 $       'vo_l' "%CURL-I-LINK_OSSL, linking with OpenSSL (object library)"
825 $   else
826 $       'vo_l' "%CURL-I-LINK_HPSSL, linking with OpenSSL (shared image)"
827 $   endif
828 $ else
829 $   if (hpssl)
830 $   then
831 $       'vo_l' "%CURL-I-LINK_HPSSL, linking with HP SSL"
832 $   else
833 $       'vo_l' "%CURL-I-LINK_NOSSL, linking with NO SSL support"
834 $   endif
835 $ endif
836 $!
837 $!
838 $! GNV helper files for building the test curl binary.
839 $!-----------------------------------------------
840 $ create 'exedir'gnv$curl.opt
841 $ open/append opt 'exedir'gnv$curl.opt
842 $ if libzshr_line .nes. "" then write opt libzshr_line
843 $ if gssrtlshr_line .nes. "" then write opt gssrtlshr_line
844 $ if libcryptoshr_line .nes. "" then write opt libcryptoshr_line
845 $ if libsslshr_line .nes. "" then write opt libsslshr_line
846 $ close opt
847 $!
848 $!
849 $! Create the libcurl
850 $!------------------------------------------------------
851 $ create 'exedir'gnv_libcurl_linker.opt
852 $ open/append opt 'exedir'gnv_libcurl_linker.opt
853 $ if libzshr_line .nes. "" then write opt libzshr_line
854 $ if gssrtlshr_line .nes. "" then write opt gssrtlshr_line
855 $ if libcryptoshr_line .nes. "" then write opt libcryptoshr_line
856 $ if libsslshr_line .nes. "" then write opt libsslshr_line
857 $ close opt
858 $!
859 $!
860 $! If we are not on VAX, then we want the debug symbol table in
861 $! a separate file.
862 $! VAX needs the tool_main unquoted in uppercase,
863 $! Alpha and IA64 need tool_main quoted in exact case when parse style is
864 $! extended.
865 $ link_dsf1 = ""
866 $ link_dsf2 = ""
867 $ tool_main = "tool_main"
868 $ if arch_name .nes. "VAX"
869 $ then
870 $   if parse_style .eqs. "EXTENDED"
871 $   then
872 $      tool_main = """tool_main"""
873 $   endif
874 $   link_dsf1 = "/dsf=" + exedir + "CURL.DSF"
875 $   link_dsf2 = "/dsf=" + exedir + "CURL_DEBUG.DSF"
876 $ endif
877 $ if (list .eq. 0)
878 $ then
879 $   link_map1 = "/nomap"
880 $   link_map2 = "/nomap"
881 $ else
882 $   link_map1 = "/map=" + exedir + "CURL.MAP"
883 $   link_map2 = "/map=" + exedir + "CURL_DEBUG.MAP"
884 $ endif
885 $!
886 $!
887 $! Make a normal image.
888 $ set ver
889 $ link 'link_map1' 'link_dsf1' /executable = 'exedir'CURL.EXE -
890    'objdir'curlsrc.olb /library /include = ('tool_main', curlmsg), -
891    'objdir'curllib.olb /library, -
892    'exedir'gnv$curl.opt/opt
893 $!
894 $! Also make a debug copy.
895 $ link/debug 'link_map2' 'link_dsf2' /executable = 'exedir'CURL_DEBUG.EXE -
896    'objdir'curlsrc.olb /library /include = ('tool_main', curlmsg), -
897    'objdir'curllib.olb /library, -
898    'exedir'gnv$curl.opt/opt
899 $ set nover
900 $!
901 $ goto Common_Exit
902 $!
903 $! Subroutine to build everything with a filetype passed in via P2 in
904 $! the directory passed in via P1 and put it in the object library named
905 $! via P3.  Exclude items in P4.
906 $!
907 $build:   subroutine
908 $   build_def = f$environment("default")
909 $   on control_y then goto EndLoop ! SS$_CONTROLY
910 $   sts = 1 ! SS$_NORMAL.
911 $!   set noon
912 $   set default 'p1'
913 $   search = p2
914 $   reset = f$search("reset")
915 $   if f$search( p3) .eqs. ""
916 $   then
917 $       librarian /create /object 'p3'
918 $   endif
919 $   reject_list__ = "," + f$edit(p4, "COLLAPSE, UPCASE") + ","
920 $   reject_list___len = f$length(reject_list__)
921 $   reset = f$search( "reset", 1)
922 $Loop:
923 $   file = f$search( search, 1)
924 $   if file .eqs. "" then goto EndLoop
925 $!  Skip a name if it's in the P4 exclusion list.
926 $   if (p4 .nes. "")
927 $   then
928 $       name__ = "," + -
929             f$edit(f$parse(file, , , "NAME", "SYNTAX_ONLY"), "UPCASE") + -
930             ","
931 $       if (f$locate(name__, reject_list__) .lt. reject_list___len)
932 $       then
933 $          goto Loop
934 $       endif
935 $   endif
936 $   objfile = f$parse("''objdir'.OBJ;", file)
937 $   obj = f$search(objfile, 2)
938 $   if (obj .nes. "")
939 $   then
940 $       if (f$cvtime(f$file(file,"rdt")) .gts. f$cvtime(f$file(obj,"rdt")))
941 $       then
942 $           call compile 'file'
943 $           sts = $status
944 $           if .not. sts
945 $           then
946 $               goto EndLoop
947 $           endif
948 $           librarian /object 'p3' 'objfile'
949 $       else
950 $           'vo_o' "%CURL-I-OBJUTD, ", objfile, " is up to date"
951 $       endif
952 $   else
953 $       'vo_o' "%CURL-I-OBJDNE, ", file, " does not exist"
954 $       call compile 'file'
955 $       sts = $status
956 $       if .not. sts
957 $       then
958 $           goto EndLoop
959 $       endif
960 $       librarian /object 'p3' 'objfile'
961 $   endif
962 $   goto Loop
963 $EndLoop:
964 $!!!    purge
965 $   set default 'build_def'
966 $   exit 'sts'
967 $ endsubroutine   ! Build
968 $!
969 $! Based on the file TYPE, do the right compile command.
970 $! Only C and MSG supported.
971 $!
972 $compile:   subroutine
973 $   on control_y then return ctrl_y ! SS$_CONTROLY
974 $!   set noon
975 $   file = p1
976 $   qual = p2+ p3+ p4+ p5+ p6+ p7+ p8
977 $   typ = f$edit(f$parse(file, , , "TYPE"), "UPCASE") - "."
978 $   if (typ .eqs. "C")
979 $   then
980 $       'vo_c' "CC (opts) ", file
981 $       define/user curl 'curl_logical'
982 $       if curl_sys_krbinc .nes. "" then define/user gssapi 'curl_sys_krbinc'
983 $       define/user decc$system_include 'sys_inc'
984 $       CC 'cc_defs' -
985          'cc_qual1' -
986          'cc_qual2' -
987          'file'
988 $   else
989 $       cmd_msg = "MESSAGE " + msg_qual
990 $       x = cmd_'typ'
991 $       'vo_c' x, " ", file
992 $       'x' 'file'
993 $   endif
994 $ ENDSUBROUTINE   ! Compile
995 $!
996 $! Do a diff of the file specified in P1 with that in P2.  If different
997 $! copy P1 to P2.  This also covers if P2 doesn't exist, but not if P2
998 $! is an invalid filespec.
999 $!
1000 $MoveIfDiff:  subroutine
1001 $   set NoOn
1002 $   define /user_mode sys$error nl:
1003 $   define /user_mode sys$output nl:
1004 $   differences 'p1' 'p2'
1005 $   status = $status
1006 $   if (status .ne. %X006C8009) ! if status is not "no diff"
1007 $   then
1008 $       copy 'p1' 'p2'
1009 $       purge /nolog 'p2'
1010 $   endif
1011 $   on control_y then return ctrl_y ! SS$_CONTROLY
1012 $ ENDSUBROUTINE   ! MoveIfDiff
1013 $!
1014 $Common_Exit:
1015 $ set default 'orig_def'
1016 $ exit