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 $ arch=F$GETSYI("ARCH_NAME")
11 $ arch=F$EDIT(arch,"LOWERCASE")
12 $if arch .eqs. "alpha" then target = "alpha"
13 $if arch .eqs. "ia64" then target = "ia64"
15 $if (arch .eqs. "alpha") .or. (arch .eqs. "ia64")
18 $ write sys$output "Configuring BFD for ''target' target"
21 $! copy bfd-in2.h to bfd.h, replacing @ macros
23 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
24 []bfd-in2.h /output=[]bfd.h
27 ! Copy file, changing lines with macros (@@)
31 vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN");
32 rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
33 match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
34 IF match_pos <> 0 THEN;
35 POSITION(BEGINNING_OF(match_pos));
37 vers := CURRENT_LINE-")";
42 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
43 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
45 match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang);
46 IF match_pos <> 0 THEN;
47 POSITION(BEGINNING_OF(match_pos));
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_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
64 IF match_pos <> 0 THEN;
65 POSITION(BEGINNING_OF(match_pos));
69 match_pos := SEARCH_QUIETLY('@BFD_HOST_LONG_LONG@', FORWARD, EXACT, rang);
70 IF match_pos <> 0 THEN;
71 POSITION(BEGINNING_OF(match_pos));
75 match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG_LONG@', FORWARD, EXACT, rang);
76 IF match_pos <> 0 THEN;
77 POSITION(BEGINNING_OF(match_pos));
81 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang);
82 IF match_pos <> 0 THEN;
83 POSITION(BEGINNING_OF(match_pos));
87 COPY_TEXT('#include <ints.h>');
89 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
90 IF match_pos <> 0 THEN;
91 POSITION(BEGINNING_OF(match_pos));
95 match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
96 IF match_pos <> 0 THEN;
97 POSITION(BEGINNING_OF(match_pos));
101 match_pos := SEARCH_QUIETLY('@BFD_HOSTPTR_T@', FORWARD, EXACT, rang);
102 IF match_pos <> 0 THEN;
103 POSITION(BEGINNING_OF(match_pos));
107 match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
108 IF match_pos <> 0 THEN;
109 POSITION(BEGINNING_OF(match_pos));
111 COPY_TEXT('bfd_signed_vma');
113 match_pos := SEARCH_QUIETLY('unsigned @bfd_file_ptr@ ufile_ptr', FORWARD, EXACT, rang);
114 IF match_pos <> 0 THEN;
115 POSITION(BEGINNING_OF(match_pos));
117 COPY_TEXT('bfd_vma ufile_ptr');
119 match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
120 IF match_pos <> 0 THEN;
121 POSITION(BEGINNING_OF(match_pos));
125 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
131 $ write sys$output "Configuring for Vax target"
134 $! copy bfd-in2.h to bfd.h, replacing @ macros
136 $ write sys$output "Generated `bfd.h' from `bfd-in2.h'."
137 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
138 []bfd-in2.h /output=[]bfd.h
141 ! Copy file, changing lines with macros (@@)
145 vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN");
146 rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
147 match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
148 IF match_pos <> 0 THEN;
149 POSITION(BEGINNING_OF(match_pos));
151 vers := CURRENT_LINE-")";
156 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
157 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
159 match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang);
160 IF match_pos <> 0 THEN;
161 POSITION(BEGINNING_OF(match_pos));
165 match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
166 IF match_pos <> 0 THEN;
167 POSITION(BEGINNING_OF(match_pos));
171 match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
172 IF match_pos <> 0 THEN;
173 POSITION(BEGINNING_OF(match_pos));
177 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang);
178 IF match_pos <> 0 THEN;
179 POSITION(BEGINNING_OF(match_pos));
183 COPY_TEXT('#include <ints.h>');
185 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
186 IF match_pos <> 0 THEN;
187 POSITION(BEGINNING_OF(match_pos));
191 match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
192 IF match_pos <> 0 THEN;
193 POSITION(BEGINNING_OF(match_pos));
197 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
205 $ write sys$output "Generate `bfdver.h' from 'version.h' and `configure.in'."
206 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
207 []version.h /output=[]bfdver.h
210 ! Copy file, changing lines with macros (@@)
214 vfile := CREATE_BUFFER("vfile", "configure.in");
215 rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
216 match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
217 IF match_pos <> 0 THEN;
218 POSITION(BEGINNING_OF(match_pos));
220 vers := CURRENT_LINE-")";
224 versnum := vers - "." - ".";
226 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
227 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
229 match_pos := SEARCH_QUIETLY('@bfd_version@', FORWARD, EXACT, rang);
230 IF match_pos <> 0 THEN;
231 POSITION(BEGINNING_OF(match_pos));
235 match_pos := SEARCH_QUIETLY('@bfd_version_string@', FORWARD, EXACT, rang);
236 IF match_pos <> 0 THEN;
237 POSITION(BEGINNING_OF(match_pos));
243 match_pos := SEARCH_QUIETLY('@bfd_version_package@', FORWARD, EXACT, rang);
244 IF match_pos <> 0 THEN;
245 POSITION(BEGINNING_OF(match_pos));
247 COPY_TEXT('"(GNU Binutils) "');
249 match_pos := SEARCH_QUIETLY('@report_bugs_to@', FORWARD, EXACT, rang);
250 IF match_pos <> 0 THEN;
251 POSITION(BEGINNING_OF(match_pos));
253 COPY_TEXT('"<http://www.sourceware.org/bugzilla/>"');
255 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
260 $! create targmatch.h
262 $ write sys$output "Generate `targmatch.h'"
263 $ open/write tfile []targmatch.h
264 $ write tfile "{ """ + target + "-*-*vms*""" + ","
265 $ write tfile "#if defined (SELECT_VECS)"
266 $ write tfile "SELECT_VECS"
267 $ write tfile "#else"
268 $ write tfile "UNSUPPORTED_TARGET"
269 $ write tfile "#endif"
276 $ write sys$output "Generate `config.h'"
278 /* config.h-vms. Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de. */
279 /* config.in. Generated automatically from configure.in by autoheader. */
280 /* Whether malloc must be declared even if <stdlib.h> is included. */
281 /* #undef NEED_DECLARATION_MALLOC */
282 /* Whether free must be declared even if <stdlib.h> is included. */
283 /* #undef NEED_DECLARATION_FREE */
284 /* Define if you have a working `mmap' system call. */
285 /* #define HAVE_MMAP 1 */
286 /* Do we need to use the b modifier when opening binary files? */
287 /* #undef USE_BINARY_FOPEN */
288 /* Name of host specific header file to include in trad-core.c. */
289 /* #undef TRAD_HEADER */
290 /* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
291 /* #undef HAVE_SYS_PROCFS_H */
292 /* Do we really want to use mmap if it's available? */
293 /* #undef USE_MMAP */
294 /* Define if you have the fcntl function. */
296 /* Define if you have the getpagesize function. */
297 #define HAVE_GETPAGESIZE 1
298 /* Define if you have the madvise function. */
299 #define HAVE_MADVISE 1
300 /* Define if you have the mprotect function. */
301 #define HAVE_MPROTECT 1
302 /* Define if you have the <fcntl.h> header file. */
303 #define HAVE_FCNTL_H 1
304 /* Define if you have the <stddef.h> header file. */
305 #define HAVE_STDDEF_H 1
306 /* Define if you have the <stdlib.h> header file. */
307 #define HAVE_STDLIB_H 1
308 /* Define if you have the <string.h> header file. */
309 #define HAVE_STRING_H 1
310 /* Define if you have the <strings.h> header file. */
311 #define HAVE_STRINGS_H 1
312 /* Define if you have the <sys/file.h> header file. */
313 #define HAVE_SYS_FILE_H 1
314 /* Define if you have the <time.h> header file. */
315 #define HAVE_TIME_H 1
316 /* Define if you have the <unistd.h> header file. */
317 #define HAVE_UNISTD_H 1
321 $ write sys$output "Generate build.com"
323 $ if ARCH.eqs."alpha"
327 $ DEFS="""SELECT_VECS=&vms_alpha_vec"","+-
328 """SELECT_ARCHITECTURES=&bfd_alpha_arch"""
329 $ FILES="cpu-alpha,vms,vms-hdr,vms-gsd,vms-tir,vms-misc,"
336 $ DEFS="""SELECT_VECS=&bfd_elf64_ia64_vms_vec"","+-
337 """SELECT_ARCHITECTURES=&bfd_ia64_arch"""
338 $ FILES="cpu-ia64,elf64-ia64,elf-strtab,corefile,stabs,merge,elf-eh-frame,"+-
339 "elflink,elf-attrs,dwarf1,elf64,"
344 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
345 found_range := CREATE_RANGE(BEGINNING_OF(file), BEGINNING_OF(file));
348 rang := CREATE_RANGE (END_OF(found_range),END_OF(file));
349 match_pos := SEARCH_QUIETLY('NN', FORWARD, EXACT, rang);
350 EXITIF match_pos = 0;
351 POSITION(BEGINNING_OF(match_pos));
355 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
358 $ write sys$output "Generate elf64-ia64.c from elfxx-ia64.c"
359 $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
360 []elfXX-ia64.c /output=[]elf64-ia64.c
361 $ write sys$output "Generate elf64-target.h from elfxx-target.h"
362 $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
363 []elfXX-target.h /output=[]elf64-target.h
365 $ copy [.hosts]alphavms.h sysdep.h
367 $ append sys$input build.com
369 $ DEFS=DEFS + ",""unlink=remove"",""DEBUGDIR=""""GNU$DEBUGDIR:"""""""
371 $ CFLAGS="/name=(as_is,shortened)" + -
372 "/include=([],""../"",""../include"")" + -
373 "/define=(" + DEFS + ")" + OPT
374 $ FILES=FILES + "archive,archive64,archures,bfd,bfdio,binary,cache,coffgen,"+-
375 "compress,corefile,dwarf2,elf,format,hash,ihex,init,libbfd,linker,"+-
376 "opncls,reloc,section,simple,srec,stab-syms,syms,targets,tekhex,verilog"
377 $ write sys$output "CFLAGS=",CFLAGS
378 $ cflags_libbfd="/warning=(disable=missingreturn)"
383 $ F = F$ELEMENT(NUM,",",FILES)
384 $ IF F.EQS."," THEN GOTO END
385 $ eflags_name="cflags_''f'"
386 $ name_len=f$length(eflags_name)
387 $ dash_pos=f$locate("-",eflags_name)
388 $ if dash_pos.ne.name_len
390 $ eflags_name['dash_pos,1]:="_"
391 $ dash_pos=f$locate("-",eflags_name)
392 $ if dash_pos.ne.name_len then eflags_name['dash_pos,1]:="_"
394 $ if f$type('eflags_name).eqs."" then eflags_name="cflags_nil"
395 $ eflags='eflags_name
396 $ write sys$output "Compiling ", F, ".c", eflags
397 $ cc 'CFLAGS 'eflags 'F.c
398 $ IF OBJS.NES."" THEN OBJS=OBJS + ","
399 $ OBJS=OBJS + F + ".obj"
404 $ lib/create libbfd 'OBJS