Merge branch 'vendor/BZIP'
[dragonfly.git] / contrib / binutils-2.20 / bfd / configure.com
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 $ arch=F$GETSYI("ARCH_NAME")
11 $ arch=F$EDIT(arch,"LOWERCASE")
12 $if arch .eqs. "alpha" then target = "alpha"
13 $if arch .eqs. "ia64" then target = "ia64"
14 $!
15 $if (arch .eqs. "alpha") .or. (arch .eqs. "ia64")
16 $then
17 $!
18 $ write sys$output "Configuring BFD for ''target' target"
19 $!
20 $!
21 $! copy bfd-in2.h to bfd.h, replacing @ macros
22 $!
23 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
24         []bfd-in2.h /output=[]bfd.h
25 $DECK
26 !
27 !  Copy file, changing lines with macros (@@)
28 !
29 !
30    set (success,off);
31    vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN");
32    rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
33    match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
34    IF match_pos <> 0 THEN;
35      POSITION(BEGINNING_OF(match_pos));
36      ERASE(match_pos);
37      vers := CURRENT_LINE-")";
38    ELSE;
39      vers := "unknown";
40    ENDIF;
41
42    file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
43    rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
44
45    match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang);
46    IF match_pos <> 0 THEN;
47       POSITION(BEGINNING_OF(match_pos));
48       ERASE(match_pos);
49       COPY_TEXT(vers);
50    ENDIF;
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('0');
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('0');
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('__DECC');
86       SPLIT_LINE;
87       COPY_TEXT('#include <ints.h>');
88    ENDIF;
89    match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
90    IF match_pos <> 0 THEN;
91       POSITION(BEGINNING_OF(match_pos));
92       ERASE(match_pos);
93       COPY_TEXT('int64');
94    ENDIF;
95    match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
96    IF match_pos <> 0 THEN;
97       POSITION(BEGINNING_OF(match_pos));
98       ERASE(match_pos);
99       COPY_TEXT('uint64');
100    ENDIF;
101    match_pos := SEARCH_QUIETLY('@BFD_HOSTPTR_T@', FORWARD, EXACT, rang);
102    IF match_pos <> 0 THEN;
103       POSITION(BEGINNING_OF(match_pos));
104       ERASE(match_pos);
105       COPY_TEXT('uint64');
106    ENDIF;
107    match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
108    IF match_pos <> 0 THEN;
109       POSITION(BEGINNING_OF(match_pos));
110       ERASE(match_pos);
111       COPY_TEXT('bfd_signed_vma');
112    ENDIF;
113    match_pos := SEARCH_QUIETLY('unsigned @bfd_file_ptr@ ufile_ptr', FORWARD, EXACT, rang);
114    IF match_pos <> 0 THEN;
115       POSITION(BEGINNING_OF(match_pos));
116       ERASE(match_pos);
117       COPY_TEXT('bfd_vma ufile_ptr');
118    ENDIF;
119    match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
120    IF match_pos <> 0 THEN;
121       POSITION(BEGINNING_OF(match_pos));
122       ERASE(match_pos);
123       COPY_TEXT('0');
124    ENDIF;
125    WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
126    QUIT
127 $  EOD
128 $
129 $else
130 $
131 $ write sys$output "Configuring for Vax target"
132 $ target = "vax"
133 $!
134 $! copy bfd-in2.h to bfd.h, replacing @ macros
135 $!
136 $ write sys$output "Generated `bfd.h' from `bfd-in2.h'."
137 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
138         []bfd-in2.h /output=[]bfd.h
139 $DECK
140 !
141 !  Copy file, changing lines with macros (@@)
142 !
143 !
144    set (success,off);
145    vfile := CREATE_BUFFER("vfile", "CONFIGURE.IN");
146    rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
147    match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
148    IF match_pos <> 0 THEN;
149      POSITION(BEGINNING_OF(match_pos));
150      ERASE(match_pos);
151      vers := CURRENT_LINE-")";
152    ELSE;
153      vers := "unknown";
154    ENDIF;
155
156    file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
157    rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
158
159    match_pos := SEARCH_QUIETLY('@VERSION@', FORWARD, EXACT, rang);
160    IF match_pos <> 0 THEN;
161       POSITION(BEGINNING_OF(match_pos));
162       ERASE(match_pos);
163       COPY_TEXT(vers);
164    ENDIF;
165    match_pos := SEARCH_QUIETLY('@wordsize@', FORWARD, EXACT, rang);
166    IF match_pos <> 0 THEN;
167       POSITION(BEGINNING_OF(match_pos));
168       ERASE(match_pos);
169       COPY_TEXT('32');
170    ENDIF;
171    match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
172    IF match_pos <> 0 THEN;
173       POSITION(BEGINNING_OF(match_pos));
174       ERASE(match_pos);
175       COPY_TEXT('0');
176    ENDIF;
177    match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang);
178    IF match_pos <> 0 THEN;
179       POSITION(BEGINNING_OF(match_pos));
180       ERASE(match_pos);
181       COPY_TEXT('__DECC');
182       SPLIT_LINE;
183       COPY_TEXT('#include <ints.h>');
184    ENDIF;
185    match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
186    IF match_pos <> 0 THEN;
187       POSITION(BEGINNING_OF(match_pos));
188       ERASE(match_pos);
189       COPY_TEXT('int64');
190    ENDIF;
191    match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
192    IF match_pos <> 0 THEN;
193       POSITION(BEGINNING_OF(match_pos));
194       ERASE(match_pos);
195       COPY_TEXT('uint64');
196    ENDIF;
197    WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
198    QUIT
199 $  EOD
200 $endif
201 $
202 $!
203 $! create bfdver.h
204 $!
205 $ write sys$output "Generate `bfdver.h' from 'version.h' and `configure.in'."
206 $ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
207         []version.h /output=[]bfdver.h
208 $DECK
209 !
210 !  Copy file, changing lines with macros (@@)
211 !
212 !
213    set (success,off);
214    vfile := CREATE_BUFFER("vfile", "configure.in");
215    rang := CREATE_RANGE(BEGINNING_OF(vfile), END_OF(vfile));
216    match_pos := SEARCH_QUIETLY('AM_INIT_AUTOMAKE(bfd, ', FORWARD, EXACT, rang);
217    IF match_pos <> 0 THEN;
218      POSITION(BEGINNING_OF(match_pos));
219      ERASE(match_pos);
220      vers := CURRENT_LINE-")";
221    ELSE;
222      vers := "unknown";
223    ENDIF;
224    versnum := vers - "." - ".";
225
226    file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
227    rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
228
229    match_pos := SEARCH_QUIETLY('@bfd_version@', FORWARD, EXACT, rang);
230    IF match_pos <> 0 THEN;
231       POSITION(BEGINNING_OF(match_pos));
232       ERASE(match_pos);
233       COPY_TEXT(versnum);
234    ENDIF;
235    match_pos := SEARCH_QUIETLY('@bfd_version_string@', FORWARD, EXACT, rang);
236    IF match_pos <> 0 THEN;
237       POSITION(BEGINNING_OF(match_pos));
238       ERASE(match_pos);
239       COPY_TEXT('"');
240       COPY_TEXT(vers);
241       COPY_TEXT('"');
242    ENDIF;
243    match_pos := SEARCH_QUIETLY('@bfd_version_package@', FORWARD, EXACT, rang);
244    IF match_pos <> 0 THEN;
245       POSITION(BEGINNING_OF(match_pos));
246       ERASE(match_pos);
247       COPY_TEXT('"(GNU Binutils) "');
248    ENDIF;
249    match_pos := SEARCH_QUIETLY('@report_bugs_to@', FORWARD, EXACT, rang);
250    IF match_pos <> 0 THEN;
251       POSITION(BEGINNING_OF(match_pos));
252       ERASE(match_pos);
253       COPY_TEXT('"<http://www.sourceware.org/bugzilla/>"');
254    ENDIF;
255    WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
256    QUIT
257 $  EOD
258 $!
259 $!
260 $! create targmatch.h
261 $!
262 $ write sys$output "Generate `targmatch.h'"
263 $ open/write tfile []targmatch.h
264 $ write tfile "{ """ + target + "-*-*vms*""" + ","
265 $ write tfile "#if defined (SELECT_VECS)"
266 $ write tfile "SELECT_VECS"
267 $ write tfile "#else"
268 $ write tfile "UNSUPPORTED_TARGET"
269 $ write tfile "#endif"
270 $ write tfile "},"
271 $ close tfile
272 $!
273 $!
274 $! create config.h
275 $!
276 $ write sys$output "Generate `config.h'"
277 $ create []config.h
278 /* config.h-vms.  Generated by hand by Klaus Kämpf, kkaempf@didymus.rmi.de.  */
279 /* config.in.  Generated automatically from configure.in by autoheader.  */
280 /* Whether malloc must be declared even if <stdlib.h> is included.  */
281 /* #undef NEED_DECLARATION_MALLOC */
282 /* Whether free must be declared even if <stdlib.h> is included.  */
283 /* #undef NEED_DECLARATION_FREE */
284 /* Define if you have a working `mmap' system call.  */
285 /* #define HAVE_MMAP 1 */
286 /* Do we need to use the b modifier when opening binary files?  */
287 /* #undef USE_BINARY_FOPEN */
288 /* Name of host specific header file to include in trad-core.c.  */
289 /* #undef TRAD_HEADER */
290 /* Define only if <sys/procfs.h> is available *and* it defines prstatus_t.  */
291 /* #undef HAVE_SYS_PROCFS_H */
292 /* Do we really want to use mmap if it's available?  */
293 /* #undef USE_MMAP */
294 /* Define if you have the fcntl function.  */
295 #define HAVE_FCNTL 1
296 /* Define if you have the getpagesize function.  */
297 #define HAVE_GETPAGESIZE 1
298 /* Define if you have the madvise function.  */
299 #define HAVE_MADVISE 1
300 /* Define if you have the mprotect function.  */
301 #define HAVE_MPROTECT 1
302 /* Define if you have the <fcntl.h> header file.  */
303 #define HAVE_FCNTL_H 1
304 /* Define if you have the <stddef.h> header file.  */
305 #define HAVE_STDDEF_H 1
306 /* Define if you have the <stdlib.h> header file.  */
307 #define HAVE_STDLIB_H 1
308 /* Define if you have the <string.h> header file.  */
309 #define HAVE_STRING_H 1
310 /* Define if you have the <strings.h> header file.  */
311 #define HAVE_STRINGS_H 1
312 /* Define if you have the <sys/file.h> header file.  */
313 #define HAVE_SYS_FILE_H 1
314 /* Define if you have the <time.h> header file.  */
315 #define HAVE_TIME_H 1
316 /* Define if you have the <unistd.h> header file.  */
317 #define HAVE_UNISTD_H 1
318 /* Disable NLS  */
319 #undef ENABLE_NLS
320 $!
321 $ write sys$output "Copy sysdep.h"
322 $ copy [.hosts]alphavms.h sysdep.h
323 $
324 $ write sys$output "Generate build.com"
325 $!
326 $ if ARCH.eqs."alpha"
327 $ then
328 $   create build.com
329 $DECK
330 $ DEFS="""SELECT_VECS=&vms_alpha_vec"","+-
331   """SELECT_ARCHITECTURES=&bfd_alpha_arch"""
332 $ FILES="cpu-alpha,vms,vms-hdr,vms-gsd,vms-tir,vms-misc,"
333 $EOD
334 $ endif
335 $ if ARCH.eqs."ia64"
336 $ then
337 $   create build.com
338 $DECK
339 $ DEFS="""SELECT_VECS=&bfd_elf64_ia64_vms_vec"","+-
340   """SELECT_ARCHITECTURES=&bfd_ia64_arch"""
341 $ FILES="cpu-ia64,elf64-ia64,elf-strtab,corefile,stabs,merge,elf-eh-frame,"+-
342   "elflink,elf-attrs,dwarf1,elf64,"
343 $EOD
344 $ create substxx.tpu
345 $DECK
346    set (success,off);
347    file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
348    found_range := CREATE_RANGE(BEGINNING_OF(file), BEGINNING_OF(file));
349
350    LOOP
351      rang := CREATE_RANGE (END_OF(found_range),END_OF(file));
352      match_pos := SEARCH_QUIETLY('NN', FORWARD, EXACT, rang);
353      EXITIF match_pos = 0;
354      POSITION(BEGINNING_OF(match_pos));
355      ERASE(match_pos);
356      COPY_TEXT('64');
357    ENDLOOP;
358    WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
359    QUIT
360 $  EOD
361 $ write sys$output "Generate elf64-ia64.c from elfxx-ia64.c"
362 $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
363         []elfXX-ia64.c /output=[]elf64-ia64.c
364 $ write sys$output "Generate elf64-target.h from elfxx-target.h"
365 $ edit/tpu/nojournal/nosection/nodisplay/command=substxx.tpu -
366         []elfXX-target.h /output=[]elf64-target.h
367 $ del substxx.tpu;*
368 $ endif
369 $ append sys$input build.com
370 $DECK
371 $ DEFS=DEFS + ",""unlink=remove"",""DEBUGDIR=""""GNU$DEBUGDIR:"""""""
372 $ OPT="/noopt/debug"
373 $ CFLAGS="/name=(as_is,shortened)" + -
374   "/include=([],""../"",""../include"")" + -
375   "/define=(" + DEFS + ")" + OPT
376 $ FILES=FILES + "archive,archive64,archures,bfd,bfdio,binary,cache,coffgen,"+-
377   "compress,corefile,dwarf2,elf,format,hash,ihex,init,libbfd,linker,"+-
378   "opncls,reloc,section,simple,srec,stab-syms,syms,targets,tekhex,verilog"
379 $ write sys$output "CFLAGS=",CFLAGS
380 $ cflags_libbfd="/warning=(disable=missingreturn)"
381 $ cflags_nil=""
382 $ NUM = 0
383 $ OBJS=""
384 $ LOOP:
385 $   F = F$ELEMENT(NUM,",",FILES)
386 $   IF F.EQS."," THEN GOTO END
387 $   eflags_name="cflags_''f'"
388 $   name_len=f$length(eflags_name)
389 $   dash_pos=f$locate("-",eflags_name)
390 $   if dash_pos.ne.name_len
391 $   then
392 $     eflags_name['dash_pos,1]:="_"
393 $     dash_pos=f$locate("-",eflags_name)
394 $     if dash_pos.ne.name_len then eflags_name['dash_pos,1]:="_"
395 $   endif
396 $   if f$type('eflags_name).eqs."" then eflags_name="cflags_nil"
397 $   eflags='eflags_name
398 $   write sys$output "Compiling ", F, ".c", eflags
399 $   cc 'CFLAGS 'eflags 'F.c
400 $   IF OBJS.NES."" THEN OBJS=OBJS + ","
401 $   OBJS=OBJS + F + ".obj"
402 $   NUM = NUM + 1
403 $   GOTO LOOP
404 $ END:
405 $ purge
406 $ lib/create libbfd 'OBJS
407 $EOD