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