X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gas%2Fconfig-gas.com;h=cf5248af5da95d5e20346d3571d03b064d80c4e7;hb=1f1799d5ad9c8f2af8bebf4df515507c87659a9c;hp=48e2e49dc8dbaefa2508426a63243702cc54d2b6;hpb=4b0dd31c9f7606f6675a462320e047b56ad7412c;p=deliverable%2Fbinutils-gdb.git diff --git a/gas/config-gas.com b/gas/config-gas.com index 48e2e49dc8..cf5248af5d 100644 --- a/gas/config-gas.com +++ b/gas/config-gas.com @@ -1,76 +1,186 @@ -$! +$!config-gas.com $! This file sets things up to build gas on a VMS system to generate object $! files for a VMS system. We do not use the configure script, since we $! do not have /bin/sh to execute it. $! -$! If you are running this file, then obviously the host is vax-dec-vms. -$! -$gas_host="vms" $! -$cpu_type="vax" -$emulation="generic" -$obj_format="vms" -$atof="vax" -$! -$! host specific information -$call link host.h [.config]ho-'gas_host'.h +$ gas_host="vms" +$ arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2 +$ arch = f$element(arch_indx,"|","|VAX|Alpha|") +$ if arch.eqs."VAX" +$ then +$ cpu_type="vax" +$ obj_format="vms" +$ atof="vax" +$ else +$ cpu_type="alpha" +$ obj_format="evax" +$ atof="ieee" +$ endif +$ emulation="generic" +$! +$ DELETE = "delete/noConfirm" +$ ECHO = "write sys$output" $! $! Target specific information -$call link targ-cpu.c [.config]tc-'cpu_type'.c -$call link targ-cpu.h [.config]tc-'cpu_type'.h -$call link targ-env.h [.config]te-'emulation'.h +$ call make "targ-cpu.h" "[.config]tc-''cpu_type'.h" +$ call make "targ-env.h" "[.config]te-''emulation'.h" $! $! Code to handle the object file format. -$call link obj-format.h [.config]obj-'obj_format'.h -$call link obj-format.c [.config]obj-'obj_format'.c +$ call make "obj-format.h" "[.config]obj-''obj_format'.h" $! -$! Code to handle floating point. -$call link atof-targ.c [.config]atof-'atof'.c +$! (not currently used for vax or alpha) +$ call make "itbl-cpu.h" "[.config]itbl-''cpu_type'.h" $! $! -$! Create the file version.opt, which helps identify the executalbe. +$! Create the file version.opt, which helps identify the executable. $! -$search version.c version_string,"="/match=and/output=t.tmp -$open ifile$ t.tmp +$if f$trnlnm("IFILE$").nes."" then close/noLog ifile$ +$search CONFIGURE.IN "AM_INIT_AUTOMAKE"/Exact/Output=config-gas-tmp.tmp +$open ifile$ config-gas-tmp.tmp $read ifile$ line $close ifile$ -$delete/nolog t.tmp; -$ijk=f$locate("""",line)+1 +$DELETE config-gas-tmp.tmp;* +$! Discard "AM_INIT_AUTOMAKE(gas, " and ")" parts. +$ijk=f$locate(",",line)+2 $line=f$extract(ijk,f$length(line)-ijk,line) -$ijk=f$locate("""",line) -$line=f$extract(0,ijk,line) -$ijk=f$locate("\n",line) +$ijk=f$locate(")",line) $line=f$extract(0,ijk,line) $! -$i=0 -$loop: -$elm=f$element(i," ",line) -$if elm.eqs."" then goto no_ident -$if (elm.les."9").and.(elm.ges."0") then goto write_ident -$i=i+1 -$goto loop -$! -$no_ident: -$elm="?.??" -$! -$! -$write_ident: -$open ifile$ version.opt/write -$write ifile$ "ident="+""""+elm+"""" +$ if f$search("version.opt").nes."" then DELETE version.opt;* +$copy _NL: version.opt +$open/Append ifile$ version.opt +$write ifile$ "identification="+""""+line+"""" $close ifile$ $! -$ ! -$ if f$search("config.status") .nes. "" then delete config.status.* -$ open/write file config.status -$ write file "Links are now set up for use with a vax running VMS." -$ close file -$ type config.status +$! Now write config.h. +$! +$ if f$search("config.h").nes."" then DELETE config.h;* +$copy _NL: config.h +$open/Append ifile$ config.h +$write ifile$ "/* config.h. Generated by config-gas.com. */ +$write ifile$ "#ifndef VERSION" +$write ifile$ "#define VERSION """,line,"""" +$write ifile$ "#endif" +$write ifile$ "/*--*/" +$if arch .eqs. "VAX" +$then +$append [.config]vms-conf.h ifile$: +$else +$ append [.config]vms-a-conf.h ifile$: +$endif +$close ifile$ +$ECHO "Created config.h." +$! +$! Check for, and possibly make, header file . +$! +$ if f$search("tmp-chk-h.*").nes."" then DELETE tmp-chk-h.*;* +$!can't use simple `#include HDR' with `gcc /Define="HDR="' +$!because the 2.6.[0-3] preprocessor handles it wrong (VMS-specific gcc bug) +$ create tmp-chk-h.c +int tmp_chk_h; /* guarantee non-empty output */ +#ifdef HAVE_STDIO_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_UNIXIO_H +#include +#endif +#ifdef HAVE_UNIXLIB_H +#include +#endif +$ on warning then continue +$ CHECK = "call tmp_chk_h" +$ CHECK "HAVE_STDIO_H" +$ if .not.$status +$ then type sys$input: + +? could not compile . + + If you're compiling with DEC C or VAX C, create config.status as an + empty file and start gnu make again. + + If you're compiling with GNU C, there is some setup problem and + gas configuration cannot proceed. + +$ DELETE tmp-chk-h.c;* +$ exit %x002C +$ endif +$! +$ CHECK "HAVE_UNISTD_H" +$ if .not.$status +$ then +$ if f$trnlnm("HFILE$").nes."" then close/noLog hfile$ +$ CHECK "HAVE_UNIXIO_H" +$ got_unixio = ($status .and. 1) +$ CHECK "HAVE_UNIXLIB_H" +$ got_unixlib = ($status .and. 1) +$ create []unistd.h !with rudimentary contents +/* substitute for building gas */ +#ifndef UNISTD_H +#define UNISTD_H + +$ open/Append hfile$ []unistd.h +$ if got_unixio +$ then write hfile$ "#include " +$ else append sys$input: hfile$: +/* some of the routines normally prototyped in */ +extern int creat(), open(), close(), read(), write(); +extern int access(), dup(), dup2(), fstat(), stat(); +extern long lseek(); +$ endif +$ write hfile$ "" +$ if got_unixlib +$ then write hfile$ "#include " +$ else append sys$input: hfile$: +/* some of the routines normally prototyped in */ +extern char *sbrk(), *getcwd(), *cuserid(); +extern int brk(), chdir(), chmod(), chown(), mkdir(); +extern unsigned getuid(), umask(); +$ endif +$ append sys$input: hfile$: + +#endif /*UNISTD_H*/ +$ close hfile$ +$ ECHO "Created ""[]unistd.h""." +$ endif !gcc '#include ' failed +$ DELETE tmp-chk-h.c;* +$ +$tmp_chk_h: subroutine +$ set noOn +$ hname = f$edit("<" + (p1 - "HAVE_" - "_H") + ".h>","LOWERCASE") +$ write sys$output "Checking for ''hname'." +$ if f$search("tmp-chk-h.obj").nes."" then DELETE tmp-chk-h.obj;* +$ define/noLog sys$error _NL: !can't use /User_Mode here due to gcc +$ define/noLog sys$output _NL: ! driver's use of multiple image activation +$ gcc /Include=([],[-.include]) /Define=("''p1'") tmp-chk-h.c +$!can't just check $status; gcc 2.6.[0-3] preprocessor doesn't set it correctly +$ ok = (($status.and.1).and.(f$search("tmp-chk-h.obj").nes."")) .or. %x10000000 +$ deassign sys$error !restore, more or less +$ deassign sys$output +$ if ok then DELETE tmp-chk-h.obj;* +$ exit ok +$ endsubroutine !tmp_chk_h +$ +$! +$! Done +$! +$ if f$search("config.status") .nes. "" then DELETE config.status;* +$ open/write cfile []config.status +$ write cfile "Links are now set up for use with a "+arch+" running VMS." +$ close cfile +$ type []config.status $exit $! $! -$link: -$subroutine -$if f$search(p1).nes."" then delete/nolog 'p1'; -$copy 'p2' 'p1' -$write sys$output "Linked ''p2' to ''p1'." -$endsubroutine +$make: subroutine +$ if f$search(p1).nes."" then DELETE 'p1';* +$ create 'p1' +$ if f$trnlnm("IFILE$").nes."" then close/noLog ifile$ +$ open/Append ifile$ 'p1' +$ write ifile$ "#include ""''f$string(p2 - "[.config]")'""" +$ close ifile$ +$ ECHO "Created ''p1' for ''p2'." +$endsubroutine !make