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