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-2016 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_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 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
88 IF match_pos <> 0 THEN;
89 POSITION(BEGINNING_OF(match_pos));
93 match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
94 IF match_pos <> 0 THEN;
95 POSITION(BEGINNING_OF(match_pos));
97 COPY_TEXT('unsigned __int64');
99 match_pos := SEARCH_QUIETLY('@BFD_HOSTPTR_T@', FORWARD, EXACT, rang);
100 IF match_pos <> 0 THEN;
101 POSITION(BEGINNING_OF(match_pos));
103 COPY_TEXT('unsigned __int64');
105 match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
106 IF match_pos <> 0 THEN;
107 POSITION(BEGINNING_OF(match_pos));
109 COPY_TEXT('bfd_signed_vma');
111 match_pos := SEARCH_QUIETLY('unsigned @bfd_file_ptr@ ufile_ptr', FORWARD, EXACT, rang);
112 IF match_pos <> 0 THEN;
113 POSITION(BEGINNING_OF(match_pos));
115 COPY_TEXT('bfd_vma ufile_ptr');
117 match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
118 IF match_pos <> 0 THEN;
119 POSITION(BEGINNING_OF(match_pos));
123 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
129 $ write sys$output "Configuring for Vax target"
132 $! copy bfd-in2.h to bfd.h, replacing @ macros
134 $ write sys$output "Generated `bfd.h' from `bfd-in2.h'."
135 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
136 []bfd-in2.h /output=[]bfd.h
139 ! Copy file, changing lines with macros (@@)
144 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
145 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
147 match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
148 IF match_pos <> 0 THEN;
149 POSITION(BEGINNING_OF(match_pos));
153 match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
154 IF match_pos <> 0 THEN;
155 POSITION(BEGINNING_OF(match_pos));
159 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang);
160 IF match_pos <> 0 THEN;
161 POSITION(BEGINNING_OF(match_pos));
165 COPY_TEXT('#include <ints.h>');
167 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
168 IF match_pos <> 0 THEN;
169 POSITION(BEGINNING_OF(match_pos));
173 match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
174 IF match_pos <> 0 THEN;
175 POSITION(BEGINNING_OF(match_pos));
179 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
187 $ write sys$output "Generate `bfdver.h' from 'version.h' and `configure.in'."
188 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
189 []version.h /output=[]bfdver.h
192 ! Copy file, changing lines with macros (@@)
196 vfile := CREATE_BUFFER("vfile", "configure.in");
197 rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
198 match_pos := SEARCH_QUIETLY('AC_INIT([bfd], [', FORWARD, EXACT, rang);
199 IF match_pos <> 0 THEN;
200 POSITION(BEGINNING_OF(match_pos));
202 vers := CURRENT_LINE-"])";
206 versnum := vers - "." - ".";
208 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
209 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
211 match_pos := SEARCH_QUIETLY('@bfd_version@', FORWARD, EXACT, rang);
212 IF match_pos <> 0 THEN;
213 POSITION(BEGINNING_OF(match_pos));
217 match_pos := SEARCH_QUIETLY('@bfd_version_string@', FORWARD, EXACT, rang);
218 IF match_pos <> 0 THEN;
219 POSITION(BEGINNING_OF(match_pos));
225 match_pos := SEARCH_QUIETLY('@bfd_version_package@', FORWARD, EXACT, rang);
226 IF match_pos <> 0 THEN;
227 POSITION(BEGINNING_OF(match_pos));
229 COPY_TEXT('"(GNU Binutils) "');
231 match_pos := SEARCH_QUIETLY('@report_bugs_to@', FORWARD, EXACT, rang);
232 IF match_pos <> 0 THEN;
233 POSITION(BEGINNING_OF(match_pos));
235 COPY_TEXT('"<http://www.sourceware.org/bugzilla/>"');
237 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
242 $! create bfd_stdint.h
244 $ write sys$output "Generate `bfd_stdint.h'"
245 $ create []bfd_stdint.h
246 #include <inttypes.h>
249 $! create targmatch.h
251 $ write sys$output "Generate `targmatch.h'"
252 $ open/write tfile []targmatch.h
253 $ write tfile "{ """ + target + "-*-*vms*""" + ","
254 $ write tfile "#if defined (SELECT_VECS)"
255 $ write tfile "SELECT_VECS"
256 $ write tfile "#else"
257 $ write tfile "UNSUPPORTED_TARGET"
258 $ write tfile "#endif"
265 $ write sys$output "Generate `config.h'"
267 /* config.h-vms. Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de. */
268 /* config.in. Generated automatically from configure.in by autoheader. */
269 /* Whether malloc must be declared even if <stdlib.h> is included. */
270 /* #undef NEED_DECLARATION_MALLOC */
271 /* Whether free must be declared even if <stdlib.h> is included. */
272 /* #undef NEED_DECLARATION_FREE */
273 /* Define if you have a working `mmap' system call. */
274 /* #define HAVE_MMAP 1 */
275 /* Do we need to use the b modifier when opening binary files? */
276 /* #undef USE_BINARY_FOPEN */
277 /* Name of host specific header file to include in trad-core.c. */
278 /* #undef TRAD_HEADER */
279 /* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
280 /* #undef HAVE_SYS_PROCFS_H */
281 /* Do we really want to use mmap if it's available? */
282 /* #undef USE_MMAP */
283 /* Define if you have the fcntl function. */
285 /* Define if you have the getpagesize function. */
286 #define HAVE_GETPAGESIZE 1
287 /* Define if you have the madvise function. */
288 #define HAVE_MADVISE 1
289 /* Define if you have the mprotect function. */
290 #define HAVE_MPROTECT 1
291 /* Define if you have the <fcntl.h> header file. */
292 #define HAVE_FCNTL_H 1
293 /* Define if you have the <stddef.h> header file. */
294 #define HAVE_STDDEF_H 1
295 /* Define if you have the <stdlib.h> header file. */
296 #define HAVE_STDLIB_H 1
297 /* Define if you have the <string.h> header file. */
298 #define HAVE_STRING_H 1
299 /* Define if you have the <strings.h> header file. */
300 #define HAVE_STRINGS_H 1
301 /* Define if you have the <sys/file.h> header file. */
302 #define HAVE_SYS_FILE_H 1
303 /* Define if you have the <time.h> header file. */
304 #define HAVE_TIME_H 1
305 /* Define if you have the <unistd.h> header file. */
306 #define HAVE_UNISTD_H 1
309 /* Name of package */
310 #define PACKAGE "bfd"
311 /* Define to the address where bug reports for this package should be sent. */
312 #define PACKAGE_BUGREPORT ""
313 /* Define to the full name of this package. */
314 #define PACKAGE_NAME "bfd"
315 /* Define to the full name and version of this package. */
316 #define PACKAGE_STRING "bfd"
317 /* Define to the one symbol short name of this package. */
318 #define PACKAGE_TARNAME "bfd"
319 /* Define to the home page for this package. */
320 #define PACKAGE_URL ""
321 /* Define to the version of this package. */
322 #define PACKAGE_VERSION "(package version)"
324 $ write sys$output "Copy sysdep.h"
325 $ copy [.hosts]alphavms.h sysdep.h
327 $ write sys$output "Generate build.com"
329 $ if ARCH.eqs."alpha"
333 $ DEFS="""SELECT_VECS=&alpha_vms_vec"","+-
334 """SELECT_ARCHITECTURES=&bfd_alpha_arch"""
335 $ FILES="cpu-alpha,vms,vms-hdr,vms-gsd,vms-tir,vms-misc,"
342 $ DEFS="""SELECT_VECS=&ia64_elf64_vms_vec"","+-
343 """SELECT_ARCHITECTURES=&bfd_ia64_arch"""
344 $ FILES="cpu-ia64,elf64-ia64,elf-strtab,corefile,stabs,merge,elf-eh-frame,"+-
345 "elflink,elf-attrs,dwarf1,elf64,"
350 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
351 found_range := CREATE_RANGE(BEGINNING_OF(file), BEGINNING_OF(file));
354 rang := CREATE_RANGE (END_OF(found_range),END_OF(file));
355 match_pos := SEARCH_QUIETLY('NN', FORWARD, EXACT, rang);
356 EXITIF match_pos = 0;
357 POSITION(BEGINNING_OF(match_pos));
361 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
364 $ write sys$output "Generate elf64-target.h from elfxx-target.h"
365 $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
366 []elfXX-target.h /output=[]elf64-target.h
369 $ append sys$input build.com
371 $ DEFS=DEFS + ",""unlink=remove"",""DEBUGDIR=""""GNU$DEBUGDIR:"""""""
373 $ CFLAGS="/name=(as_is,shortened)" + -
374 "/include=([],""../"",""../include"")" + -
375 "/define=(" + DEFS + ")" + OPT
376 $ FILES=FILES + "archive,archive64,archures,bfd,bfdio,binary,cache,coffgen,"+-
377 "compress,corefile,dwarf2,elf,format,hash,ihex,init,libbfd,linker,"+-
378 "opncls,reloc,section,simple,srec,stab-syms,syms,targets,tekhex,verilog"
379 $ write sys$output "CFLAGS=",CFLAGS
380 $ cflags_libbfd="/warning=(disable=missingreturn)"
385 $ F = F$ELEMENT(NUM,",",FILES)
386 $ IF F.EQS."," THEN GOTO END
387 $ eflags_name="cflags_''f'"
388 $ name_len=f$length(eflags_name)
389 $ dash_pos=f$locate("-",eflags_name)
390 $ if dash_pos.ne.name_len
392 $ eflags_name['dash_pos,1]:="_"
393 $ dash_pos=f$locate("-",eflags_name)
394 $ if dash_pos.ne.name_len then eflags_name['dash_pos,1]:="_"
396 $ if f$type('eflags_name).eqs."" then eflags_name="cflags_nil"
397 $ eflags='eflags_name
398 $ write sys$output "Compiling ", F, ".c", eflags
399 $ cc 'CFLAGS 'eflags 'F.c
400 $ IF OBJS.NES."" THEN OBJS=OBJS + ","
401 $ OBJS=OBJS + F + ".obj"
406 $ lib/create libbfd 'OBJS