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