1$! 2$! This file configures the bfd library for use with openVMS. 3$! 4$! We do not use the configure script, since we do not have /bin/sh 5$! to execute it. 6$! 7$! Written by Klaus K"ampf (kkaempf@rmi.de) 8$! Rewritten by Tristan Gingold (gingold@adacore.com) 9$! 10$! Copyright (C) 2012-2020 Free Software Foundation, Inc. 11$! 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. 16$! 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. 21$! 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/>. 25$! 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" 30$! 31$if (arch .eqs. "alpha") .or. (arch .eqs. "ia64") 32$then 33$! 34$ write sys$output "Configuring BFD for ''target' target" 35$! 36$! 37$! copy bfd-in2.h to bfd.h, replacing @ macros 38$! 39$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input - 40 []bfd-in2.h /output=[]bfd.h 41$DECK 42! 43! Copy file, changing lines with macros (@@) 44! 45! 46 set (success,off); 47 48 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); 49 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file)); 50 51 match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang); 52 IF match_pos <> 0 THEN; 53 POSITION(BEGINNING_OF(match_pos)); 54 ERASE(match_pos); 55 COPY_TEXT('64'); 56 ENDIF; 57 match_pos := SEARCH_QUIETLY('@bfd_default_target_size@', FORWARD, EXACT, rang); 58 IF match_pos <> 0 THEN; 59 POSITION(BEGINNING_OF(match_pos)); 60 ERASE(match_pos); 61 COPY_TEXT('64'); 62 ENDIF; 63 match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang); 64 IF match_pos <> 0 THEN; 65 POSITION(BEGINNING_OF(match_pos)); 66 ERASE(match_pos); 67 COPY_TEXT('0'); 68 ENDIF; 69 match_pos := SEARCH_QUIETLY('@BFD_HOST_LONG_LONG@', FORWARD, EXACT, rang); 70 IF match_pos <> 0 THEN; 71 POSITION(BEGINNING_OF(match_pos)); 72 ERASE(match_pos); 73 COPY_TEXT('1'); 74 ENDIF; 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)); 78 ERASE(match_pos); 79 COPY_TEXT('1'); 80 ENDIF; 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)); 84 ERASE(match_pos); 85 COPY_TEXT('1'); 86 ENDIF; 87 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang); 88 IF match_pos <> 0 THEN; 89 POSITION(BEGINNING_OF(match_pos)); 90 ERASE(match_pos); 91 COPY_TEXT('__int64'); 92 ENDIF; 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)); 96 ERASE(match_pos); 97 COPY_TEXT('unsigned __int64'); 98 ENDIF; 99 match_pos := SEARCH_QUIETLY('@BFD_HOSTPTR_T@', FORWARD, EXACT, rang); 100 IF match_pos <> 0 THEN; 101 POSITION(BEGINNING_OF(match_pos)); 102 ERASE(match_pos); 103 COPY_TEXT('unsigned __int64'); 104 ENDIF; 105 match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang); 106 IF match_pos <> 0 THEN; 107 POSITION(BEGINNING_OF(match_pos)); 108 ERASE(match_pos); 109 COPY_TEXT('bfd_signed_vma'); 110 ENDIF; 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)); 114 ERASE(match_pos); 115 COPY_TEXT('bfd_vma ufile_ptr'); 116 ENDIF; 117 match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang); 118 IF match_pos <> 0 THEN; 119 POSITION(BEGINNING_OF(match_pos)); 120 ERASE(match_pos); 121 COPY_TEXT('0'); 122 ENDIF; 123 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); 124 QUIT 125$ EOD 126$ 127$else 128$ 129$ write sys$output "Configuring for Vax target" 130$ target = "vax" 131$! 132$! copy bfd-in2.h to bfd.h, replacing @ macros 133$! 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 137$DECK 138! 139! Copy file, changing lines with macros (@@) 140! 141! 142 set (success,off); 143 144 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); 145 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file)); 146 147 match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang); 148 IF match_pos <> 0 THEN; 149 POSITION(BEGINNING_OF(match_pos)); 150 ERASE(match_pos); 151 COPY_TEXT('32'); 152 ENDIF; 153 match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang); 154 IF match_pos <> 0 THEN; 155 POSITION(BEGINNING_OF(match_pos)); 156 ERASE(match_pos); 157 COPY_TEXT('0'); 158 ENDIF; 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)); 162 ERASE(match_pos); 163 COPY_TEXT('__DECC'); 164 SPLIT_LINE; 165 COPY_TEXT('#include <ints.h>'); 166 ENDIF; 167 match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang); 168 IF match_pos <> 0 THEN; 169 POSITION(BEGINNING_OF(match_pos)); 170 ERASE(match_pos); 171 COPY_TEXT('int64'); 172 ENDIF; 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)); 176 ERASE(match_pos); 177 COPY_TEXT('uint64'); 178 ENDIF; 179 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); 180 QUIT 181$ EOD 182$endif 183$ 184$! 185$! create bfdver.h 186$! 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 190$DECK 191! 192! Copy file, changing lines with macros (@@) 193! 194! 195 set (success,off); 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)); 201 ERASE(match_pos); 202 vers := CURRENT_LINE-"])"; 203 ELSE; 204 vers := "unknown"; 205 ENDIF; 206 versnum := vers - "." - "."; 207 208 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); 209 rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file)); 210 211 match_pos := SEARCH_QUIETLY('@bfd_version@', FORWARD, EXACT, rang); 212 IF match_pos <> 0 THEN; 213 POSITION(BEGINNING_OF(match_pos)); 214 ERASE(match_pos); 215 COPY_TEXT(versnum); 216 ENDIF; 217 match_pos := SEARCH_QUIETLY('@bfd_version_string@', FORWARD, EXACT, rang); 218 IF match_pos <> 0 THEN; 219 POSITION(BEGINNING_OF(match_pos)); 220 ERASE(match_pos); 221 COPY_TEXT('"'); 222 COPY_TEXT(vers); 223 COPY_TEXT('"'); 224 ENDIF; 225 match_pos := SEARCH_QUIETLY('@bfd_version_package@', FORWARD, EXACT, rang); 226 IF match_pos <> 0 THEN; 227 POSITION(BEGINNING_OF(match_pos)); 228 ERASE(match_pos); 229 COPY_TEXT('"(GNU Binutils) "'); 230 ENDIF; 231 match_pos := SEARCH_QUIETLY('@report_bugs_to@', FORWARD, EXACT, rang); 232 IF match_pos <> 0 THEN; 233 POSITION(BEGINNING_OF(match_pos)); 234 ERASE(match_pos); 235 COPY_TEXT('"<http://www.sourceware.org/bugzilla/>"'); 236 ENDIF; 237 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); 238 QUIT 239$ EOD 240$! 241$! 242$! create bfd_stdint.h 243$! 244$ write sys$output "Generate `bfd_stdint.h'" 245$ create []bfd_stdint.h 246#include <inttypes.h> 247$! 248$! 249$! create targmatch.h 250$! 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" 259$ write tfile "}," 260$ close tfile 261$! 262$! 263$! create config.h 264$! 265$ write sys$output "Generate `config.h'" 266$ create []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. */ 284#define HAVE_FCNTL 1 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 307/* Disable NLS */ 308#undef ENABLE_NLS 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)" 323$! 324$ write sys$output "Copy sysdep.h" 325$ copy [.hosts]alphavms.h sysdep.h 326$ 327$ write sys$output "Generate build.com" 328$! 329$ if ARCH.eqs."alpha" 330$ then 331$ create build.com 332$DECK 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," 336$EOD 337$ endif 338$ if ARCH.eqs."ia64" 339$ then 340$ create build.com 341$DECK 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," 346$EOD 347$ create substxx.tpu 348$DECK 349 set (success,off); 350 file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); 351 found_range := CREATE_RANGE(BEGINNING_OF(file), BEGINNING_OF(file)); 352 353 LOOP 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)); 358 ERASE(match_pos); 359 COPY_TEXT('64'); 360 ENDLOOP; 361 WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); 362 QUIT 363$ EOD 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 367$ del substxx.tpu;* 368$ endif 369$ append sys$input build.com 370$DECK 371$ DEFS=DEFS + ",""unlink=remove"",""DEBUGDIR=""""GNU$DEBUGDIR:""""""" 372$ OPT="/noopt/debug" 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)" 381$ cflags_nil="" 382$ NUM = 0 383$ OBJS="" 384$ LOOP: 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 391$ then 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]:="_" 395$ endif 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" 402$ NUM = NUM + 1 403$ GOTO LOOP 404$ END: 405$ purge 406$ lib/create libbfd 'OBJS 407$EOD 408