Commit | Line | Data |
---|---|---|
4b0dd31c KR |
1 | $! |
2 | $! This file sets things up to build gas on a VMS system to generate object | |
3 | $! files for a VMS system. We do not use the configure script, since we | |
4 | $! do not have /bin/sh to execute it. | |
5 | $! | |
4b0dd31c KR |
6 | $! |
7 | $gas_host="vms" | |
8 | $! | |
396e8d7f ILT |
9 | $arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2 |
10 | $arch = f$element(arch_indx,"|","|VAX|Alpha|") | |
11 | $if arch .eqs. "VAX" | |
12 | $then | |
4b0dd31c | 13 | $cpu_type="vax" |
4b0dd31c KR |
14 | $obj_format="vms" |
15 | $atof="vax" | |
396e8d7f ILT |
16 | $else |
17 | $ cpu_type="alpha" | |
18 | $ obj_format="evax" | |
19 | $ atof="ieee" | |
20 | $endif | |
21 | $ | |
22 | $emulation="generic" | |
4b0dd31c | 23 | $! |
fd4b1131 KR |
24 | $ DELETE = "delete/noConfirm" |
25 | $ ECHO = "write sys$output" | |
4b0dd31c KR |
26 | $! |
27 | $! Target specific information | |
28 | $call link targ-cpu.c [.config]tc-'cpu_type'.c | |
29 | $call link targ-cpu.h [.config]tc-'cpu_type'.h | |
30 | $call link targ-env.h [.config]te-'emulation'.h | |
31 | $! | |
32 | $! Code to handle the object file format. | |
33 | $call link obj-format.h [.config]obj-'obj_format'.h | |
34 | $call link obj-format.c [.config]obj-'obj_format'.c | |
35 | $! | |
36 | $! Code to handle floating point. | |
37 | $call link atof-targ.c [.config]atof-'atof'.c | |
38 | $! | |
39 | $! | |
fd4b1131 | 40 | $! Create the file version.opt, which helps identify the executable. |
4b0dd31c | 41 | $! |
fd4b1131 | 42 | $if f$trnlnm("IFILE$").nes."" then close/noLog ifile$ |
8046e281 | 43 | $search CONFIGURE.IN "AM_INIT_AUTOMAKE"/Exact/Output=config-gas-tmp.tmp |
fd4b1131 | 44 | $open ifile$ config-gas-tmp.tmp |
4b0dd31c KR |
45 | $read ifile$ line |
46 | $close ifile$ | |
fd4b1131 | 47 | $DELETE config-gas-tmp.tmp;* |
8046e281 ILT |
48 | $! Discard "AM_INIT_AUTOMAKE(gas, " and ")" parts. |
49 | $ijk=f$locate(",",line)+2 | |
4b0dd31c | 50 | $line=f$extract(ijk,f$length(line)-ijk,line) |
8046e281 | 51 | $ijk=f$locate(")",line) |
4b0dd31c KR |
52 | $line=f$extract(0,ijk,line) |
53 | $! | |
fd4b1131 KR |
54 | $ if f$search("version.opt").nes."" then DELETE version.opt;* |
55 | $copy _NL: version.opt | |
56 | $open/Append ifile$ version.opt | |
57 | $write ifile$ "identification="+""""+line+"""" | |
c3b0ae93 | 58 | $close ifile$ |
15f146be | 59 | $! |
c3b0ae93 | 60 | $! Now write config.h. |
15f146be | 61 | $! |
fd4b1131 KR |
62 | $ if f$search("config.h").nes."" then DELETE config.h;* |
63 | $copy _NL: config.h | |
64 | $open/Append ifile$ config.h | |
65 | $write ifile$ "/* config.h. Generated by config-gas.com. */ | |
8046e281 ILT |
66 | $write ifile$ "#ifndef VERSION" |
67 | $write ifile$ "#define VERSION """,line,"""" | |
fd4b1131 KR |
68 | $write ifile$ "#endif" |
69 | $write ifile$ "/*--*/" | |
396e8d7f ILT |
70 | $if arch .eqs. "VAX" |
71 | $then | |
fd4b1131 | 72 | $append [.config]vms-conf.h ifile$: |
396e8d7f ILT |
73 | $else |
74 | $ append [.config]vms-a-conf.h ifile$: | |
75 | $endif | |
4b0dd31c | 76 | $close ifile$ |
fd4b1131 | 77 | $ECHO "Created config.h." |
4b0dd31c | 78 | $! |
15f146be KR |
79 | $! Check for, and possibly make, header file <unistd.h>. |
80 | $! | |
81 | $ if f$search("tmp-chk-h.*").nes."" then DELETE tmp-chk-h.*;* | |
82 | $!can't use simple `#include HDR' with `gcc /Define="HDR=<foo.h>"' | |
83 | $!because the 2.6.[0-3] preprocessor handles it wrong (VMS-specific gcc bug) | |
84 | $ create tmp-chk-h.c | |
85 | int tmp_chk_h; /* guarantee non-empty output */ | |
86 | #ifdef HAVE_STDIO_H | |
87 | #include <stdio.h> | |
88 | #endif | |
89 | #ifdef HAVE_UNISTD_H | |
90 | #include <unistd.h> | |
91 | #endif | |
92 | #ifdef HAVE_UNIXIO_H | |
93 | #include <unixio.h> | |
94 | #endif | |
95 | #ifdef HAVE_UNIXLIB_H | |
96 | #include <unixlib.h> | |
97 | #endif | |
98 | $ on warning then continue | |
99 | $ CHECK = "call tmp_chk_h" | |
100 | $ CHECK "HAVE_STDIO_H" | |
101 | $ if .not.$status | |
102 | $ then type sys$input: | |
103 | ||
104 | ? could not compile <stdio.h>. | |
9659c18b ILT |
105 | |
106 | If you're compiling with DEC C or VAX C, create config.status as an | |
107 | empty file and start gnu make again. | |
108 | ||
109 | If you're compiling with GNU C, there is some setup problem and | |
110 | gas configuration cannot proceed. | |
15f146be KR |
111 | |
112 | $ DELETE tmp-chk-h.c;* | |
113 | $ exit %x002C | |
114 | $ endif | |
115 | $! | |
116 | $ CHECK "HAVE_UNISTD_H" | |
117 | $ if .not.$status | |
118 | $ then | |
119 | $ if f$trnlnm("HFILE$").nes."" then close/noLog hfile$ | |
120 | $ CHECK "HAVE_UNIXIO_H" | |
121 | $ got_unixio = ($status .and. 1) | |
122 | $ CHECK "HAVE_UNIXLIB_H" | |
123 | $ got_unixlib = ($status .and. 1) | |
124 | $ create []unistd.h !with rudimentary contents | |
125 | /* <unistd.h> substitute for building gas */ | |
126 | #ifndef UNISTD_H | |
127 | #define UNISTD_H | |
128 | ||
129 | $ open/Append hfile$ []unistd.h | |
130 | $ if got_unixio | |
131 | $ then write hfile$ "#include <unixio.h>" | |
132 | $ else append sys$input: hfile$: | |
133 | /* some of the routines normally prototyped in <unixio.h> */ | |
134 | extern int creat(), open(), close(), read(), write(); | |
135 | extern int access(), dup(), dup2(), fstat(), stat(); | |
136 | extern long lseek(); | |
137 | $ endif | |
138 | $ write hfile$ "" | |
139 | $ if got_unixlib | |
140 | $ then write hfile$ "#include <unixlib.h>" | |
141 | $ else append sys$input: hfile$: | |
142 | /* some of the routines normally prototyped in <unixlib.h> */ | |
143 | extern char *sbrk(), *getcwd(), *cuserid(); | |
144 | extern int brk(), chdir(), chmod(), chown(), mkdir(); | |
145 | extern unsigned getuid(), umask(); | |
146 | $ endif | |
147 | $ append sys$input: hfile$: | |
148 | ||
149 | #endif /*UNISTD_H*/ | |
150 | $ close hfile$ | |
151 | $ ECHO "Created ""[]unistd.h""." | |
152 | $ endif !gcc '#include <unistd.h>' failed | |
153 | $ DELETE tmp-chk-h.c;* | |
154 | $ | |
155 | $tmp_chk_h: subroutine | |
156 | $ set noOn | |
157 | $ hname = f$edit("<" + (p1 - "HAVE_" - "_H") + ".h>","LOWERCASE") | |
158 | $ write sys$output "Checking for ''hname'." | |
159 | $ if f$search("tmp-chk-h.obj").nes."" then DELETE tmp-chk-h.obj;* | |
160 | $ define/noLog sys$error _NL: !can't use /User_Mode here due to gcc | |
161 | $ define/noLog sys$output _NL: ! driver's use of multiple image activation | |
162 | $ gcc /Include=([],[-.include]) /Define=("''p1'") tmp-chk-h.c | |
163 | $!can't just check $status; gcc 2.6.[0-3] preprocessor doesn't set it correctly | |
164 | $ ok = (($status.and.1).and.(f$search("tmp-chk-h.obj").nes."")) .or. %x10000000 | |
165 | $ deassign sys$error !restore, more or less | |
166 | $ deassign sys$output | |
167 | $ if ok then DELETE tmp-chk-h.obj;* | |
168 | $ exit ok | |
169 | $ endsubroutine !tmp_chk_h | |
170 | $ | |
171 | $! | |
172 | $! Done | |
173 | $! | |
fd4b1131 | 174 | $ if f$search("config.status") .nes. "" then DELETE config.status;* |
396e8d7f ILT |
175 | $ open/write cfile []config.status |
176 | $ write cfile "Links are now set up for use with a "+arch+" running VMS." | |
177 | $ close cfile | |
178 | $ type []config.status | |
4b0dd31c KR |
179 | $exit |
180 | $! | |
181 | $! | |
182 | $link: | |
183 | $subroutine | |
fd4b1131 KR |
184 | $ if f$search(p1).nes."" then DELETE 'p1';* |
185 | $ copy 'p2' 'p1' | |
186 | $ ECHO "Copied ''f$edit(p2,"LOWERCASE")' to ''f$edit(p1,"LOWERCASE")'." | |
4b0dd31c | 187 | $endsubroutine |