2 # Configuration script for GNU GAS
3 # Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
5 #This file is not yet part of GNU GAS.
7 #GNU GAS is free software; you can redistribute it and/or modify
8 #it under the terms of the GNU General Public License as published by
9 #the Free Software Foundation; either version 1, or (at your option)
12 #GNU GAS is distributed in the hope that it will be useful,
13 #but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 #GNU General Public License for more details.
17 #You should have received a copy of the GNU General Public License
18 #along with GNU GAS; see the file COPYING. If not, write to
19 #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 # Shell script to create proper links to machine-dependent files in
25 # preparation for compiling gas.
27 # Usage: configure [-srcdir=DIR] [-host=HOST] TARGET
29 # If configure succeeds, it leaves its status in config.status.
30 # If configure fails after disturbing the status quo,
31 # config.status is removed.
46 #symbolic_link="echo ln -s"
51 -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
52 srcdir=`echo $arg | sed 's/[+-]s[a-z]*=//'`
54 -host=* | +host=* | +hos=* | +ho=* | +h=*)
55 host=`echo $arg | sed 's/[+-]h[a-z]*=//'`
58 # Allow configure HOST TARGET
68 # Complain if an arg is missing
71 echo "Usage: $progname [+srcdir=DIR] [+host=HOST] TARGET"
72 echo -n "Where HOST and TARGET are something like "
73 echo "\`vax', \`sun3', \`encore', etc."
74 if [ -r config.status ]
87 # Find the source files, if location was not specified.
98 if [ ! -r ${srcdir}/as.c ]
100 if [ x$srcdirdefaulted = x ]
102 echo "$progname: Can't find assembler sources in \`${srcdir}'." 1>&2
104 echo "$progname: Can't find assembler sources in \`.' or \`..'." 1>&2
109 # Decode the host machine, then the target machine.
110 # For the host machine, we save the ho variable as host_ho;
111 # then we decode the target machine and forget everything else
112 # that came from the host machine.
113 for machine in $host $target; do
139 sun4 | sun4-aout | sun-4 | sun4-os4 | sun-4-os4)
194 if [ x$pass1done = x ]
196 if [ x$ho = x ]; then ho=$host; fi
197 if [ x$ho_header = x ]; then ho_ho_header=ho-$ho.h
198 else ho_ho_header=$ho_header
200 if [ x$make_var_file = x ]
201 then make_var_file=make-$ho; fi
202 ho_make_var_file=$make_var_file
205 host_make_var_file=$ho_make_var_file
206 ho_header=$ho_ho_header
211 # Default the machine-specific variables that were not explicitly set.
215 if [ x$te_header = x ]
216 then te_header=te-$te.h; fi
222 if [ x$tc_header = x ]
223 then tc_header=tc-$tc.h; fi
225 if [ x$tc_source = x ]
226 then tc_source=tc-$tc.c; fi
232 if [ x$obj_header = x ]
233 then obj_header=obj-$obj.h; fi
235 if [ x$obj_source = x ]
236 then obj_source=obj-$obj.c; fi
239 if [ x$atof_source = x ]
240 then atof_source=atof-ieee.c; fi
242 # Set up the list of links to be made.
243 # $links is the list of link names, and $files is the list of names to link to.
244 files="$ho_header $te_header $tc_header $tc_source $obj_header $obj_source $atof_source"
245 links="host.h targ-env.h targ-cpu.h targ-cpu.c obj-format.h obj-format.c atof-targ.c"
248 while [ -n "$files" ]
250 # set file to car of files, files to cdr of files
251 set $files; file=$1; shift; files=$*
252 set $links; link=$1; shift; links=$*
254 if [ ! -r ${srcdir}/config/$file ]
256 echo "$progname: cannot create a link \`$link'," 1>&2
257 echo "since the file \`config/$file' does not exist." 1>&2
263 # Make a symlink if possible, otherwise try a hard link
264 $symbolic_link ${srcdir}/config/$file $link 2>/dev/null || $hard_link ${srcdir}/config/$file $link
268 echo "$progname: unable to link \`$link' to \`${srcdir}/config/$file'." 1>&2
271 echo "Linked \`$link' to \`${srcdir}/config/$file'."
276 # Install a makefile, and make it set srcdir
277 # if necessary so that the sources are found.
278 # Also change its value of srcdir.
279 # Also create a .gdbinit file which runs the one in srcdir
280 # and tells GDB to look there for source files.
285 echo "VPATH = ${srcdir}" > x
286 cat x ${srcdir}/Makefile.in | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.in
288 echo "dir ." > .gdbinit
289 echo "dir ${srcdir}" >> .gdbinit
290 echo "source ${srcdir}/.gdbinit" >> .gdbinit
294 # Conditionalize the makefile for this machine.
295 if [ -f ${srcdir}/config/${host_make_var_file} ]
297 sed -e "/####/ r ${srcdir}/config/${host_make_var_file}" Makefile.in > Makefile.tem
299 cp Makefile.in Makefile.tem
302 # Remove all formfeeds, since some Makes get confused by them.
303 sed "s/
\f//" Makefile.tem > Makefile.tem1
305 # Delete the intermediate files
307 if [ x$srcdir != x. ]
313 # actual Makefile starts here.
315 echo "host = $host" > Makefile
316 echo "target = $target" >> Makefile
318 # Define macro CROSS_ASSEMBLE in compilation if this is a cross-assembler.
319 if [ x$host = x$target ]
321 sed "/^ALL=gas/s//ALL=bootstrap/" < Makefile.tem1 >> Makefile
323 echo "CROSS=-DCROSS_ASSEMBLE" >> Makefile
324 cat Makefile.tem1 >> Makefile
329 echo "Edited the makefile"
331 if [ x$host = x$target ]
333 echo "Links are now set up for use with a $target." \
336 echo "Links are now set up for host $host and target $target." \