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