~ubuntu-branches/ubuntu/intrepid/unzip/intrepid

« back to all changes in this revision

Viewing changes to vms/link_unz.com

  • Committer: Bazaar Package Importer
  • Author(s): Santiago Vila
  • Date: 2004-06-06 17:57:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040606175746-nl7p2dgp3aobyc2c
Tags: upstream-5.51
ImportĀ upstreamĀ versionĀ 5.51

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
$ ! LINK_UNZ.COM
 
2
$ !
 
3
$ !     Command procedure to (re)link the VMS versions of
 
4
$ !     UnZip/ZipInfo and UnZipSFX
 
5
$ !
 
6
$ !     last updated:  13 February 2001
 
7
$ !
 
8
$ !     Command args:
 
9
$ !     - select compiler environment: "VAXC", "DECC", "GNUC"
 
10
$ !     - select installation of CLI interface version of unzip:
 
11
$ !       "VMSCLI" or "CLI"
 
12
$ !     - force installation of UNIX interface version of unzip
 
13
$ !       (override LOCAL_UNZIP environment): "NOVMSCLI" or "NOCLI"
 
14
$ !
 
15
$ !
 
16
$ on error then goto error
 
17
$ on control_y then goto error
 
18
$ OLD_VERIFY = f$verify(0)
 
19
$!
 
20
$ say := write sys$output
 
21
$!##################### Read settings from environment ########################
 
22
$!
 
23
$ if f$type(LOCAL_UNZIP).eqs.""
 
24
$ then
 
25
$       local_unzip = ""
 
26
$ else  ! Trim blanks and append comma if missing
 
27
$       local_unzip = f$edit(local_unzip, "TRIM")
 
28
$       if f$extract(f$length(local_unzip)-1, 1, local_unzip).nes."," then -
 
29
                local_unzip = local_unzip + ","
 
30
$ endif
 
31
$! Check for the presence of "VMSCLI" in local_unzip. If yes, we will define
 
32
$! the foreign command for "unzip" to use the executable containing the
 
33
$! CLI interface.
 
34
$ pos_cli = f$locate("VMSCLI",local_unzip)
 
35
$ len_local_unzip = f$length(local_unzip)
 
36
$ if pos_cli.ne.len_local_unzip
 
37
$ then
 
38
$   CLI_IS_DEFAULT = 1
 
39
$   ! Remove "VMSCLI" macro from local_unzip. The UnZip executable including
 
40
$   ! the CLI interface is now created unconditionally.
 
41
$   local_unzip = f$extract(0, pos_cli, local_unzip) + -
 
42
$               f$extract(pos_cli+7, len_local_unzip-(pos_cli+7), local_unzip)
 
43
$ else
 
44
$   CLI_IS_DEFAULT = 0
 
45
$ endif
 
46
$ delete/symbol/local pos_cli
 
47
$ delete/symbol/local len_local_unzip
 
48
$!##################### Customizing section #############################
 
49
$!
 
50
$ unzx_unx = "unzip"
 
51
$ unzx_cli = "unzip_cli"
 
52
$ unzsfx_unx = "unzipsfx"
 
53
$ unzsfx_cli = "unzipsfx_cli"
 
54
$!
 
55
$ MAY_USE_DECC = 1
 
56
$ MAY_USE_GNUC = 0
 
57
$!
 
58
$! Process command line parameters requesting optional features:
 
59
$ arg_cnt = 1
 
60
$ argloop:
 
61
$  current_arg_name = "P''arg_cnt'"
 
62
$  curr_arg = f$edit('current_arg_name',"UPCASE")
 
63
$  IF curr_arg .eqs. "" THEN GOTO argloop_out
 
64
$  IF curr_arg .eqs. "VAXC"
 
65
$  THEN MAY_USE_DECC = 0
 
66
$    MAY_USE_GNUC = 0
 
67
$  ENDIF
 
68
$  IF curr_arg .eqs. "DECC"
 
69
$  THEN MAY_USE_DECC = 1
 
70
$    MAY_USE_GNUC = 0
 
71
$  ENDIF
 
72
$  IF curr_arg .eqs. "GNUC"
 
73
$  THEN MAY_USE_DECC = 0
 
74
$    MAY_USE_GNUC = 1
 
75
$  ENDIF
 
76
$  IF (curr_arg .eqs. "VMSCLI") .or. (curr_arg .eqs. "CLI")
 
77
$  THEN
 
78
$    CLI_IS_DEFAULT = 1
 
79
$  ENDIF
 
80
$  IF (curr_arg .eqs. "NOVMSCLI") .or. (curr_arg .eqs. "NOCLI")
 
81
$  THEN
 
82
$    CLI_IS_DEFAULT = 0
 
83
$  ENDIF
 
84
$  arg_cnt = arg_cnt + 1
 
85
$ GOTO argloop
 
86
$ argloop_out:
 
87
$!
 
88
$ if CLI_IS_DEFAULT
 
89
$ then
 
90
$       UNZEXEC = unzx_cli
 
91
$ else
 
92
$       UNZEXEC = unzx_unx
 
93
$ endif
 
94
$!
 
95
$!#######################################################################
 
96
$!
 
97
$ ! Find out current disk, directory, compiler and options
 
98
$ !
 
99
$ my_name = f$env("procedure")
 
100
$ workdir = f$env("default")
 
101
$ here = f$parse(workdir,,,"device") + f$parse(workdir,,,"directory")
 
102
$ axp = f$getsyi("HW_MODEL").ge.1024
 
103
$ if axp
 
104
$ then
 
105
$       ! Alpha AXP
 
106
$       ARCH_NAME == "Alpha"
 
107
$       ARCH_PREF = "AXP_"
 
