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 bfd_stdint.h
262 $ write sys$output "Generate `bfd_stdint.h'"
263 $ create []bfd_stdint.h
264 #include <inttypes.h>
267 $! create targmatch.h
269 $ write sys$output "Generate `targmatch.h'"
270 $ open/write tfile []targmatch.h
271 $ write tfile "{ """ + target + "-*-*vms*""" + ","
272 $ write tfile "#if defined (SELECT_VECS)"
273 $ write tfile "SELECT_VECS"
274 $ write tfile "#else"
275 $ write tfile "UNSUPPORTED_TARGET"
276 $ write tfile "#endif"
283 $ write sys$output "Generate `config.h'"
285 /* config.h-vms. Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de. */
286 /* config.in. Generated automatically from configure.in by autoheader. */
287 /* Whether malloc must be declared even if <stdlib.h> is included. */
288 /* #undef NEED_DECLARATION_MALLOC */
289 /* Whether free must be declared even if <stdlib.h> is included. */
290 /* #undef NEED_DECLARATION_FREE */
291 /* Define if you have a working `mmap' system call. */
292 /* #define HAVE_MMAP 1 */
293 /* Do we need to use the b modifier when opening binary files? */
294 /* #undef USE_BINARY_FOPEN */
295 /* Name of host specific header file to include in trad-core.c. */
296 /* #undef TRAD_HEADER */
297 /* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
298 /* #undef HAVE_SYS_PROCFS_H */
299 /* Do we really want to use mmap if it's available? */
300 /* #undef USE_MMAP */
301 /* Define if you have the fcntl function. */
303 /* Define if you have the getpagesize function. */
304 #define HAVE_GETPAGESIZE 1
305 /* Define if you have the madvise function. */
306 #define HAVE_MADVISE 1
307 /* Define if you have the mprotect function. */
308 #define HAVE_MPROTECT 1
309 /* Define if you have the <fcntl.h> header file. */
310 #define HAVE_FCNTL_H 1
311 /* Define if you have the <stddef.h> header file. */
312 #define HAVE_STDDEF_H 1
313 /* Define if you have the <stdlib.h> header file. */
314 #define HAVE_STDLIB_H 1
315 /* Define if you have the <string.h> header file. */
316 #define HAVE_STRING_H 1
317 /* Define if you have the <strings.h> header file. */
318 #define HAVE_STRINGS_H 1
319 /* Define if you have the <sys/file.h> header file. */
320 #define HAVE_SYS_FILE_H 1
321 /* Define if you have the <time.h> header file. */
322 #define HAVE_TIME_H 1
323 /* Define if you have the <unistd.h> header file. */
324 #define HAVE_UNISTD_H 1
328 $ write sys$output "Copy sysdep.h"
329 $ copy [.hosts]alphavms.h sysdep.h
331 $ write sys$output "Generate build.com"
333 $ if ARCH.eqs."alpha"
337 $ DEFS="""SELECT_VECS=&vms_alpha_vec"","+-
338 """SELECT_ARCHITECTURES=&bfd_alpha_arch"""
339 $ FILES="cpu-alpha,vms,vms-hdr,vms-gsd,vms-tir,vms-misc,"
346 $ DEFS="""SELECT_VECS=&bfd_elf64_ia64_vms_vec"","+-
347 """SELECT_ARCHITECTURES=&bfd_ia64_arch"""
348 $ FILES="cpu-ia64,elf64-ia64,elf-strtab,corefile,stabs,merge,elf-eh-frame,"+-
349 "elflink,elf-attrs,dwarf1,elf64,"
354 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
355 found_range := CREATE_RANGE(BEGINNING_OF(file), BEGINNING_OF(file));
358 rang := CREATE_RANGE (END_OF(found_range),END_OF(file));
359 match_pos := SEARCH_QUIETLY('NN', FORWARD, EXACT, rang);
360 EXITIF match_pos = 0;
361 POSITION(BEGINNING_OF(match_pos));
365 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
368 $ write sys$output "Generate elf64-ia64.c from elfxx-ia64.c"
369 $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
370 []elfXX-ia64.c /output=[]elf64-ia64.c
371 $ write sys$output "Generate elf64-target.h from elfxx-target.h"
372 $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
373 []elfXX-target.h /output=[]elf64-target.h
376 $ append sys$input build.com
378 $ DEFS=DEFS + ",""unlink=remove"",""DEBUGDIR=""""GNU$DEBUGDIR:"""""""
380 $ CFLAGS="/name=(as_is,shortened)" + -
381 "/include=([],""../"",""../include"")" + -
382 "/define=(" + DEFS + ")" + OPT
383 $ FILES=FILES + "archive,archive64,archures,bfd,bfdio,binary,cache,coffgen,"+-
384 "compress,corefile,dwarf2,elf,format,hash,ihex,init,libbfd,linker,"+-
385 "opncls,reloc,section,simple,srec,stab-syms,syms,targets,tekhex,verilog"
386 $ write sys$output "CFLAGS=",CFLAGS
387 $ cflags_libbfd="/warning=(disable=missingreturn)"
392 $ F = F$ELEMENT(NUM,",",FILES)
393 $ IF F.EQS."," THEN GOTO END
394 $ eflags_name="cflags_''f'"
395 $ name_len=f$length(eflags_name)
396 $ dash_pos=f$locate("-",eflags_name)
397 $ if dash_pos.ne.name_len
399 $ eflags_name['dash_pos,1]:="_"
400 $ dash_pos=f$locate("-",eflags_name)
401 $ if dash_pos.ne.name_len then eflags_name['dash_pos,1]:="_"
403 $ if f$type('eflags_name).eqs."" then eflags_name="cflags_nil"
404 $ eflags='eflags_name
405 $ write sys$output "Compiling ", F, ".c", eflags
406 $ cc 'CFLAGS 'eflags 'F.c
407 $ IF OBJS.NES."" THEN OBJS=OBJS + ","
408 $ OBJS=OBJS + F + ".obj"
413 $ lib/create libbfd 'OBJS