Home | History | Annotate | Line # | Download | only in bfd
      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 (at] rmi.de)
      8 $! Rewritten by Tristan Gingold (gingold (at] adacore.com)
      9 $!
     10 $!   Copyright (C) 2012-2026 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_file_ptr@', FORWARD, EXACT, rang);
     64    IF match_pos <> 0 THEN;
     65       POSITION(BEGINNING_OF(match_pos));
     66       ERASE(match_pos);
     67       COPY_TEXT('bfd_signed_vma');
     68    ENDIF;
     69    match_pos := SEARCH_QUIETLY('@bfd_ufile_ptr@', FORWARD, EXACT, rang);
     70    IF match_pos <> 0 THEN;
     71       POSITION(BEGINNING_OF(match_pos));
     72       ERASE(match_pos);
     73       COPY_TEXT('bfd_vma');
     74    ENDIF;
     75    match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
     76    IF match_pos <> 0 THEN;
     77       POSITION(BEGINNING_OF(match_pos));
     78       ERASE(match_pos);
     79       COPY_TEXT('0');
     80    ENDIF;
     81    WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
     82    QUIT
     83 $  EOD
     84 $
     85 $else
     86 $
     87 $ write sys$output "Configuring for Vax target"
     88 $ target = "vax"
     89 $!
     90 $! copy bfd-in2.h to bfd.h, replacing @ macros
     91 $!
     92 $ write sys$output "Generated `bfd.h' from `bfd-in2.h'."
     93 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
     94         []bfd-in2.h /output=[]bfd.h
     95 $DECK
     96 !
     97 !  Copy file, changing lines with macros (@@)
     98 !
     99 !
    100    set (success,off);
    101 
    102    file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
    103    rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
    104 
    105    match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
    106    IF match_pos <> 0 THEN;
    107       POSITION(BEGINNING_OF(match_pos));
    108       ERASE(match_pos);
    109       COPY_TEXT('32');
    110    ENDIF;
    111    match_pos := SEARCH_QUIETLY('@bfd_default_target_size@', FORWARD, EXACT, rang);
    112    IF match_pos <> 0 THEN;
    113       POSITION(BEGINNING_OF(match_pos));
    114       ERASE(match_pos);
    115       COPY_TEXT('32');
    116    ENDIF;
    117    match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
    118    IF match_pos <> 0 THEN;
    119       POSITION(BEGINNING_OF(match_pos));
    120       ERASE(match_pos);
    121       COPY_TEXT('bfd_signed_vma');
    122    ENDIF;
    123    match_pos := SEARCH_QUIETLY('@bfd_ufile_ptr@', FORWARD, EXACT, rang);
    124    IF match_pos <> 0 THEN;
    125       POSITION(BEGINNING_OF(match_pos));
    126       ERASE(match_pos);
    127       COPY_TEXT('bfd_vma');
    128    ENDIF;
    129    match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
    130    IF match_pos <> 0 THEN;
    131       POSITION(BEGINNING_OF(match_pos));
    132       ERASE(match_pos);
    133       COPY_TEXT('0');
    134    ENDIF;
    135    WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
    136    QUIT
    137 $  EOD
    138 $endif
    139 $
    140 $!
    141 $! create bfdver.h
    142 $!
    143 $ write sys$output "Generate `bfdver.h' from 'version.h' and `configure.in'."
    144 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
    145         []version.h /output=[]bfdver.h
    146 $DECK
    147 !
    148 !  Copy file, changing lines with macros (@@)
    149 !
    150 !
    151    set (success,off);
    152    vfile := CREATE_BUFFER("vfile", "configure.in");
    153    rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
    154    match_pos := SEARCH_QUIETLY('AC_INIT([bfd], [', FORWARD, EXACT, rang);
    155    IF match_pos <> 0 THEN;
    156      POSITION(BEGINNING_OF(match_pos));
    157      ERASE(match_pos);
    158      vers := CURRENT_LINE-"])";
    159    ELSE;
    160      vers := "unknown";
    161    ENDIF;
    162    versnum := vers - "." - ".";
    163 
    164    file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
    165    rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
    166 
    167    match_pos := SEARCH_QUIETLY('@bfd_version@', FORWARD, EXACT, rang);
    168    IF match_pos <> 0 THEN;
    169       POSITION(BEGINNING_OF(match_pos));
    170       ERASE(match_pos);
    171       COPY_TEXT(versnum);
    172    ENDIF;
    173    match_pos := SEARCH_QUIETLY('@bfd_version_string@', FORWARD, EXACT, rang);
    174    IF match_pos <> 0 THEN;
    175       POSITION(BEGINNING_OF(match_pos));
    176       ERASE(match_pos);
    177       COPY_TEXT('"');
    178       COPY_TEXT(vers);
    179       COPY_TEXT('"');
    180    ENDIF;
    181    match_pos := SEARCH_QUIETLY('@bfd_version_package@', FORWARD, EXACT, rang);
    182    IF match_pos <> 0 THEN;
    183       POSITION(BEGINNING_OF(match_pos));
    184       ERASE(match_pos);
    185       COPY_TEXT('"(GNU Binutils) "');
    186    ENDIF;
    187    match_pos := SEARCH_QUIETLY('@report_bugs_to@', FORWARD, EXACT, rang);
    188    IF match_pos <> 0 THEN;
    189       POSITION(BEGINNING_OF(match_pos));
    190       ERASE(match_pos);
    191       COPY_TEXT('"<https://www.sourceware.org/bugzilla/>"');
    192    ENDIF;
    193    WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
    194    QUIT
    195 $  EOD
    196 $!
    197 $!
    198 $! create targmatch.h
    199 $!
    200 $ write sys$output "Generate `targmatch.h'"
    201 $ open/write tfile []targmatch.h
    202 $ write tfile "{ """ + target + "-*-*vms*""" + ","
    203 $ write tfile "#if defined (SELECT_VECS)"
    204 $ write tfile "SELECT_VECS"
    205 $ write tfile "#else"
    206 $ write tfile "UNSUPPORTED_TARGET"
    207 $ write tfile "#endif"
    208 $ write tfile "},"
    209 $ close tfile
    210 $!
    211 $!
    212 $! create config.h
    213 $!
    214 $ write sys$output "Generate `config.h'"
    215 $ create []config.h
    216 /* config.h-vms.  Generated by hand by Klaus Kmpf, kkaempf (at] didymus.rmi.de.  */
    217 /* config.in.  Generated automatically from configure.in by autoheader.  */
    218 /* Whether malloc must be declared even if <stdlib.h> is included.  */
    219 /* #undef NEED_DECLARATION_MALLOC */
    220 /* Whether free must be declared even if <stdlib.h> is included.  */
    221 /* #undef NEED_DECLARATION_FREE */
    222 /* Define if you have a working `mmap' system call.  */
    223 /* #define HAVE_MMAP 1 */
    224 /* Do we need to use the b modifier when opening binary files?  */
    225 /* #undef USE_BINARY_FOPEN */
    226 /* Name of host specific header file to include in trad-core.c.  */
    227 /* #undef TRAD_HEADER */
    228 /* Define only if <sys/procfs.h> is available *and* it defines prstatus_t.  */
    229 /* #undef HAVE_SYS_PROCFS_H */
    230 /* Do we really want to use mmap if it's available?  */
    231 /* #undef USE_MMAP */
    232 /* Define if you have the fcntl function.  */
    233 #define HAVE_FCNTL 1
    234 /* Define if you have the getpagesize function.  */
    235 #define HAVE_GETPAGESIZE 1
    236 /* Define if you have the madvise function.  */
    237 #define HAVE_MADVISE 1
    238 /* Define if you have the mprotect function.  */
    239 #define HAVE_MPROTECT 1
    240 /* Define if you have the <fcntl.h> header file.  */
    241 #define HAVE_FCNTL_H 1
    242 /* Define if you have the <stddef.h> header file.  */
    243 #define HAVE_STDDEF_H 1
    244 /* Define if you have the <stdlib.h> header file.  */
    245 #define HAVE_STDLIB_H 1
    246 /* Define if you have the <string.h> header file.  */
    247 #define HAVE_STRING_H 1
    248 /* Define if you have the <strings.h> header file.  */
    249 #define HAVE_STRINGS_H 1
    250 /* Define if you have the <sys/file.h> header file.  */
    251 #define HAVE_SYS_FILE_H 1
    252 /* Define if you have the <time.h> header file.  */
    253 #define HAVE_TIME_H 1
    254 /* Define if you have the <unistd.h> header file.  */
    255 #define HAVE_UNISTD_H 1
    256 /* Disable NLS  */
    257 #undef ENABLE_NLS
    258 /* Name of package */
    259 #define PACKAGE "bfd"
    260 /* Define to the address where bug reports for this package should be sent. */
    261 #define PACKAGE_BUGREPORT ""
    262 /* Define to the full name of this package. */
    263 #define PACKAGE_NAME "bfd"
    264 /* Define to the full name and version of this package. */
    265 #define PACKAGE_STRING "bfd"
    266 /* Define to the one symbol short name of this package. */
    267 #define PACKAGE_TARNAME "bfd"
    268 /* Define to the home page for this package. */
    269 #define PACKAGE_URL ""
    270 /* Define to the version of this package. */
    271 #define PACKAGE_VERSION "(package version)"
    272 $!
    273 $ write sys$output "Copy sysdep.h"
    274 $ copy [.hosts]alphavms.h sysdep.h
    275 $
    276 $ write sys$output "Generate build.com"
    277 $!
    278 $ if ARCH.eqs."alpha"
    279 $ then
    280 $   create build.com
    281 $DECK
    282 $ DEFS="""SELECT_VECS=&alpha_vms_vec"","+-
    283   """SELECT_ARCHITECTURES=&bfd_alpha_arch"""
    284 $ FILES="cpu-alpha,vms,vms-hdr,vms-gsd,vms-tir,vms-misc,"
    285 $EOD
    286 $ endif
    287 $ if ARCH.eqs."ia64"
    288 $ then
    289 $   create build.com
    290 $DECK
    291 $ DEFS="""SELECT_VECS=&ia64_elf64_vms_vec"","+-
    292   """SELECT_ARCHITECTURES=&bfd_ia64_arch"""
    293 $ FILES="cpu-ia64,elf64-ia64,elf-strtab,corefile,stabs,merge,elf-eh-frame,"+-
    294   "elflink,elf-attrs,dwarf1,elf64,"
    295 $EOD
    296 $ create substxx.tpu
    297 $DECK
    298    set (success,off);
    299    file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
    300    found_range := CREATE_RANGE(BEGINNING_OF(file), BEGINNING_OF(file));
    301 
    302    LOOP
    303      rang := CREATE_RANGE (END_OF(found_range),END_OF(file));
    304      match_pos := SEARCH_QUIETLY('NN', FORWARD, EXACT, rang);
    305      EXITIF match_pos = 0;
    306      POSITION(BEGINNING_OF(match_pos));
    307      ERASE(match_pos);
    308      COPY_TEXT('64');
    309    ENDLOOP;
    310    WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
    311    QUIT
    312 $  EOD
    313 $ write sys$output "Generate elf64-target.h from elfxx-target.h"
    314 $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
    315         []elfXX-target.h /output=[]elf64-target.h
    316 $ del substxx.tpu;*
    317 $ endif
    318 $ append sys$input build.com
    319 $DECK
    320 $ DEFS=DEFS + ",""unlink=remove"",""DEBUGDIR=""""GNU$DEBUGDIR:"""""""
    321 $ OPT="/noopt/debug"
    322 $ CFLAGS="/name=(as_is,shortened)" + -
    323   "/include=([],""../"",""../include"")" + -
    324   "/define=(" + DEFS + ")" + OPT
    325 $ FILES=FILES + "archive,archive64,archures,bfd,bfdio,binary,cache,coffgen,"+-
    326   "compress,corefile,dwarf2,elf,format,hash,ihex,init,libbfd,linker,"+-
    327   "opncls,reloc,section,simple,srec,stab-syms,syms,targets,tekhex,verilog"
    328 $ write sys$output "CFLAGS=",CFLAGS
    329 $ cflags_libbfd="/warning=(disable=missingreturn)"
    330 $ cflags_nil=""
    331 $ NUM = 0
    332 $ OBJS=""
    333 $ LOOP:
    334 $   F = F$ELEMENT(NUM,",",FILES)
    335 $   IF F.EQS."," THEN GOTO END
    336 $   eflags_name="cflags_''f'"
    337 $   name_len=f$length(eflags_name)
    338 $   dash_pos=f$locate("-",eflags_name)
    339 $   if dash_pos.ne.name_len
    340 $   then
    341 $     eflags_name['dash_pos,1]:="_"
    342 $     dash_pos=f$locate("-",eflags_name)
    343 $     if dash_pos.ne.name_len then eflags_name['dash_pos,1]:="_"
    344 $   endif
    345 $   if f$type('eflags_name).eqs."" then eflags_name="cflags_nil"
    346 $   eflags='eflags_name
    347 $   write sys$output "Compiling ", F, ".c", eflags
    348 $   cc 'CFLAGS 'eflags 'F.c
    349 $   IF OBJS.NES."" THEN OBJS=OBJS + ","
    350 $   OBJS=OBJS + F + ".obj"
    351 $   NUM = NUM + 1
    352 $   GOTO LOOP
    353 $ END:
    354 $ purge
    355 $ lib/create libbfd 'OBJS
    356 $EOD
    357