2 # Please do not edit this file. It is generated automatically from
3 # configure.in and a configure template.
8 # Configuration script template
9 # Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
11 #This file is part of GNU.
13 #GNU CC is free software; you can redistribute it and/or modify
14 #it under the terms of the GNU General Public License as published by
15 #the Free Software Foundation; either version 1, or (at your option)
18 #GNU CC is distributed in the hope that it will be useful,
19 #but WITHOUT ANY WARRANTY; without even the implied warranty of
20 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 #GNU General Public License for more details.
23 #You should have received a copy of the GNU General Public License
24 #along with GNU CC; see the file COPYING. If not, write to
25 #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
30 # Shell script to create proper links to machine-dependent files in
31 # preparation for compiling gcc.
33 # Usage: configure [+srcdir=DIR] [+host=HOST] [+gas] [+nfp] TARGET
35 # If configure succeeds, it leaves its status in config.status.
36 # If configure fails after disturbing the status quo,
37 # config.status is removed.
49 #symbolic_link="echo ln -s"
51 # clear some things potentially inherited from environment.
70 -host=* | +host=* | +hos=* | +ho=* | +h=*)
71 host=`echo $arg | sed 's/[+-]h[a-z]*=//'`
73 -languages=* | +languages=* | +language=* | +languag=* \
74 | +langua=* | +langu=* | +lang=* | +lan=* | +la=* \
76 languages="$languages `echo $arg | sed 's/[+-]l[a-z]*=//'`"
78 -gas | +gas | +ga | +g)
81 -nfp | +nfp | +nf | +n)
84 -norecurse | +norecurse)
90 -srcdir=* | +srcdir=* | +srcdi=* | +srcd=* | +src=* | +sr=* | +s=*)
91 srcdir=`echo $arg | sed 's/[+-]s[a-z]*=//'`
93 -template=* | +template=*)
94 template=`echo $arg | sed 's/[+-]template=//'`
97 # Allow configure HOST TARGET
98 if [ x$host = x ] ; then host=$target ; fi
104 # process host and target only if not rebuilding configure itself or removing.
105 if [ -z "$template" -a -z "$removing" ]
107 # Complain if an arg is missing
110 echo "Usage: $progname [+srcdir=DIR] [+host=HOST] [+gas] [+nfp] TARGET"
111 echo -n "Where HOST and TARGET are something like "
112 echo "\`vax', \`sun3', \`encore', etc."
113 if [ -r config.status ]
127 #### configure.in files come in here.
128 # This file is a shell script fragment that supplies the information
129 # necessary to tailor a template configure script into the configure
130 # script appropriate for this directory. For more information, check
131 # any existing configure script.
133 configdirs="bfd binutils ld gas gcc"
134 srctrigger=README.configure
135 srcname="gnu development package"
136 ### end of configure.in
138 # are we rebuilding config itself?
139 if [ -n "$template" ]
141 if [ ! -r $template ]
143 echo "Can't find template ${template}."
147 mv configure configure.old
148 echo "#!/bin/sh" > configure
149 echo "# Please do not edit this file. It is generated automatically from" >> configure
150 echo "# configure.in and a configure template." >> configure
151 echo "configdirs=" >> configure
154 if [ -r configure.in ]
156 sed -e "/^####/ r configure.in" $template >> configure
158 cat $template >> configure
163 echo Rebuilt configure in `pwd`
165 if [ x$norecurse = x ]
167 while [ -n "$configdirs" ]
169 # set configdir to car of configdirs, configdirs to cdr of configdirs
170 set $configdirs; configdir=$1; shift; configdirs=$*
172 if [ "`echo ${configdir}.*`" != "${configdir}.*" ]
174 targetspecificdirs=${configdir}.*
179 for i in ${configdir} ${targetspecificdirs}
181 if [ -r $i/configure ]
184 configure +template=${template})
186 echo No configure script in `pwd`/$i
195 # Temporarily, we support only direct subdir builds.
196 hostsubdir=Host-${host}
197 targetsubdir=Target-${target}
199 if [ -n "${removing}" ]
201 if [ -d "${hostsubdir}/${targetsubdir}" ]
203 rm -rf ${hostsubdir}/${targetsubdir}
205 if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ]
210 rm -f .gdbinit Makefile config.status $links
213 if [ -n "$forcesubdirs" ]
215 # check for existing status before allowing forced subdirs.
218 echo "Makefile already exists in source directory. `pwd` not configured."
222 if [ ! -d $hostsubdir ] ; then mkdir $hostsubdir ; fi
225 if [ ! -d $targetsubdir ] ; then mkdir $targetsubdir ; fi
230 # if not subdir builds, then make sure none exist.
231 if [ -n "`(ls .) 2>&1 | grep Host-`" ]
233 echo "Configured subdirs exist. `pwd` not configured."
238 # Find the source files, if location was not specified.
243 if [ ! -r ${srctrigger} ]
249 if [ ! -r ${srcdir}/${srctrigger} ]
251 if [ -z "$srcdirdefaulted" ]
253 echo "$progname: Can't find ${srcname} sources in \`${srcdir}'." 1>&2
255 echo "$progname: Can't find ${srcname} sources in \`.' or \`..'." 1>&2
260 # Set up the list of links to be made.
261 # $links is the list of link names, and $files is the list of names to link to.
264 while [ -n "$files" ]
266 # set file to car of files, files to cdr of files
267 set $files; file=$1; shift; files=$*
268 set $links; link=$1; shift; links=$*
270 if [ ! -r ${srcdir}/${file} ]
272 echo "$progname: cannot create a link \"${link}\"," 1>&2
273 echo "since the file \"$file\" does not exist." 1>&2
279 # Make a symlink if possible, otherwise try a hard link
280 $symbolic_link ${srcdir}/$file $link 2>/dev/null || $hard_link ${srcdir}/$file $link
284 echo "$progname: unable to link \"$link\" to \"${srcdir}/$file\"." 1>&2
287 echo "Linked \"$link\" to \"${srcdir}/${file}\"."
290 # Create a .gdbinit file which runs the one in srcdir
291 # and tells GDB to look there for source files.
297 echo "dir ." > .gdbinit
298 echo "dir ${srcdir}" >> .gdbinit
299 echo "source ${srcdir}/.gdbinit" >> .gdbinit
303 # Install a makefile, and make it set VPATH
304 # if necessary so that the sources are found.
305 # Also change its value of srcdir.
307 # FIXME-someday: This business of always writing to .tem and mv back
308 # is so that I don't screw things up while developing. Once this
309 # template is stable, these should be optimized. xoxorich.
311 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
312 if [ x$host != x$target ]
314 echo "CROSS=-DCROSS_COMPILE" > Makefile
315 echo "ALL=start.encap" >> Makefile
317 echo "ALL=all.internal" > Makefile
320 # set target, host, VPATH
321 echo "host = $host" >> Makefile
322 echo "target = $target" >> Makefile
324 if [ -n "${forcesubdirs}" ]
326 echo "subdir = /${hostsubdir}/${targetsubdir}" >> Makefile
328 echo "subdir =" >> Makefile
331 # echo "workdir = `pwd`" >> Makefile
332 echo "VPATH = ${srcdir}" >> Makefile
335 cat ${srcdir}/Makefile.in >> Makefile
337 # and shake thoroughly.
338 host_var_file=hmake-${host}
339 target_var_file=tmake-${target}
341 # Conditionalize the makefile for this machine.
342 if [ -f ${srcdir}/config/${host_var_file} ]
344 sed -e "/^####/ r ${srcdir}/config/${host_var_file}" Makefile > Makefile.tem
345 mv Makefile.tem Makefile
348 if [ -f ${srcdir}/config/${target_var_file} ]
350 sed -e "/^####/ r ${srcdir}/config/${target_var_file}" Makefile > Makefile.tem
351 mv Makefile.tem Makefile
354 sed "s@^srcdir = \.@srcdir = ${srcdir}@" Makefile > Makefile.tem
355 mv Makefile.tem Makefile
357 # Remove all formfeeds, since some Makes get confused by them.
358 sed "s/
\f//" Makefile >> Makefile.tem
359 mv Makefile.tem Makefile
362 sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" Makefile > Makefile.tem
363 mv Makefile.tem Makefile
366 sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" Makefile > Makefile.tem
367 mv Makefile.tem Makefile
370 if [ -f ${srcdir}/config/${host_var_file} ]
372 using=" using \"${host_var_file}\""
375 if [ -f ${srcdir}/config/${target_var_file} ]
379 andusing=" using \"${target_var_file}\""
381 andusing="${using} and \"${target_var_file}\""
387 echo "Created \"Makefile\""${andusing}.
389 if [ x$host = x$target ]
391 echo "Links are now set up for use with a $target." \
393 # | tee ${srcdir}/config.status
395 echo "Links are now set up for host $host and target $target." \
397 # | tee ${srcdir}/config.status
404 # If there are subdirectories, then recurse.
406 if [ -n "$norecurse" ] ; then exit 0 ; fi
408 while [ -n "$configdirs" ]
410 # set configdir to car of configdirs, configdirs to cdr of configdirs
411 set $configdirs; configdir=$1; shift; configdirs=$*
413 # check for target override
414 targetspecificdir=${configdir}.${target}
415 if [ -d ${targetspecificdir} ]
417 configdir=${targetspecificdir}
420 echo Configuring ${configdir}...
422 ./configure ${forcesubdirs} ${removing} +host=${host} ${target}) \
430 # Revision 1.3 1991/04/11 02:41:51 rich
431 # Cut 2 config. Subdirs.
437 # end of configure.template