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 2012 Free Software Foundation
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 (@@)
47 vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN");
48 rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
49 match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
50 IF match_pos <> 0 THEN;
51 POSITION(BEGINNING_OF(match_pos));
53 vers := CURRENT_LINE-")";
58 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
59 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
61 match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang);
62 IF match_pos <> 0 THEN;
63 POSITION(BEGINNING_OF(match_pos));
67 match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
68 IF match_pos <> 0 THEN;
69 POSITION(BEGINNING_OF(match_pos));
73 match_pos := SEARCH_QUIETLY('@bfd_default_target_size@', FORWARD, EXACT, rang);
74 IF match_pos <> 0 THEN;
75 POSITION(BEGINNING_OF(match_pos));
79 match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
80 IF match_pos <> 0 THEN;
81 POSITION(BEGINNING_OF(match_pos));
85 match_pos := SEARCH_QUIETLY('@BFD_HOST_LONG_LONG@', FORWARD, EXACT, rang);
86 IF match_pos <> 0 THEN;
87 POSITION(BEGINNING_OF(match_pos));
91 match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG_LONG@', FORWARD, EXACT, rang);
92 IF match_pos <> 0 THEN;
93 POSITION(BEGINNING_OF(match_pos));
97 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang);
98 IF match_pos <> 0 THEN;
99 POSITION(BEGINNING_OF(match_pos));
103 COPY_TEXT('#include <ints.h>');
105 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
106 IF match_pos <> 0 THEN;
107 POSITION(BEGINNING_OF(match_pos));
111 match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
112 IF match_pos <> 0 THEN;
113 POSITION(BEGINNING_OF(match_pos));
117 match_pos := SEARCH_QUIETLY('@BFD_HOSTPTR_T@', FORWARD, EXACT, rang);
118 IF match_pos <> 0 THEN;
119 POSITION(BEGINNING_OF(match_pos));
123 match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
124 IF match_pos <> 0 THEN;
125 POSITION(BEGINNING_OF(match_pos));
127 COPY_TEXT('bfd_signed_vma');
129 match_pos := SEARCH_QUIETLY('unsigned @bfd_file_ptr@ ufile_ptr', FORWARD, EXACT, rang);
130 IF match_pos <> 0 THEN;
131 POSITION(BEGINNING_OF(match_pos));
133 COPY_TEXT('bfd_vma ufile_ptr');
135 match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
136 IF match_pos <> 0 THEN;
137 POSITION(BEGINNING_OF(match_pos));
141 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
147 $ write sys$output "Configuring for Vax target"
150 $! copy bfd-in2.h to bfd.h, replacing @ macros
152 $ write sys$output "Generated `bfd.h' from `bfd-in2.h'."
153 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
154 []bfd-in2.h /output=[]bfd.h
157 ! Copy file, changing lines with macros (@@)
161 vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN");
162 rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
163 match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
164 IF match_pos <> 0 THEN;
165 POSITION(BEGINNING_OF(match_pos));
167 vers := CURRENT_LINE-")";
172 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
173 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
175 match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang);
176 IF match_pos <> 0 THEN;
177 POSITION(BEGINNING_OF(match_pos));
181 match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
182 IF match_pos <> 0 THEN;
183 POSITION(BEGINNING_OF(match_pos));
187 match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
188 IF match_pos <> 0 THEN;
189 POSITION(BEGINNING_OF(match_pos));
193 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang);
194 IF match_pos <> 0 THEN;
195 POSITION(BEGINNING_OF(match_pos));
199 COPY_TEXT('#include <ints.h>');
201 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
202 IF match_pos <> 0 THEN;
203 POSITION(BEGINNING_OF(match_pos));
207 match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
208 IF match_pos <> 0 THEN;
209 POSITION(BEGINNING_OF(match_pos));
213 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
221 $ write sys$output "Generate `bfdver.h' from 'version.h' and `configure.in'."
222 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
223 []version.h /output=[]bfdver.h
226 ! Copy file, changing lines with macros (@@)
230 vfile := CREATE_BUFFER("vfile", "configure.in");
231 rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
232 match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
233 IF match_pos <> 0 THEN;
234 POSITION(BEGINNING_OF(match_pos));
236 vers := CURRENT_LINE-")";
240 versnum := vers - "." - ".";
242 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
243 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
245 match_pos := SEARCH_QUIETLY('@bfd_version@', FORWARD, EXACT, rang);
246 IF match_pos <> 0 THEN;
247 POSITION(BEGINNING_OF(match_pos));
251 match_pos := SEARCH_QUIETLY('@bfd_version_string@', FORWARD, EXACT, rang);
252 IF match_pos <> 0 THEN;
253 POSITION(BEGINNING_OF(match_pos));
259 match_pos := SEARCH_QUIETLY('@bfd_version_package@', FORWARD, EXACT, rang);
260 IF match_pos <> 0 THEN;
261 POSITION(BEGINNING_OF(match_pos));
263 COPY_TEXT('"(GNU Binutils) "');
265 match_pos := SEARCH_QUIETLY('@report_bugs_to@', FORWARD, EXACT, rang);
266 IF match_pos <> 0 THEN;
267 POSITION(BEGINNING_OF(match_pos));
269 COPY_TEXT('"<http://www.sourceware.org/bugzilla/>"');
271 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
276 $! create bfd_stdint.h
278 $ write sys$output "Generate `bfd_stdint.h'"
279 $ create []bfd_stdint.h
280 #include <inttypes.h>
283 $! create targmatch.h
285 $ write sys$output "Generate `targmatch.h'"
286 $ open/write tfile []targmatch.h
287 $ write tfile "{ """ + target + "-*-*vms*""" + ","
288 $ write tfile "#if defined (SELECT_VECS)"
289 $ write tfile "SELECT_VECS"
290 $ write tfile "#else"
291 $ write tfile "UNSUPPORTED_TARGET"
292 $ write tfile "#endif"
299 $ write sys$output "Generate `config.h'"
301 /* config.h-vms. Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de. */
302 /* config.in. Generated automatically from configure.in by autoheader. */
303 /* Whether malloc must be declared even if <stdlib.h> is included. */
304 /* #undef NEED_DECLARATION_MALLOC */
305 /* Whether free must be declared even if <stdlib.h> is included. */
306 /* #undef NEED_DECLARATION_FREE */
307 /* Define if you have a working `mmap' system call. */
308 /* #define HAVE_MMAP 1 */
309 /* Do we need to use the b modifier when opening binary files? */
310 /* #undef USE_BINARY_FOPEN */
311 /* Name of host specific header file to include in trad-core.c. */
312 /* #undef TRAD_HEADER */
313 /* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
314 /* #undef HAVE_SYS_PROCFS_H */
315 /* Do we really want to use mmap if it's available? */
316 /* #undef USE_MMAP */
317 /* Define if you have the fcntl function. */
319 /* Define if you have the getpagesize function. */
320 #define HAVE_GETPAGESIZE 1
321 /* Define if you have the madvise function. */
322 #define HAVE_MADVISE 1
323 /* Define if you have the mprotect function. */
324 #define HAVE_MPROTECT 1
325 /* Define if you have the <fcntl.h> header file. */
326 #define HAVE_FCNTL_H 1
327 /* Define if you have the <stddef.h> header file. */
328 #define HAVE_STDDEF_H 1
329 /* Define if you have the <stdlib.h> header file. */
330 #define HAVE_STDLIB_H 1
331 /* Define if you have the <string.h> header file. */
332 #define HAVE_STRING_H 1
333 /* Define if you have the <strings.h> header file. */
334 #define HAVE_STRINGS_H 1
335 /* Define if you have the <sys/file.h> header file. */
336 #define HAVE_SYS_FILE_H 1
337 /* Define if you have the <time.h> header file. */
338 #define HAVE_TIME_H 1
339 /* Define if you have the <unistd.h> header file. */
340 #define HAVE_UNISTD_H 1
344 $ write sys$output "Copy sysdep.h"
345 $ copy [.hosts]alphavms.h sysdep.h
347 $ write sys$output "Generate build.com"
349 $ if ARCH.eqs."alpha"
353 $ DEFS="""SELECT_VECS=&vms_alpha_vec"","+-
354 """SELECT_ARCHITECTURES=&bfd_alpha_arch"""
355 $ FILES="cpu-alpha,vms,vms-hdr,vms-gsd,vms-tir,vms-misc,"
362 $ DEFS="""SELECT_VECS=&bfd_elf64_ia64_vms_vec"","+-
363 """SELECT_ARCHITECTURES=&bfd_ia64_arch"""
364 $ FILES="cpu-ia64,elf64-ia64,elf-strtab,corefile,stabs,merge,elf-eh-frame,"+-
365 "elflink,elf-attrs,dwarf1,elf64,"
370 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
371 found_range := CREATE_RANGE(BEGINNING_OF(file), BEGINNING_OF(file));
374 rang := CREATE_RANGE (END_OF(found_range),END_OF(file));
375 match_pos := SEARCH_QUIETLY('NN', FORWARD, EXACT, rang);
376 EXITIF match_pos = 0;
377 POSITION(BEGINNING_OF(match_pos));
381 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
384 $ write sys$output "Generate elf64-ia64.c from elfxx-ia64.c"
385 $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
386 []elfXX-ia64.c /output=[]elf64-ia64.c
387 $ write sys$output "Generate elf64-target.h from elfxx-target.h"
388 $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
389 []elfXX-target.h /output=[]elf64-target.h
392 $ append sys$input build.com
394 $ DEFS=DEFS + ",""unlink=remove"",""DEBUGDIR=""""GNU$DEBUGDIR:"""""""
396 $ CFLAGS="/name=(as_is,shortened)" + -
397 "/include=([],""../"",""../include"")" + -
398 "/define=(" + DEFS + ")" + OPT
399 $ FILES=FILES + "archive,archive64,archures,bfd,bfdio,binary,cache,coffgen,"+-
400 "compress,corefile,dwarf2,elf,format,hash,ihex,init,libbfd,linker,"+-
401 "opncls,reloc,section,simple,srec,stab-syms,syms,targets,tekhex,verilog"
402 $ write sys$output "CFLAGS=",CFLAGS
403 $ cflags_libbfd="/warning=(disable=missingreturn)"
408 $ F = F$ELEMENT(NUM,",",FILES)
409 $ IF F.EQS."," THEN GOTO END
410 $ eflags_name="cflags_''f'"
411 $ name_len=f$length(eflags_name)
412 $ dash_pos=f$locate("-",eflags_name)
413 $ if dash_pos.ne.name_len
415 $ eflags_name['dash_pos,1]:="_"
416 $ dash_pos=f$locate("-",eflags_name)
417 $ if dash_pos.ne.name_len then eflags_name['dash_pos,1]:="_"
419 $ if f$type('eflags_name).eqs."" then eflags_name="cflags_nil"
420 $ eflags='eflags_name
421 $ write sys$output "Compiling ", F, ".c", eflags
422 $ cc 'CFLAGS 'eflags 'F.c
423 $ IF OBJS.NES."" THEN OBJS=OBJS + ","
424 $ OBJS=OBJS + F + ".obj"
429 $ lib/create libbfd 'OBJS