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