108
$       HAVE_DECC_VAX = 0
 
109
$       USE_DECC_VAX = 0
 
110
$       IF (f$search("SYS$DISK:[]UNZIP.''ARCH_PREF'OLB").eqs."")
 
111
$       THEN
 
112
$         say "Cannot find any AXP object library for UnZip."
 
113
$         say "  You must keep all binary files of the object distribution"
 
114
$         say "  in the current directory !"
 
115
$         goto error
 
116
$       ENDIF
 
117
$       if MAY_USE_GNUC
 
118
$       then say "GNU C has not yet been ported to OpenVMS AXP."
 
119
$            say "You must use DEC C to build UnZip."
 
120
$            goto error
 
121
$       endif
 
122
$       ARCH_CC_P = ARCH_PREF
 
123
$       opts = ""
 
124
$       say "Linking on AXP using DEC C"
 
125
$ else
 
126
$       ! VAX
 
127
$       ARCH_NAME == "VAX"
 
128
$       ARCH_PREF = "VAX_"
 
129
$       ! check which object libraries are present:
 
130
$       HAVE_DECC_VAX = -
 
131
                (f$search("SYS$DISK:[]UNZIP.''ARCH_PREF'DECC_OLB").nes."")
 
132
$       HAVE_VAXC_VAX = -
 
133
                (f$search("SYS$DISK:[]UNZIP.''ARCH_PREF'VAXC_OLB").nes."")
 
134
$       HAVE_GNUC_VAX = -
 
135
                (f$search("SYS$DISK:[]UNZIP.''ARCH_PREF'GNUC_OLB").nes."")
 
136
$       IF .not.HAVE_DECC_VAX .and. .not.HAVE_VAXC_VAX .and. .not.HAVE_GNUC_VAX
 
137
$       THEN
 
138
$         say "Cannot find any VAX object library for UnZip."
 
139
$         say "  You must keep all binary files of the object distribution"
 
140
$         say "  in the current directory !"
 
141
$         goto error
 
142
$       ENDIF
 
143
$       IF HAVE_DECC_VAX .AND. MAY_USE_DECC
 
144
$       THEN
 
145
$         ! We use DECC:
 
146
$         USE_DECC_VAX = 1
 
147
$         ARCH_CC_P = "''ARCH_PREF'DECC_"
 
148
$         opts = ""
 
149
$         say "Linking on VAX using DEC C"
 
150
$       ELSE
 
151
$         ! We use VAXC (or GNU C):
 
152
$         USE_DECC_VAX = 0
 
153
$         opts = ",SYS$DISK:[.VMS]VAXCSHR.OPT/OPTIONS"
 
154
$         if HAVE_GNUC_VAX .and. (.not.HAVE_VAXC_VAX .or. MAY_USE_GNUC)
 
155
$         then
 
156
$               ARCH_CC_P = "''ARCH_PREF'GNUC_"
 
157
$               opts = ",GNU_CC:[000000]GCCLIB.OLB/LIB ''opts'"
 
158
$               say "Linking on VAX using GNU C"
 
159
$         else
 
160
$               ARCH_CC_P = "''ARCH_PREF'VAXC_"
 
161
$               say "Linking on VAX using VAX C"
 
162
$         endif
 
163
$       ENDIF
 
164
$ endif
 
165
$ LFLAGS = "/notrace"
 
166
$ if (opts .nes. "") .and. (f$search("[.vms]vaxcshr.opt") .eqs. "")
 
167
$ then  create [.vms]vaxcshr.opt
 
168
$       open/append tmp [.vms]vaxcshr.opt
 
169
$       write tmp "SYS$SHARE:VAXCRTL.EXE/SHARE"
 
170
$       close tmp
 
171
$ endif
 
172
$ tmp = f$verify(1)     ! Turn echo on to see what's happening
 
173
$ !
 
174
$ link'LFLAGS'/exe='unzx_unx'.'ARCH_CC_P'exe -
 
175
        unzip.'ARCH_CC_P'olb;/incl=(unzip)/lib -
 
176
        'opts', [.VMS]unzip.opt/opt
 
177
$ !
 
178
$ link'LFLAGS'/exe='unzx_cli'.'ARCH_CC_P'exe -
 
179
        unzipcli.'ARCH_CC_P'olb;/incl=(unzip)/lib, -
 
180
        unzip.'ARCH_CC_P'olb;/lib -
 
181
        'opts', [.VMS]unzip.opt/opt
 
182
$ !
 
183
$ link'LFLAGS'/exe='unzsfx_unx'.'ARCH_CC_P'exe -
 
184
        unzipsfx.'ARCH_CC_P'olb;/lib/incl=unzip -
 
185
        'opts', [.VMS]unzipsfx.opt/opt
 
186
$ !
 
187
$ link'LFLAGS'/exe='unzsfx_cli'.'ARCH_CC_P'exe -
 
188
        unzsxcli.'ARCH_CC_P'olb;/lib/incl=unzip, -
 
189
        unzipsfx.'ARCH_CC_P'olb;/lib -
 
190
        'opts', [.VMS]unzipsfx.opt/opt
 
191
$ !
 
192
$ ! Next line:  put similar lines (full pathname for unzip.'ARCH_CC_P'exe) in
 
193
$ ! login.com.  Remember to include the leading "$" before disk name.
 
194
$ !
 
195
$ unzip   == "$''here'''UNZEXEC'.''ARCH_CC_P'exe"
 
196
$ zipinfo == "$''here'''UNZEXEC'.''ARCH_CC_P'exe ""-Z"""
 
197
$ !
 
198
$error:
 
199
$ tmp = f$verify(OLD_VERIFY)
 
200
$ exit