| 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-2014 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 |