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