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.
6 $! If you are running this file, then obviously the host is alpha-dec-vms.
15 $ DELETE = "delete/noConfirm"
16 $ ECHO = "write sys$output"
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
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
27 $! Code to handle floating point.
28 $call link atof-targ.c [.config]atof-'atof'.c
31 $! Create the file version.opt, which helps identify the executable.
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
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)
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+""""
52 $! Now write config.h.
54 $ if f$search("config.h").nes."" then DELETE 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$:
64 $ECHO "Created config.h."
66 $! Check for, and possibly make, header file <unistd.h>.
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)
72 int tmp_chk_h; /* guarantee non-empty output */
85 $ on warning then continue
86 $ CHECK = "call tmp_chk_h"
87 $ CHECK "HAVE_STDIO_H"
89 $ then type sys$input:
91 ? could not compile <stdio.h>.
92 Since gcc is not set up correctly, gas configuration cannot proceed.
94 $ DELETE tmp-chk-h.c;*
98 $ CHECK "HAVE_UNISTD_H"
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 */
111 $ open/Append hfile$ []unistd.h
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();
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();
129 $ append sys$input: hfile$:
133 $ ECHO "Created ""[]unistd.h""."
134 $ endif !gcc '#include <unistd.h>' failed
135 $ DELETE tmp-chk-h.c;*
137 $tmp_chk_h: subroutine
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;*
151 $ endsubroutine !tmp_chk_h
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.
165 $ if f$search(p1).nes."" then DELETE 'p1';*
167 $ ECHO "Copied ''f$edit(p2,"LOWERCASE")' to ''f$edit(p1,"LOWERCASE")'."