| 1 | $! |
| 2 | $! This file configures the bfd library for use with openVMS (Alpha and Vax) |
| 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 | $! |
| 9 | $arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2 |
| 10 | $arch = f$element(arch_indx,"|","|VAX|Alpha|") |
| 11 | $! |
| 12 | $if arch .eqs. "Alpha" |
| 13 | $then |
| 14 | $ write sys$output "Configuring for Alpha target" |
| 15 | $ target = "alpha" |
| 16 | $! |
| 17 | $! copy bfd-in2.h to bfd.h, replacing @ macros |
| 18 | $! |
| 19 | $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input - |
| 20 | []bfd-in2.h /output=[]bfd.h |
| 21 | $DECK |
| 22 | ! |
| 23 | ! Copy file, changing lines with macros (@@) |
| 24 | ! |
| 25 | ! |
| 26 | vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN"); |
| 27 | rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile)); |
| 28 | match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang); |
| 29 | IF match_pos <> 0 THEN; |
| 30 | POSITION(BEGINNING_OF(match_pos)); |
| 31 | ERASE(match_pos); |
| 32 | vers := CURRENT_LINE-")"; |
| 33 | ELSE; |
| 34 | vers := "unknown"; |
| 35 | ENDIF; |
| 36 | |
| 37 | file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); |
| 38 | rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file)); |
| 39 | |
| 40 | match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang); |
| 41 | IF match_pos <> 0 THEN; |
| 42 | POSITION(BEGINNING_OF(match_pos)); |
| 43 | ERASE(match_pos); |
| 44 | COPY_TEXT(vers); |
| 45 | ENDIF; |
| 46 | match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang); |
| 47 | IF match_pos <> 0 THEN; |
| 48 | POSITION(BEGINNING_OF(match_pos)); |
| 49 | ERASE(match_pos); |
| 50 | COPY_TEXT('64'); |
| 51 | ENDIF; |
| 52 | match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang); |
| 53 | IF match_pos <> 0 THEN; |
| 54 | POSITION(BEGINNING_OF(match_pos)); |
| 55 | ERASE(match_pos); |
| 56 | COPY_TEXT('0'); |
| 57 | ENDIF; |
| 58 | match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang); |
| 59 | IF match_pos <> 0 THEN; |
| 60 | POSITION(BEGINNING_OF(match_pos)); |
| 61 | ERASE(match_pos); |
| 62 | COPY_TEXT('__DECC'); |
| 63 | SPLIT_LINE; |
| 64 | COPY_TEXT('#include <ints.h>'); |
| 65 | ENDIF; |
| 66 | match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang); |
| 67 | IF match_pos <> 0 THEN; |
| 68 | POSITION(BEGINNING_OF(match_pos)); |
| 69 | ERASE(match_pos); |
| 70 | COPY_TEXT('int64'); |
| 71 | ENDIF; |
| 72 | match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang); |
| 73 | IF match_pos <> 0 THEN; |
| 74 | POSITION(BEGINNING_OF(match_pos)); |
| 75 | ERASE(match_pos); |
| 76 | COPY_TEXT('uint64'); |
| 77 | ENDIF; |
| 78 | WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); |
| 79 | QUIT |
| 80 | $ EOD |
| 81 | $ |
| 82 | $else |
| 83 | $ |
| 84 | $ write sys$output "Configuring for Vax target" |
| 85 | $ target = "vax" |
| 86 | $! |
| 87 | $! copy bfd-in2.h to bfd.h, replacing @ macros |
| 88 | $! |
| 89 | $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input - |
| 90 | []bfd-in2.h /output=[]bfd.h |
| 91 | $DECK |
| 92 | ! |
| 93 | ! Copy file, changing lines with macros (@@) |
| 94 | ! |
| 95 | ! |
| 96 | vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN"); |
| 97 | rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile)); |
| 98 | match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang); |
| 99 | IF match_pos <> 0 THEN; |
| 100 | POSITION(BEGINNING_OF(match_pos)); |
| 101 | ERASE(match_pos); |
| 102 | vers := CURRENT_LINE-")"; |
| 103 | ELSE; |
| 104 | vers := "unknown"; |
| 105 | ENDIF; |
| 106 | |
| 107 | file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name")); |
| 108 | rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file)); |
| 109 | |
| 110 | match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang); |
| 111 | IF match_pos <> 0 THEN; |
| 112 | POSITION(BEGINNING_OF(match_pos)); |
| 113 | ERASE(match_pos); |
| 114 | COPY_TEXT(vers); |
| 115 | ENDIF; |
| 116 | match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang); |
| 117 | IF match_pos <> 0 THEN; |
| 118 | POSITION(BEGINNING_OF(match_pos)); |
| 119 | ERASE(match_pos); |
| 120 | COPY_TEXT('32'); |
| 121 | ENDIF; |
| 122 | match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang); |
| 123 | IF match_pos <> 0 THEN; |
| 124 | POSITION(BEGINNING_OF(match_pos)); |
| 125 | ERASE(match_pos); |
| 126 | COPY_TEXT('0'); |
| 127 | ENDIF; |
| 128 | match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang); |
| 129 | IF match_pos <> 0 THEN; |
| 130 | POSITION(BEGINNING_OF(match_pos)); |
| 131 | ERASE(match_pos); |
| 132 | COPY_TEXT('__DECC'); |
| 133 | SPLIT_LINE; |
| 134 | COPY_TEXT('#include <ints.h>'); |
| 135 | ENDIF; |
| 136 | match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang); |
| 137 | IF match_pos <> 0 THEN; |
| 138 | POSITION(BEGINNING_OF(match_pos)); |
| 139 | ERASE(match_pos); |
| 140 | COPY_TEXT('int64'); |
| 141 | ENDIF; |
| 142 | match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang); |
| 143 | IF match_pos <> 0 THEN; |
| 144 | POSITION(BEGINNING_OF(match_pos)); |
| 145 | ERASE(match_pos); |
| 146 | COPY_TEXT('uint64'); |
| 147 | ENDIF; |
| 148 | WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file")); |
| 149 | QUIT |
| 150 | $ EOD |
| 151 | $endif |
| 152 | $ |
| 153 | $ write sys$output "Generated `bfd.h' from `bfd-in2.h'." |
| 154 | $! |
| 155 | $! |
| 156 | $! create targmatch.h |
| 157 | $! |
| 158 | $ open/write tfile []targmatch.h |
| 159 | $ write tfile "{ """ + target + "-*-*vms*""" + "," |
| 160 | $ write tfile "#if defined (SELECT_VECS)" |
| 161 | $ write tfile "SELECT_VECS" |
| 162 | $ write tfile "#else" |
| 163 | $ write tfile "UNSUPPORTED_TARGET" |
| 164 | $ write tfile "#endif" |
| 165 | $ write tfile "}," |
| 166 | $ close tfile |
| 167 | $ write sys$output "Generated `targmatch.h'" |
| 168 | $! |
| 169 | $! |
| 170 | $! create config.h |
| 171 | $! |
| 172 | $ create []config.h |