]> git.ipfire.org Git - thirdparty/openssl.git/blob - apps/makeapps.com
Calculate sequence length properly.
[thirdparty/openssl.git] / apps / makeapps.com
1 $!
2 $! MAKEAPPS.COM
3 $! Written By: Robert Byer
4 $! Vice-President
5 $! A-Com Computing, Inc.
6 $! byer@mail.all-net.net
7 $!
8 $! Changes by Richard Levitte <richard@levitte.org>
9 $! Zoltan Arpadffy <zoli@polarhome.com>
10 $!
11 $! This command files compiles and creates all the various different
12 $! "application" programs for the different types of encryption for OpenSSL.
13 $! The EXE's are placed in the directory [.xxx.EXE.APPS] where "xxx" denotes
14 $! ALPHA, IA64 or VAX, depending on your machine architecture.
15 $!
16 $! It was written so it would try to determine what "C" compiler to
17 $! use or you can specify which "C" compiler to use.
18 $!
19 $! Specify DEBUG or NODEBUG as P1 to compile with or without debugger
20 $! information.
21 $!
22 $! Specify which compiler at P2 to try to compile under.
23 $!
24 $! VAXC For VAX C.
25 $! DECC For DEC C.
26 $! GNUC For GNU C.
27 $!
28 $! If you don't specify a compiler, it will try to determine which
29 $! "C" compiler to use.
30 $!
31 $! P3, if defined, sets a TCP/IP library to use, through one of the following
32 $! keywords:
33 $!
34 $! UCX for UCX
35 $! SOCKETSHR for SOCKETSHR+NETLIB
36 $! TCPIP for TCPIP (post UCX)
37 $!
38 $! P4, if defined, sets a compiler thread NOT needed on OpenVMS 7.1 (and up)
39 $!
40 $! P5, if defined, sets a choice of programs to compile.
41 $!
42 $! P6, if defined, specifies the C pointer size. Ignored on VAX.
43 $! ("64=ARGV" gives more efficient code with HP C V7.3 or newer.)
44 $! Supported values are:
45 $!
46 $! "" Compile with default (/NOPOINTER_SIZE)
47 $! 32 Compile with /POINTER_SIZE=32 (SHORT)
48 $! 64 Compile with /POINTER_SIZE=64[=ARGV] (LONG[=ARGV])
49 $! (Automatically select ARGV if compiler supports it.)
50 $! 64= Compile with /POINTER_SIZE=64 (LONG).
51 $! 64=ARGV Compile with /POINTER_SIZE=64=ARGV (LONG=ARGV).
52 $!
53 $! P7, if defined, specifies a directory where ZLIB files (zlib.h,
54 $! libz.olb) may be found. Optionally, a non-default object library
55 $! name may be included ("dev:[dir]libz_64.olb", for example).
56 $!
57 $!
58 $! Announce/identify.
59 $!
60 $ proc = f$environment( "procedure")
61 $ write sys$output "@@@ "+ -
62 f$parse( proc, , , "name")+ f$parse( proc, , , "type")
63 $!
64 $ on control_c then goto exit
65 $!
66 $! Define A TCP/IP Library That We Will Need To Link To.
67 $! (That Is, If We Need To Link To One.)
68 $!
69 $ TCPIP_LIB = ""
70 $ ZLIB_LIB = ""
71 $!
72 $! Check What Architecture We Are Using.
73 $!
74 $ IF (F$GETSYI("CPU").LT.128)
75 $ THEN
76 $!
77 $! The Architecture Is VAX.
78 $!
79 $ ARCH = "VAX"
80 $!
81 $! Else...
82 $!
83 $ ELSE
84 $!
85 $! The Architecture Is Alpha, IA64 or whatever comes in the future.
86 $!
87 $ ARCH = F$EDIT( F$GETSYI( "ARCH_NAME"), "UPCASE")
88 $ IF (ARCH .EQS. "") THEN ARCH = "UNK"
89 $!
90 $! End The Architecture Check.
91 $!
92 $ ENDIF
93 $!
94 $ ARCHD = ARCH
95 $ LIB32 = "32"
96 $ OPT_FILE = ""
97 $ POINTER_SIZE = ""
98 $!
99 $! Define what programs should be compiled
100 $!
101 $ PROGRAMS := OPENSSL
102 $!
103 $! Check To Make Sure We Have Valid Command Line Parameters.
104 $!
105 $ GOSUB CHECK_OPTIONS
106 $!
107 $! Define The CRYPTO Library.
108 $!
109 $ CRYPTO_LIB := SYS$DISK:[-.'ARCHD'.EXE.CRYPTO]SSL_LIBCRYPTO'LIB32'.OLB
110 $!
111 $! Define The SSL Library.
112 $!
113 $ SSL_LIB := SYS$DISK:[-.'ARCHD'.EXE.SSL]SSL_LIBSSL'LIB32'.OLB
114 $!
115 $! Define The OBJ and EXE Directories.
116 $!
117 $ OBJ_DIR := SYS$DISK:[-.'ARCHD'.OBJ.APPS]
118 $ EXE_DIR := SYS$DISK:[-.'ARCHD'.EXE.APPS]
119 $!
120 $! Specify the destination directory in any /MAP option.
121 $!
122 $ if (LINKMAP .eqs. "MAP")
123 $ then
124 $ LINKMAP = LINKMAP+ "=''EXE_DIR'"
125 $ endif
126 $!
127 $! Add the location prefix to the linker options file name.
128 $!
129 $ if (OPT_FILE .nes. "")
130 $ then
131 $ OPT_FILE = EXE_DIR+ OPT_FILE
132 $ endif
133 $!
134 $! Initialise logical names and such
135 $!
136 $ GOSUB INITIALISE
137 $!
138 $! Tell The User What Kind of Machine We Run On.
139 $!
140 $ WRITE SYS$OUTPUT "Host system architecture: ''ARCHD'"
141 $!
142 $! Check To See If The OBJ Directory Exists.
143 $!
144 $ IF (F$PARSE(OBJ_DIR).EQS."")
145 $ THEN
146 $!
147 $! It Dosen't Exist, So Create It.
148 $!
149 $ CREATE/DIRECTORY 'OBJ_DIR'
150 $!
151 $! End The OBJ Directory Check.
152 $!
153 $ ENDIF
154 $!
155 $! Check To See If The EXE Directory Exists.
156 $!
157 $ IF (F$PARSE(EXE_DIR).EQS."")
158 $ THEN
159 $!
160 $! It Dosen't Exist, So Create It.
161 $!
162 $ CREATE/DIRECTORY 'EXE_DIR'
163 $!
164 $! End The EXE Directory Check.
165 $!
166 $ ENDIF
167 $!
168 $! Check To See If We Have The Proper Libraries.
169 $!
170 $ GOSUB LIB_CHECK
171 $!
172 $! Check To See If We Have A Linker Option File.
173 $!
174 $ GOSUB CHECK_OPT_FILE
175 $!
176 $! Define The Application Files.
177 $! NOTE: Some might think this list ugly. However, it's made this way to
178 $! reflect the E_OBJ variable in Makefile as closely as possible, thereby
179 $! making it fairly easy to verify that the lists are the same.
180 $!
181 $ LIB_OPENSSL = "VERIFY,ASN1PARS,REQ,DGST,DH,DHPARAM,ENC,PASSWD,GENDH,ERRSTR,"+-
182 "CA,PKCS7,CRL2P7,CRL,"+-
183 "RSA,RSAUTL,DSA,DSAPARAM,EC,ECPARAM,"+-
184 "X509,GENRSA,GENDSA,GENPKEY,S_SERVER,S_CLIENT,SPEED,"+-
185 "S_TIME,APPS,S_CB,S_SOCKET,APP_RAND,VERSION,SESS_ID,"+-
186 "CIPHERS,NSEQ,PKCS12,PKCS8,PKEY,PKEYPARAM,PKEYUTL,"+ -
187 "SPKAC,SMIME,CMS,RAND,ENGINE,OCSP,PRIME,TS,SRP"
188 $!
189 $ LIB_OPENSSL = LIB_OPENSSL+ ",VMS_DECC_INIT"
190 $!
191 $ TCPIP_PROGRAMS = ",,"
192 $ IF COMPILER .EQS. "VAXC" THEN -
193 TCPIP_PROGRAMS = ",OPENSSL,"
194 $!
195 $! Setup exceptional compilations
196 $!
197 $ COMPILEWITH_CC2 = ",S_SOCKET,S_SERVER,S_CLIENT,"
198 $!
199 $ PHASE := LIB
200 $!
201 $ RESTART:
202 $!
203 $! Define An App Counter And Set It To "0".
204 $!
205 $ APP_COUNTER = 0
206 $!
207 $! Top Of The App Loop.
208 $!
209 $ NEXT_APP:
210 $!
211 $! Make The Application File Name
212 $!
213 $ CURRENT_APP = F$EDIT(F$ELEMENT(APP_COUNTER,",",PROGRAMS),"TRIM")
214 $!
215 $! Create The Executable File Name.
216 $!
217 $ EXE_FILE = EXE_DIR + CURRENT_APP + ".EXE"
218 $!
219 $! Check To See If We Are At The End Of The File List.
220 $!
221 $ IF (CURRENT_APP.EQS.",")
222 $ THEN
223 $ IF (PHASE.EQS."LIB")
224 $ THEN
225 $ PHASE := APP
226 $ GOTO RESTART
227 $ ELSE
228 $ GOTO APP_DONE
229 $ ENDIF
230 $ ENDIF
231 $!
232 $! Increment The Counter.
233 $!
234 $ APP_COUNTER = APP_COUNTER + 1
235 $!
236 $! Decide if we're building the object files or not.
237 $!
238 $ IF (PHASE.EQS."LIB")
239 $ THEN
240 $!
241 $! Define A Library File Counter And Set It To "-1".
242 $! -1 Means The Application File Name Is To Be Used.
243 $!
244 $ LIB_COUNTER = -1
245 $!
246 $! Create a .OPT file for the object files
247 $!
248 $ OPEN /WRITE OBJECTS 'EXE_DIR''CURRENT_APP'.OPT
249 $!
250 $! Top Of The File Loop.
251 $!
252 $ NEXT_LIB:
253 $!
254 $! O.K, Extract The File Name From The File List.
255 $!
256 $ IF LIB_COUNTER .GE. 0
257 $ THEN
258 $ FILE_NAME = F$EDIT(F$ELEMENT(LIB_COUNTER,",",LIB_'CURRENT_APP'),"TRIM")
259 $ ELSE
260 $ FILE_NAME = CURRENT_APP
261 $ ENDIF
262 $!
263 $! Check To See If We Are At The End Of The File List.
264 $!
265 $ IF (FILE_NAME.EQS.",")
266 $ THEN
267 $ CLOSE OBJECTS
268 $ GOTO NEXT_APP
269 $ ENDIF
270 $!
271 $! Increment The Counter.
272 $!
273 $ LIB_COUNTER = LIB_COUNTER + 1
274 $!
275 $! Create The Source File Name.
276 $!
277 $ SOURCE_FILE = "SYS$DISK:[]" + FILE_NAME + ".C"
278 $!
279 $! Create The Object File Name.
280 $!
281 $ OBJECT_FILE = OBJ_DIR + FILE_NAME + ".OBJ"
282 $ ON WARNING THEN GOTO NEXT_LIB
283 $!
284 $! Check To See If The File We Want To Compile Actually Exists.
285 $!
286 $ IF (F$SEARCH(SOURCE_FILE).EQS."")
287 $ THEN
288 $!
289 $! Tell The User That The File Dosen't Exist.
290 $!
291 $ WRITE SYS$OUTPUT ""
292 $ WRITE SYS$OUTPUT "The File ",SOURCE_FILE," Dosen't Exist."
293 $ WRITE SYS$OUTPUT ""
294 $!
295 $! Exit The Build.
296 $!
297 $ GOTO EXIT
298 $!
299 $! End The File Exist Check.
300 $!
301 $ ENDIF
302 $!
303 $! Tell The User What We Are Building.
304 $!
305 $ IF (PHASE.EQS."LIB")
306 $ THEN
307 $ WRITE SYS$OUTPUT "Compiling The ",FILE_NAME,".C File."
308 $ ELSE
309 $ WRITE SYS$OUTPUT "Building The ",FILE_NAME," Application Program."
310 $ ENDIF
311 $!
312 $! Compile The File.
313 $!
314 $ ON ERROR THEN GOTO NEXT_LIB
315 $ IF COMPILEWITH_CC2 - FILE_NAME .NES. COMPILEWITH_CC2
316 $ THEN
317 $ CC2/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
318 $ ELSE
319 $ CC/OBJECT='OBJECT_FILE' 'SOURCE_FILE'
320 $ ENDIF
321 $ WRITE OBJECTS OBJECT_FILE
322 $!
323 $ GOTO NEXT_LIB
324 $ ENDIF
325 $!
326 $! Check if this program works well without a TCPIP library
327 $!
328 $ IF TCPIP_LIB .EQS. "" .AND. TCPIP_PROGRAMS - CURRENT_APP .NES. TCPIP_PROGRAMS
329 $ THEN
330 $ WRITE SYS$OUTPUT CURRENT_APP," needs a TCP/IP library. Can't link. Skipping..."
331 $ GOTO NEXT_APP
332 $ ENDIF
333 $!
334 $! Link The Program.
335 $!
336 $ ON WARNING THEN GOTO NEXT_APP
337 $!
338 $! Don't Link With The RSAREF Routines And TCP/IP Library.
339 $!
340 $ LINK /'DEBUGGER' /'LINKMAP' /'TRACEBACK' /EXE='EXE_FILE' -
341 'EXE_DIR''CURRENT_APP'.OPT /OPTIONS, -
342 'SSL_LIB' /LIBRARY, -
343 'CRYPTO_LIB' /LIBRARY -
344 'TCPIP_LIB' -
345 'ZLIB_LIB' -
346 ,'OPT_FILE' /OPTIONS
347 $!
348 $! Go Back And Do It Again.
349 $!
350 $ GOTO NEXT_APP
351 $!
352 $! All Done With This File.
353 $!
354 $ APP_DONE:
355 $ EXIT:
356 $!
357 $! All Done, Time To Clean Up And Exit.
358 $!
359 $ GOSUB CLEANUP
360 $ EXIT
361 $!
362 $! Check For The Link Option FIle.
363 $!
364 $ CHECK_OPT_FILE:
365 $!
366 $! Check To See If We Need To Make A VAX C Option File.
367 $!
368 $ IF (COMPILER.EQS."VAXC")
369 $ THEN
370 $!
371 $! Check To See If We Already Have A VAX C Linker Option File.
372 $!
373 $ IF (F$SEARCH(OPT_FILE).EQS."")
374 $ THEN
375 $!
376 $! We Need A VAX C Linker Option File.
377 $!
378 $ CREATE 'OPT_FILE'
379 $DECK
380 !
381 ! Default System Options File To Link Against
382 ! The Sharable VAX C Runtime Library.
383 !
384 SYS$SHARE:VAXCRTL.EXE/SHARE
385 $EOD
386 $!
387 $! End The Option File Check.
388 $!
389 $ ENDIF
390 $!
391 $! End The VAXC Check.
392 $!
393 $ ENDIF
394 $!
395 $! Check To See If We Need A GNU C Option File.
396 $!
397 $ IF (COMPILER.EQS."GNUC")
398 $ THEN
399 $!
400 $! Check To See If We Already Have A GNU C Linker Option File.
401 $!
402 $ IF (F$SEARCH(OPT_FILE).EQS."")
403 $ THEN
404 $!
405 $! We Need A GNU C Linker Option File.
406 $!
407 $ CREATE 'OPT_FILE'
408 $DECK
409 !
410 ! Default System Options File To Link Against
411 ! The Sharable C Runtime Library.
412 !
413 GNU_CC:[000000]GCCLIB/LIBRARY
414 SYS$SHARE:VAXCRTL/SHARE
415 $EOD
416 $!
417 $! End The Option File Check.
418 $!
419 $ ENDIF
420 $!
421 $! End The GNU C Check.
422 $!
423 $ ENDIF
424 $!
425 $! Check To See If We Need A DEC C Option File.
426 $!
427 $ IF (COMPILER.EQS."DECC")
428 $ THEN
429 $!
430 $! Check To See If We Already Have A DEC C Linker Option File.
431 $!
432 $ IF (F$SEARCH(OPT_FILE).EQS."")
433 $ THEN
434 $!
435 $! Figure Out If We Need An AXP Or A VAX Linker Option File.
436 $!
437 $ IF ARCH.EQS."VAX"
438 $ THEN
439 $!
440 $! We Need A DEC C Linker Option File For VAX.
441 $!
442 $ CREATE 'OPT_FILE'
443 $DECK
444 !
445 ! Default System Options File To Link Against
446 ! The Sharable DEC C Runtime Library.
447 !
448 SYS$SHARE:DECC$SHR.EXE/SHARE
449 $EOD
450 $!
451 $! Else...
452 $!
453 $ ELSE
454 $!
455 $! Create The non-VAX Linker Option File.
456 $!
457 $ CREATE 'OPT_FILE'
458 $DECK
459 !
460 ! Default System Options File For non-VAX To Link Against
461 ! The Sharable C Runtime Library.
462 !
463 SYS$SHARE:CMA$OPEN_LIB_SHR/SHARE
464 SYS$SHARE:CMA$OPEN_RTL/SHARE
465 $EOD
466 $!
467 $! End The DEC C Option File Check.
468 $!
469 $ ENDIF
470 $!
471 $! End The Option File Search.
472 $!
473 $ ENDIF
474 $!
475 $! End The DEC C Check.
476 $!
477 $ ENDIF
478 $!
479 $! Tell The User What Linker Option File We Are Using.
480 $!
481 $ WRITE SYS$OUTPUT "Using Linker Option File ",OPT_FILE,"."
482 $!
483 $! Time To RETURN.
484 $!
485 $ RETURN
486 $!
487 $! Check To See If We Have The Appropiate Libraries.
488 $!
489 $ LIB_CHECK:
490 $!
491 $! Look For The Library LIBCRYPTO.OLB.
492 $!
493 $ IF (F$SEARCH(CRYPTO_LIB).EQS."")
494 $ THEN
495 $!
496 $! Tell The User We Can't Find The LIBCRYPTO.OLB Library.
497 $!
498 $ WRITE SYS$OUTPUT ""
499 $ WRITE SYS$OUTPUT "Can't Find The Library ",CRYPTO_LIB,"."
500 $ WRITE SYS$OUTPUT "We Can't Link Without It."
501 $ WRITE SYS$OUTPUT ""
502 $!
503 $! Since We Can't Link Without It, Exit.
504 $!
505 $ EXIT
506 $!
507 $! End The Crypto Library Check.
508 $!
509 $ ENDIF
510 $!
511 $! Look For The Library LIBSSL.OLB.
512 $!
513 $ IF (F$SEARCH(SSL_LIB).EQS."")
514 $ THEN
515 $!
516 $! Tell The User We Can't Find The LIBSSL.OLB Library.
517 $!
518 $ WRITE SYS$OUTPUT ""
519 $ WRITE SYS$OUTPUT "Can't Find The Library ",SSL_LIB,"."
520 $ WRITE SYS$OUTPUT "Some Of The Test Programs Need To Link To It."
521 $ WRITE SYS$OUTPUT ""
522 $!
523 $! Since We Can't Link Without It, Exit.
524 $!
525 $ EXIT
526 $!
527 $! End The SSL Library Check.
528 $!
529 $ ENDIF
530 $!
531 $! Time To Return.
532 $!
533 $ RETURN
534 $!
535 $! Check The User's Options.
536 $!
537 $ CHECK_OPTIONS:
538 $!
539 $! Check To See If P1 Is Blank.
540 $!
541 $ IF (P1.EQS."NODEBUG")
542 $ THEN
543 $!
544 $! P1 Is NODEBUG, So Compile Without Debugger Information.
545 $!
546 $ DEBUGGER = "NODEBUG"
547 $ LINKMAP = "NOMAP"
548 $ TRACEBACK = "NOTRACEBACK"
549 $ GCC_OPTIMIZE = "OPTIMIZE"
550 $ CC_OPTIMIZE = "OPTIMIZE"
551 $ WRITE SYS$OUTPUT "No Debugger Information Will Be Produced During Compile."
552 $ WRITE SYS$OUTPUT "Compiling With Compiler Optimization."
553 $!
554 $! Else...
555 $!
556 $ ELSE
557 $!
558 $! Check To See If We Are To Compile With Debugger Information.
559 $!
560 $ IF (P1.EQS."DEBUG")
561 $ THEN
562 $!
563 $! Compile With Debugger Information.
564 $!
565 $ DEBUGGER = "DEBUG"
566 $ LINKMAP = "MAP"
567 $ TRACEBACK = "TRACEBACK"
568 $ GCC_OPTIMIZE = "NOOPTIMIZE"
569 $ CC_OPTIMIZE = "NOOPTIMIZE"
570 $ WRITE SYS$OUTPUT "Debugger Information Will Be Produced During Compile."
571 $ WRITE SYS$OUTPUT "Compiling Without Compiler Optimization."
572 $ ELSE
573 $!
574 $! Tell The User Entered An Invalid Option.
575 $!
576 $ WRITE SYS$OUTPUT ""
577 $ WRITE SYS$OUTPUT "The Option ",P1," Is Invalid. The Valid Options Are:"
578 $ WRITE SYS$OUTPUT ""
579 $ WRITE SYS$OUTPUT " DEBUG : Compile With The Debugger Information."
580 $ WRITE SYS$OUTPUT " NODEBUG : Compile Without The Debugger Information."
581 $ WRITE SYS$OUTPUT ""
582 $!
583 $! Time To EXIT.
584 $!
585 $ EXIT
586 $!
587 $! End The Valid Argument Check.
588 $!
589 $ ENDIF
590 $!
591 $! End The P1 Check.
592 $!
593 $ ENDIF
594 $!
595 $! Check P6 (POINTER_SIZE).
596 $!
597 $ IF (P6 .NES. "") .AND. (ARCH .NES. "VAX")
598 $ THEN
599 $!
600 $ IF (P6 .EQS. "32")
601 $ THEN
602 $ POINTER_SIZE = " /POINTER_SIZE=32"
603 $ ELSE
604 $ POINTER_SIZE = F$EDIT( P6, "COLLAPSE, UPCASE")
605 $ IF ((POINTER_SIZE .EQS. "64") .OR. -
606 (POINTER_SIZE .EQS. "64=") .OR. -
607 (POINTER_SIZE .EQS. "64=ARGV"))
608 $ THEN
609 $ ARCHD = ARCH+ "_64"
610 $ LIB32 = ""
611 $ IF (F$EXTRACT( 2, 1, POINTER_SIZE) .EQS. "=")
612 $ THEN
613 $! Explicit user choice: "64" or "64=ARGV".
614 $ IF (POINTER_SIZE .EQS. "64=") THEN POINTER_SIZE = "64"
615 $ ELSE
616 $ SET NOON
617 $ DEFINE /USER_MODE SYS$OUTPUT NL:
618 $ DEFINE /USER_MODE SYS$ERROR NL:
619 $ CC /NOLIST /NOOBJECT /POINTER_SIZE=64=ARGV NL:
620 $ IF ($STATUS .AND. %X0FFF0000) .EQ. %X00030000
621 $ THEN
622 $ ! If we got here, it means DCL complained like this:
623 $ ! %DCL-W-NOVALU, value not allowed - remove value specification
624 $ ! \64=\
625 $ !
626 $ ! If the compiler was run, logicals defined in /USER would
627 $ ! have been deassigned automatically. However, when DCL
628 $ ! complains, they aren't, so we do it here (it might be
629 $ ! unnecessary, but just in case there will be another error
630 $ ! message further on that we don't want to miss)
631 $ DEASSIGN /USER_MODE SYS$ERROR
632 $ DEASSIGN /USER_MODE SYS$OUTPUT
633 $ ELSE
634 $ POINTER_SIZE = POINTER_SIZE + "=ARGV"
635 $ ENDIF
636 $ SET ON
637 $ ENDIF
638 $ POINTER_SIZE = " /POINTER_SIZE=''POINTER_SIZE'"
639 $!
640 $ ELSE
641 $!
642 $! Tell The User Entered An Invalid Option.
643 $!
644 $ WRITE SYS$OUTPUT ""
645 $ WRITE SYS$OUTPUT "The Option ", P6, -
646 " Is Invalid. The Valid Options Are:"
647 $ WRITE SYS$OUTPUT ""
648 $ WRITE SYS$OUTPUT -
649 " """" : Compile with default (short) pointers."
650 $ WRITE SYS$OUTPUT -
651 " 32 : Compile with 32-bit (short) pointers."
652 $ WRITE SYS$OUTPUT -
653 " 64 : Compile with 64-bit (long) pointers (auto ARGV)."
654 $ WRITE SYS$OUTPUT -
655 " 64= : Compile with 64-bit (long) pointers (no ARGV)."
656 $ WRITE SYS$OUTPUT -
657 " 64=ARGV : Compile with 64-bit (long) pointers (ARGV)."
658 $ WRITE SYS$OUTPUT ""
659 $!
660 $! Time To EXIT.
661 $!
662 $ EXIT
663 $!
664 $ ENDIF
665 $!
666 $ ENDIF
667 $!
668 $! End The P6 (POINTER_SIZE) Check.
669 $!
670 $ ENDIF
671 $!
672 $! Set basic C compiler /INCLUDE directories.
673 $!
674 $ CC_INCLUDES = "SYS$DISK:[-],SYS$DISK:[-.CRYPTO]"
675 $!
676 $! Check To See If P2 Is Blank.
677 $!
678 $ IF (P2.EQS."")
679 $ THEN
680 $!
681 $! O.K., The User Didn't Specify A Compiler, Let's Try To
682 $! Find Out Which One To Use.
683 $!
684 $! Check To See If We Have GNU C.
685 $!
686 $ IF (F$TRNLNM("GNU_CC").NES."")
687 $ THEN
688 $!
689 $! Looks Like GNUC, Set To Use GNUC.
690 $!
691 $ P2 = "GNUC"
692 $!
693 $! Else...
694 $!
695 $ ELSE
696 $!
697 $! Check To See If We Have VAXC Or DECC.
698 $!
699 $ IF (ARCH.NES."VAX").OR.(F$TRNLNM("DECC$CC_DEFAULT").NES."")
700 $ THEN
701 $!
702 $! Looks Like DECC, Set To Use DECC.
703 $!
704 $ P2 = "DECC"
705 $!
706 $! Else...
707 $!
708 $ ELSE
709 $!
710 $! Looks Like VAXC, Set To Use VAXC.
711 $!
712 $ P2 = "VAXC"
713 $!
714 $! End The VAXC Compiler Check.
715 $!
716 $ ENDIF
717 $!
718 $! End The DECC & VAXC Compiler Check.
719 $!
720 $ ENDIF
721 $!
722 $! End The Compiler Check.
723 $!
724 $ ENDIF
725 $!
726 $! Check To See If We Have A Option For P3.
727 $!
728 $ IF (P3.EQS."")
729 $ THEN
730 $!
731 $! Find out what socket library we have available
732 $!
733 $ IF F$PARSE("SOCKETSHR:") .NES. ""
734 $ THEN
735 $!
736 $! We have SOCKETSHR, and it is my opinion that it's the best to use.
737 $!
738 $ P3 = "SOCKETSHR"
739 $!
740 $! Tell the user
741 $!
742 $ WRITE SYS$OUTPUT "Using SOCKETSHR for TCP/IP"
743 $!
744 $! Else, let's look for something else
745 $!
746 $ ELSE
747 $!
748 $! Like UCX (the reason to do this before Multinet is that the UCX
749 $! emulation is easier to use...)
750 $!
751 $ IF F$TRNLNM("UCX$IPC_SHR") .NES. "" -
752 .OR. F$PARSE("SYS$SHARE:UCX$IPC_SHR.EXE") .NES. "" -
753 .OR. F$PARSE("SYS$LIBRARY:UCX$IPC.OLB") .NES. ""
754 $ THEN
755 $!
756 $! Last resort: a UCX or UCX-compatible library
757 $!
758 $ P3 = "UCX"
759 $!
760 $! Tell the user
761 $!
762 $ WRITE SYS$OUTPUT "Using UCX or an emulation thereof for TCP/IP"
763 $!
764 $! That was all...
765 $!
766 $ ENDIF
767 $ ENDIF
768 $ ENDIF
769 $!
770 $! Set Up Initial CC Definitions, Possibly With User Ones
771 $!
772 $ CCDEFS = "MONOLITH"
773 $ IF F$TYPE(USER_CCDEFS) .NES. "" THEN CCDEFS = CCDEFS + "," + USER_CCDEFS
774 $ CCEXTRAFLAGS = ""
775 $ IF F$TYPE(USER_CCFLAGS) .NES. "" THEN CCEXTRAFLAGS = USER_CCFLAGS
776 $ CCDISABLEWARNINGS = "" !!! "MAYLOSEDATA3" !!! "LONGLONGTYPE,LONGLONGSUFX,FOUNDCR"
777 $ IF F$TYPE(USER_CCDISABLEWARNINGS) .NES. ""
778 $ THEN
779 $ IF CCDISABLEWARNINGS .NES. "" THEN CCDISABLEWARNINGS = CCDISABLEWARNINGS + ","
780 $ CCDISABLEWARNINGS = CCDISABLEWARNINGS + USER_CCDISABLEWARNINGS
781 $ ENDIF
782 $!
783 $! Check To See If We Have A ZLIB Option.
784 $!
785 $ ZLIB = P7
786 $ IF (ZLIB .NES. "")
787 $ THEN
788 $!
789 $! Check for expected ZLIB files.
790 $!
791 $ err = 0
792 $ file1 = f$parse( "zlib.h", ZLIB, , , "SYNTAX_ONLY")
793 $ if (f$search( file1) .eqs. "")
794 $ then
795 $ WRITE SYS$OUTPUT ""
796 $ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid."
797 $ WRITE SYS$OUTPUT " Can't find header: ''file1'"
798 $ err = 1
799 $ endif
800 $ file1 = f$parse( "A.;", ZLIB)- "A.;"
801 $!
802 $ file2 = f$parse( ZLIB, "libz.olb", , , "SYNTAX_ONLY")
803 $ if (f$search( file2) .eqs. "")
804 $ then
805 $ if (err .eq. 0)
806 $ then
807 $ WRITE SYS$OUTPUT ""
808 $ WRITE SYS$OUTPUT "The Option ", ZLIB, " Is Invalid."
809 $ endif
810 $ WRITE SYS$OUTPUT " Can't find library: ''file2'"
811 $ WRITE SYS$OUTPUT ""
812 $ err = err+ 2
813 $ endif
814 $ if (err .eq. 1)
815 $ then
816 $ WRITE SYS$OUTPUT ""
817 $ endif
818 $!
819 $ if (err .ne. 0)
820 $ then
821 $ EXIT
822 $ endif
823 $!
824 $ CCDEFS = """ZLIB=1"", "+ CCDEFS
825 $ CC_INCLUDES = CC_INCLUDES+ ", "+ file1
826 $ ZLIB_LIB = ", ''file2' /library"
827 $!
828 $! Print info
829 $!
830 $ WRITE SYS$OUTPUT "ZLIB library spec: ", file2
831 $!
832 $! End The ZLIB Check.
833 $!
834 $ ENDIF
835 $!
836 $! Check To See If The User Entered A Valid Parameter.
837 $!
838 $ IF (P2.EQS."VAXC").OR.(P2.EQS."DECC").OR.(P2.EQS."GNUC")
839 $ THEN
840 $!
841 $! Check To See If The User Wanted DECC.
842 $!
843 $ IF (P2.EQS."DECC")
844 $ THEN
845 $!
846 $! Looks Like DECC, Set To Use DECC.
847 $!
848 $ COMPILER = "DECC"
849 $!
850 $! Tell The User We Are Using DECC.
851 $!
852 $ WRITE SYS$OUTPUT "Using DECC 'C' Compiler."
853 $!
854 $! Use DECC...
855 $!
856 $ CC = "CC"
857 $ IF ARCH.EQS."VAX" .AND. F$TRNLNM("DECC$CC_DEFAULT").NES."/DECC" -
858 THEN CC = "CC/DECC"
859 $ CC = CC + " /''CC_OPTIMIZE' /''DEBUGGER' /STANDARD=RELAXED"+ -
860 "''POINTER_SIZE' /NOLIST /PREFIX=ALL" + -
861 " /INCLUDE=(''CC_INCLUDES') " + CCEXTRAFLAGS
862 $!
863 $! Define The Linker Options File Name.
864 $!
865 $ OPT_FILE = "VAX_DECC_OPTIONS.OPT"
866 $!
867 $! End DECC Check.
868 $!
869 $ ENDIF
870 $!
871 $! Check To See If We Are To Use VAXC.
872 $!
873 $ IF (P2.EQS."VAXC")
874 $ THEN
875 $!
876 $! Looks Like VAXC, Set To Use VAXC.
877 $!
878 $ COMPILER = "VAXC"
879 $!
880 $! Tell The User We Are Using VAX C.
881 $ WRITE SYS$OUTPUT "Using VAXC 'C' Compiler."
882 $!
883 $! Compile Using VAXC.
884 $!
885 $ CC = "CC"
886 $ IF ARCH.NES."VAX"
887 $ THEN
888 $ WRITE SYS$OUTPUT "There is no VAX C on ''ARCH'!"
889 $ EXIT
890 $ ENDIF
891 $ IF F$TRNLNM("DECC$CC_DEFAULT").EQS."/DECC" THEN CC = "CC/VAXC"
892 $ CC = CC + "/''CC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
893 "/INCLUDE=(''CC_INCLUDES')" + CCEXTRAFLAGS
894 $ CCDEFS = CCDEFS + ",""VAXC"""
895 $!
896 $! Define <sys> As SYS$COMMON:[SYSLIB]
897 $!
898 $ DEFINE/NOLOG SYS SYS$COMMON:[SYSLIB]
899 $!
900 $! Define The Linker Options File Name.
901 $!
902 $ OPT_FILE = "VAX_VAXC_OPTIONS.OPT"
903 $!
904 $! End VAXC Check
905 $!
906 $ ENDIF
907 $!
908 $! Check To See If We Are To Use GNU C.
909 $!
910 $ IF (P2.EQS."GNUC")
911 $ THEN
912 $!
913 $! Looks Like GNUC, Set To Use GNUC.
914 $!
915 $ COMPILER = "GNUC"
916 $!
917 $! Tell The User We Are Using GNUC.
918 $!
919 $ WRITE SYS$OUTPUT "Using GNU 'C' Compiler."
920 $!
921 $! Use GNU C...
922 $!
923 $ IF F$TYPE(GCC) .EQS. "" THEN GCC := GCC
924 $ CC = GCC+"/NOCASE_HACK/''GCC_OPTIMIZE'/''DEBUGGER'/NOLIST" + -
925 "/INCLUDE=(''CC_INCLUDES')" + CCEXTRAFLAGS
926 $!
927 $! Define The Linker Options File Name.
928 $!
929 $ OPT_FILE = "VAX_GNUC_OPTIONS.OPT"
930 $!
931 $! End The GNU C Check.
932 $!
933 $ ENDIF
934 $!
935 $! Set up default defines
936 $!
937 $ CCDEFS = """FLAT_INC=1""," + CCDEFS
938 $!
939 $! Else The User Entered An Invalid Argument.
940 $!
941 $ ELSE
942 $!
943 $! Tell The User We Don't Know What They Want.
944 $!
945 $ WRITE SYS$OUTPUT ""
946 $ WRITE SYS$OUTPUT "The Option ",P2," Is Invalid. The Valid Options Are:"
947 $ WRITE SYS$OUTPUT ""
948 $ WRITE SYS$OUTPUT " VAXC : To Compile With VAX C."
949 $ WRITE SYS$OUTPUT " DECC : To Compile With DEC C."
950 $ WRITE SYS$OUTPUT " GNUC : To Compile With GNU C."
951 $ WRITE SYS$OUTPUT ""
952 $!
953 $! Time To EXIT.
954 $!
955 $ EXIT
956 $ ENDIF
957 $!
958 $! Time to check the contents, and to make sure we get the correct library.
959 $!
960 $ IF P3.EQS."SOCKETSHR" .OR. P3.EQS."MULTINET" .OR. P3.EQS."UCX" -
961 .OR. P3.EQS."TCPIP" .OR. P3.EQS."NONE"
962 $ THEN
963 $!
964 $! Check to see if SOCKETSHR was chosen
965 $!
966 $ IF P3.EQS."SOCKETSHR"
967 $ THEN
968 $!
969 $! Set the library to use SOCKETSHR
970 $!
971 $ TCPIP_LIB = ",SYS$DISK:[-.VMS]SOCKETSHR_SHR.OPT /OPTIONS"
972 $!
973 $! Done with SOCKETSHR
974 $!
975 $ ENDIF
976 $!
977 $! Check to see if MULTINET was chosen
978 $!
979 $ IF P3.EQS."MULTINET"
980 $ THEN
981 $!
982 $! Set the library to use UCX emulation.
983 $!
984 $ P3 = "UCX"
985 $!
986 $! Done with MULTINET
987 $!
988 $ ENDIF
989 $!
990 $! Check to see if UCX was chosen
991 $!
992 $ IF P3.EQS."UCX"
993 $ THEN
994 $!
995 $! Set the library to use UCX.
996 $!
997 $ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC.OPT /OPTIONS"
998 $ IF F$TRNLNM("UCX$IPC_SHR") .NES. ""
999 $ THEN
1000 $ TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_DECC_LOG.OPT /OPTIONS"
1001 $ ELSE
1002 $ IF COMPILER .NES. "DECC" .AND. ARCH .EQS. "VAX" THEN -
1003 TCPIP_LIB = ",SYS$DISK:[-.VMS]UCX_SHR_VAXC.OPT /OPTIONS"
1004 $ ENDIF
1005 $!
1006 $! Done with UCX
1007 $!
1008 $ ENDIF
1009 $!
1010 $! Check to see if TCPIP (post UCX) was chosen
1011 $!
1012 $ IF P3.EQS."TCPIP"
1013 $ THEN
1014 $!
1015 $! Set the library to use TCPIP.
1016 $!
1017 $ TCPIP_LIB = ",SYS$DISK:[-.VMS]TCPIP_SHR_DECC.OPT /OPTIONS"
1018 $!
1019 $! Done with TCPIP
1020 $!
1021 $ ENDIF
1022 $!
1023 $! Check to see if NONE was chosen
1024 $!
1025 $ IF P3.EQS."NONE"
1026 $ THEN
1027 $!
1028 $! Do not use TCPIP.
1029 $!
1030 $ TCPIP_LIB = ""
1031 $!
1032 $! Done with TCPIP
1033 $!
1034 $ ENDIF
1035 $!
1036 $! Add TCP/IP type to CC definitions.
1037 $!
1038 $ CCDEFS = CCDEFS + ",TCPIP_TYPE_''P3'"
1039 $!
1040 $! Print info
1041 $!
1042 $ WRITE SYS$OUTPUT "TCP/IP library spec: ", TCPIP_LIB- ","
1043 $!
1044 $! Else The User Entered An Invalid Argument.
1045 $!
1046 $ ELSE
1047 $!
1048 $! Tell The User We Don't Know What They Want.
1049 $!
1050 $ WRITE SYS$OUTPUT ""
1051 $ WRITE SYS$OUTPUT "The Option ",P3," Is Invalid. The Valid Options Are:"
1052 $ WRITE SYS$OUTPUT ""
1053 $ WRITE SYS$OUTPUT " SOCKETSHR : To link with SOCKETSHR TCP/IP library."
1054 $ WRITE SYS$OUTPUT " UCX : To link with UCX TCP/IP library."
1055 $ WRITE SYS$OUTPUT " TCPIP : To link with TCPIP (post UCX) TCP/IP library."
1056 $ WRITE SYS$OUTPUT ""
1057 $!
1058 $! Time To EXIT.
1059 $!
1060 $ EXIT
1061 $!
1062 $! Done with TCP/IP libraries
1063 $!
1064 $ ENDIF
1065 $!
1066 $! Finish up the definition of CC.
1067 $!
1068 $ IF COMPILER .EQS. "DECC"
1069 $ THEN
1070 $! Not all compiler versions support MAYLOSEDATA3.
1071 $ OPT_TEST = "MAYLOSEDATA3"
1072 $ DEFINE /USER_MODE SYS$ERROR NL:
1073 $ DEFINE /USER_MODE SYS$OUTPUT NL:
1074 $ 'CC' /NOCROSS_REFERENCE /NOLIST /NOOBJECT -
1075 /WARNINGS = DISABLE = ('OPT_TEST', EMPTYFILE) NL:
1076 $ IF ($SEVERITY)
1077 $ THEN
1078 $ IF CCDISABLEWARNINGS .NES. "" THEN -
1079 CCDISABLEWARNINGS = CCDISABLEWARNINGS+ ","
1080 $ CCDISABLEWARNINGS = CCDISABLEWARNINGS+ OPT_TEST
1081 $ ENDIF
1082 $ IF CCDISABLEWARNINGS .NES. ""
1083 $ THEN
1084 $ CCDISABLEWARNINGS = " /WARNING=(DISABLE=(" + CCDISABLEWARNINGS + "))"
1085 $ ENDIF
1086 $ ELSE
1087 $ CCDISABLEWARNINGS = ""
1088 $ ENDIF
1089 $ CC2 = CC + " /DEFINE=(" + CCDEFS + ",_POSIX_C_SOURCE)" + CCDISABLEWARNINGS
1090 $ CC = CC + " /DEFINE=(" + CCDEFS + ")" + CCDISABLEWARNINGS
1091 $!
1092 $! Show user the result
1093 $!
1094 $ WRITE/SYMBOL SYS$OUTPUT "Main Compiling Command: ",CC
1095 $!
1096 $! Special Threads For OpenVMS v7.1 Or Later
1097 $!
1098 $! Written By: Richard Levitte
1099 $! richard@levitte.org
1100 $!
1101 $!
1102 $! Check To See If We Have A Option For P4.
1103 $!
1104 $ IF (P4.EQS."")
1105 $ THEN
1106 $!
1107 $! Get The Version Of VMS We Are Using.
1108 $!
1109 $ ISSEVEN :=
1110 $ TMP = F$ELEMENT(0,"-",F$EXTRACT(1,4,F$GETSYI("VERSION")))
1111 $ TMP = F$INTEGER(F$ELEMENT(0,".",TMP)+F$ELEMENT(1,".",TMP))
1112 $!
1113 $! Check To See If The VMS Version Is v7.1 Or Later.
1114 $!
1115 $ IF (TMP.GE.71)
1116 $ THEN
1117 $!
1118 $! We Have OpenVMS v7.1 Or Later, So Use The Special Threads.
1119 $!
1120 $ ISSEVEN := ,PTHREAD_USE_D4
1121 $!
1122 $! End The VMS Version Check.
1123 $!
1124 $ ENDIF
1125 $!
1126 $! End The P4 Check.
1127 $!
1128 $ ENDIF
1129 $!
1130 $! Check if the user wanted to compile just a subset of all the programs.
1131 $!
1132 $ IF P5 .NES. ""
1133 $ THEN
1134 $ PROGRAMS = P5
1135 $ ENDIF
1136 $!
1137 $! Time To RETURN...
1138 $!
1139 $ RETURN
1140 $!
1141 $ INITIALISE:
1142 $!
1143 $! Save old value of the logical name OPENSSL
1144 $!
1145 $ __SAVE_OPENSSL = F$TRNLNM("OPENSSL","LNM$PROCESS_TABLE")
1146 $!
1147 $! Save directory information
1148 $!
1149 $ __HERE = F$PARSE(F$PARSE("A.;",F$ENVIRONMENT("PROCEDURE"))-"A.;","[]A.;") - "A.;"
1150 $ __HERE = F$EDIT(__HERE,"UPCASE")
1151 $ __TOP = __HERE - "APPS]"
1152 $ __INCLUDE = __TOP + "INCLUDE.OPENSSL]"
1153 $!
1154 $! Set up the logical name OPENSSL to point at the include directory
1155 $!
1156 $ DEFINE OPENSSL /NOLOG '__INCLUDE'
1157 $!
1158 $! Done
1159 $!
1160 $ RETURN
1161 $!
1162 $ CLEANUP:
1163 $!
1164 $! Restore the saved logical name OPENSSL, if it had a value.
1165 $!
1166 $ if (f$type( __SAVE_OPENSSL) .nes. "")
1167 $ then
1168 $ IF __SAVE_OPENSSL .EQS. ""
1169 $ THEN
1170 $ DEASSIGN OPENSSL
1171 $ ELSE
1172 $ DEFINE /NOLOG OPENSSL '__SAVE_OPENSSL'
1173 $ ENDIF
1174 $ endif
1175 $!
1176 $! Close any open files.
1177 $!
1178 $ if (f$trnlnm( "objects", "LNM$PROCESS", 0, "SUPERVISOR") .nes. "") then -
1179 close objects
1180 $!
1181 $! Done
1182 $!
1183 $ RETURN
1184 $!