2 $! This file configures the bfd library for use with openVMS.
4 $! We do not use the configure script, since we do not have /bin/sh
7 $! Written by Klaus K"ampf (kkaempf@rmi.de)
8 $! Rewritten by Tristan Gingold (gingold@adacore.com)
10 $! Copyright (C) 2012-2024 Free Software Foundation, Inc.
12 $! This file is free software; you can redistribute it and/or modify
13 $! it under the terms of the GNU General Public License as published by
14 $! the Free Software Foundation; either version 3 of the License, or
15 $! (at your option) any later version.
17 $! This program is distributed in the hope that it will be useful,
18 $! but WITHOUT ANY WARRANTY; without even the implied warranty of
19 $! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 $! GNU General Public License for more details.
22 $! You should have received a copy of the GNU General Public License
23 $! along with this program; see the file COPYING3. If not see
24 $! <http://www.gnu.org/licenses/>.
26 $ arch=F$GETSYI("ARCH_NAME")
27 $ arch=F$EDIT(arch,"LOWERCASE")
28 $if arch .eqs. "alpha" then target = "alpha"
29 $if arch .eqs. "ia64" then target = "ia64"
31 $if (arch .eqs. "alpha") .or. (arch .eqs. "ia64")
34 $ write sys$output "Configuring BFD for ''target' target"
37 $! copy bfd-in2.h to bfd.h, replacing @ macros
39 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
40 []bfd-in2.h /output=[]bfd.h
43 ! Copy file, changing lines with macros (@@)
48 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
49 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
51 match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
52 IF match_pos <> 0 THEN;
53 POSITION(BEGINNING_OF(match_pos));
57 match_pos := SEARCH_QUIETLY('@bfd_default_target_size@', FORWARD, EXACT, rang);
58 IF match_pos <> 0 THEN;
59 POSITION(BEGINNING_OF(match_pos));
63 match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
64 IF match_pos <> 0 THEN;
65 POSITION(BEGINNING_OF(match_pos));
67 COPY_TEXT('bfd_signed_vma');
69 match_pos := SEARCH_QUIETLY('@bfd_ufile_ptr@', FORWARD, EXACT, rang);
70 IF match_pos <> 0 THEN;
71 POSITION(BEGINNING_OF(match_pos));
75 match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
76 IF match_pos <> 0 THEN;
77 POSITION(BEGINNING_OF(match_pos));
81 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
87 $ write sys$output "Configuring for Vax target"
90 $! copy bfd-in2.h to bfd.h, replacing @ macros
92 $ write sys$output "Generated `bfd.h' from `bfd-in2.h'."
93 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
94 []bfd-in2.h /output=[]bfd.h
97 ! Copy file, changing lines with macros (@@)
102 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
103 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
105 match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
106 IF match_pos <> 0 THEN;
107 POSITION(BEGINNING_OF(match_pos));
111 match_pos := SEARCH_QUIETLY('@bfd_default_target_size@', FORWARD, EXACT, rang);
112 IF match_pos <> 0 THEN;
113 POSITION(BEGINNING_OF(match_pos));
117 match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
118 IF match_pos <> 0 THEN;
119 POSITION(BEGINNING_OF(match_pos));
121 COPY_TEXT('bfd_signed_vma');
123 match_pos := SEARCH_QUIETLY('@bfd_ufile_ptr@', FORWARD, EXACT, rang);
124 IF match_pos <> 0 THEN;
125 POSITION(BEGINNING_OF(match_pos));
127 COPY_TEXT('bfd_vma');
129 match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
130 IF match_pos <> 0 THEN;
131 POSITION(BEGINNING_OF(match_pos));
135 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
143 $ write sys$output "Generate `bfdver.h' from 'version.h' and `configure.in'."
144 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
145 []version.h /output=[]bfdver.h
148 ! Copy file, changing lines with macros (@@)
152 vfile := CREATE_BUFFER("vfile", "configure.in");
153 rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
154 match_pos := SEARCH_QUIETLY('AC_INIT([bfd], [', FORWARD, EXACT, rang);
155 IF match_pos <> 0 THEN;
156 POSITION(BEGINNING_OF(match_pos));
158 vers := CURRENT_LINE-"])";
162 versnum := vers - "." - ".";
164 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
165 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
167 match_pos := SEARCH_QUIETLY('@bfd_version@', FORWARD, EXACT, rang);
168 IF match_pos <> 0 THEN;
169 POSITION(BEGINNING_OF(match_pos));
173 match_pos := SEARCH_QUIETLY('@bfd_version_string@', FORWARD, EXACT, rang);
174 IF match_pos <> 0 THEN;
175 POSITION(BEGINNING_OF(match_pos));
181 match_pos := SEARCH_QUIETLY('@bfd_version_package@', FORWARD, EXACT, rang);
182 IF match_pos <> 0 THEN;
183 POSITION(BEGINNING_OF(match_pos));
185 COPY_TEXT('"(GNU Binutils) "');
187 match_pos := SEARCH_QUIETLY('@report_bugs_to@', FORWARD, EXACT, rang);
188 IF match_pos <> 0 THEN;
189 POSITION(BEGINNING_OF(match_pos));
191 COPY_TEXT('"<https://www.sourceware.org/bugzilla/>"');
193 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
198 $! create targmatch.h
200 $ write sys$output "Generate `targmatch.h'"
201 $ open/write tfile []targmatch.h
202 $ write tfile "{ """ + target + "-*-*vms*""" + ","
203 $ write tfile "#if defined (SELECT_VECS)"
204 $ write tfile "SELECT_VECS"
205 $ write tfile "#else"
206 $ write tfile "UNSUPPORTED_TARGET"
207 $ write tfile "#endif"
214 $ write sys$output "Generate `config.h'"
216 /* config.h-vms. Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de. */
217 /* config.in. Generated automatically from configure.in by autoheader. */
218 /* Whether malloc must be declared even if <stdlib.h> is included. */
219 /* #undef NEED_DECLARATION_MALLOC */
220 /* Whether free must be declared even if <stdlib.h> is included. */
221 /* #undef NEED_DECLARATION_FREE */
222 /* Define if you have a working `mmap' system call. */
223 /* #define HAVE_MMAP 1 */
224 /* Do we need to use the b modifier when opening binary files? */
225 /* #undef USE_BINARY_FOPEN */
226 /* Name of host specific header file to include in trad-core.c. */
227 /* #undef TRAD_HEADER */
228 /* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
229 /* #undef HAVE_SYS_PROCFS_H */
230 /* Do we really want to use mmap if it's available? */
231 /* #undef USE_MMAP */
232 /* Define if you have the fcntl function. */
234 /* Define if you have the getpagesize function. */
235 #define HAVE_GETPAGESIZE 1
236 /* Define if you have the madvise function. */
237 #define HAVE_MADVISE 1
238 /* Define if you have the mprotect function. */
239 #define HAVE_MPROTECT 1
240 /* Define if you have the <fcntl.h> header file. */
241 #define HAVE_FCNTL_H 1
242 /* Define if you have the <stddef.h> header file. */
243 #define HAVE_STDDEF_H 1
244 /* Define if you have the <stdlib.h> header file. */
245 #define HAVE_STDLIB_H 1
246 /* Define if you have the <string.h> header file. */
247 #define HAVE_STRING_H 1
248 /* Define if you have the <strings.h> header file. */
249 #define HAVE_STRINGS_H 1
250 /* Define if you have the <sys/file.h> header file. */
251 #define HAVE_SYS_FILE_H 1
252 /* Define if you have the <time.h> header file. */
253 #define HAVE_TIME_H 1
254 /* Define if you have the <unistd.h> header file. */
255 #define HAVE_UNISTD_H 1
258 /* Name of package */
259 #define PACKAGE "bfd"
260 /* Define to the address where bug reports for this package should be sent. */
261 #define PACKAGE_BUGREPORT ""
262 /* Define to the full name of this package. */
263 #define PACKAGE_NAME "bfd"
264 /* Define to the full name and version of this package. */
265 #define PACKAGE_STRING "bfd"
266 /* Define to the one symbol short name of this package. */
267 #define PACKAGE_TARNAME "bfd"
268 /* Define to the home page for this package. */
269 #define PACKAGE_URL ""
270 /* Define to the version of this package. */
271 #define PACKAGE_VERSION "(package version)"
273 $ write sys$output "Copy sysdep.h"
274 $ copy [.hosts]alphavms.h sysdep.h
276 $ write sys$output "Generate build.com"
278 $ if ARCH.eqs."alpha"
282 $ DEFS="""SELECT_VECS=&alpha_vms_vec"","+-
283 """SELECT_ARCHITECTURES=&bfd_alpha_arch"""
284 $ FILES="cpu-alpha,vms,vms-hdr,vms-gsd,vms-tir,vms-misc,"
291 $ DEFS="""SELECT_VECS=&ia64_elf64_vms_vec"","+-
292 """SELECT_ARCHITECTURES=&bfd_ia64_arch"""
293 $ FILES="cpu-ia64,elf64-ia64,elf-strtab,corefile,stabs,merge,elf-eh-frame,"+-
294 "elflink,elf-attrs,dwarf1,elf64,"
299 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
300 found_range := CREATE_RANGE(BEGINNING_OF(file), BEGINNING_OF(file));
303 rang := CREATE_RANGE (END_OF(found_range),END_OF(file));
304 match_pos := SEARCH_QUIETLY('NN', FORWARD, EXACT, rang);
305 EXITIF match_pos = 0;
306 POSITION(BEGINNING_OF(match_pos));
310 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
313 $ write sys$output "Generate elf64-target.h from elfxx-target.h"
314 $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
315 []elfXX-target.h /output=[]elf64-target.h
318 $ append sys$input build.com
320 $ DEFS=DEFS + ",""unlink=remove"",""DEBUGDIR=""""GNU$DEBUGDIR:"""""""
322 $ CFLAGS="/name=(as_is,shortened)" + -
323 "/include=([],""../"",""../include"")" + -
324 "/define=(" + DEFS + ")" + OPT
325 $ FILES=FILES + "archive,archive64,archures,bfd,bfdio,binary,cache,coffgen,"+-
326 "compress,corefile,dwarf2,elf,format,hash,ihex,init,libbfd,linker,"+-
327 "opncls,reloc,section,simple,srec,stab-syms,syms,targets,tekhex,verilog"
328 $ write sys$output "CFLAGS=",CFLAGS
329 $ cflags_libbfd="/warning=(disable=missingreturn)"
334 $ F = F$ELEMENT(NUM,",",FILES)
335 $ IF F.EQS."," THEN GOTO END
336 $ eflags_name="cflags_''f'"
337 $ name_len=f$length(eflags_name)
338 $ dash_pos=f$locate("-",eflags_name)
339 $ if dash_pos.ne.name_len
341 $ eflags_name['dash_pos,1]:="_"
342 $ dash_pos=f$locate("-",eflags_name)
343 $ if dash_pos.ne.name_len then eflags_name['dash_pos,1]:="_"
345 $ if f$type('eflags_name).eqs."" then eflags_name="cflags_nil"
346 $ eflags='eflags_name
347 $ write sys$output "Compiling ", F, ".c", eflags
348 $ cc 'CFLAGS 'eflags 'F.c
349 $ IF OBJS.NES."" THEN OBJS=OBJS + ","
350 $ OBJS=OBJS + F + ".obj"
355 $ lib/create libbfd 'OBJS