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 that supplies the information necessary
129 # to tailor a template configure script into the configure script
130 # appropriate for this directory. For more information, check any
131 # existing configure script.
137 ### end of configure.in
139 # are we rebuilding config itself?
140 if [ -n "$template" ]
142 if [ ! -r $template ]
144 echo "Can't find template ${template}."
148 mv configure configure.old
149 echo "#!/bin/sh" > configure
150 echo "# Please do not edit this file. It is generated automatically from" >> configure
151 echo "# configure.in and a configure template." >> configure
152 echo "configdirs=" >> configure
155 if [ -r configure.in ]
157 sed -e "/^####/ r configure.in" $template >> configure
159 cat $template >> configure
164 echo Rebuilt configure in `pwd`
166 if [ x$norecurse = x ]
168 while [ -n "$configdirs" ]
170 # set configdir to car of configdirs, configdirs to cdr of configdirs
171 set $configdirs; configdir=$1; shift; configdirs=$*
173 if [ "`echo ${configdir}.*`" != "${configdir}.*" ]
175 targetspecificdirs=${configdir}.*
180 for i in ${configdir} ${targetspecificdirs}
182 if [ -r $i/configure ]
185 configure +template=${template})
187 echo No configure script in `pwd`/$i
196 # Temporarily, we support only direct subdir builds.
197 hostsubdir=Host-${host}
198 targetsubdir=Target-${target}
200 if [ -n "${removing}" ]
202 if [ -d "${hostsubdir}/${targetsubdir}" ]
204 rm -rf ${hostsubdir}/${targetsubdir}
206 if [ -z "`(ls ${hostsubdir}) 2>&1 | grep Target-`" ]
211 rm -f .gdbinit Makefile config.status $links
214 if [ -n "$forcesubdirs" ]
216 # check for existing status before allowing forced subdirs.
219 echo "Makefile already exists in source directory. `pwd` not configured."
223 if [ ! -d $hostsubdir ] ; then mkdir $hostsubdir ; fi
226 if [ ! -d $targetsubdir ] ; then mkdir $targetsubdir ; fi
231 # if not subdir builds, then make sure none exist.
232 if [ -n "`(ls .) 2>&1 | grep Host-`" ]
234 echo "Configured subdirs exist. `pwd` not configured."
239 # Find the source files, if location was not specified.
244 if [ ! -r ${srctrigger} ]
250 if [ ! -r ${srcdir}/${srctrigger} ]
252 if [ -z "$srcdirdefaulted" ]
254 echo "$progname: Can't find ${srcname} sources in \`${srcdir}'." 1>&2
256 echo "$progname: Can't find ${srcname} sources in \`.' or \`..'." 1>&2
261 # Set up the list of links to be made.
262 # $links is the list of link names, and $files is the list of names to link to.
265 while [ -n "$files" ]
267 # set file to car of files, files to cdr of files
268 set $files; file=$1; shift; files=$*
269 set $links; link=$1; shift; links=$*
271 if [ ! -r ${srcdir}/${file} ]
273 echo "$progname: cannot create a link \"${link}\"," 1>&2
274 echo "since the file \"$file\" does not exist." 1>&2
280 # Make a symlink if possible, otherwise try a hard link
281 $symbolic_link ${srcdir}/$file $link 2>/dev/null || $hard_link ${srcdir}/$file $link
285 echo "$progname: unable to link \"$link\" to \"${srcdir}/$file\"." 1>&2
288 echo "Linked \"$link\" to \"${srcdir}/${file}\"."
291 # Create a .gdbinit file which runs the one in srcdir
292 # and tells GDB to look there for source files.
298 echo "dir ." > .gdbinit
299 echo "dir ${srcdir}" >> .gdbinit
300 echo "source ${srcdir}/.gdbinit" >> .gdbinit
304 # Install a makefile, and make it set VPATH
305 # if necessary so that the sources are found.
306 # Also change its value of srcdir.
308 # FIXME-someday: This business of always writing to .tem and mv back
309 # is so that I don't screw things up while developing. Once this
310 # template is stable, these should be optimized. xoxorich.
312 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
313 if [ x$host != x$target ]
315 echo "CROSS=-DCROSS_COMPILE" > Makefile
316 echo "ALL=start.encap" >> Makefile
318 echo "ALL=all.internal" > Makefile
321 # set target, host, VPATH
322 echo "host = $host" >> Makefile
323 echo "target = $target" >> Makefile
325 if [ -n "${forcesubdirs}" ]
327 echo "subdir = /${hostsubdir}/${targetsubdir}" >> Makefile
329 echo "subdir =" >> Makefile
332 # echo "workdir = `pwd`" >> Makefile
333 echo "VPATH = ${srcdir}" >> Makefile
336 cat ${srcdir}/Makefile.in >> Makefile
338 # and shake thoroughly.
339 host_var_file=hmake-${host}
340 target_var_file=tmake-${target}
342 # Conditionalize the makefile for this machine.
343 if [ -f ${srcdir}/config/${host_var_file} ]
345 sed -e "/^####/ r ${srcdir}/config/${host_var_file}" Makefile > Makefile.tem
346 mv Makefile.tem Makefile
349 if [ -f ${srcdir}/config/${target_var_file} ]
351 sed -e "/^####/ r ${srcdir}/config/${target_var_file}" Makefile > Makefile.tem
352 mv Makefile.tem Makefile
355 sed "s@^srcdir = \.@srcdir = ${srcdir}@" Makefile > Makefile.tem
356 mv Makefile.tem Makefile
358 # Remove all formfeeds, since some Makes get confused by them.
359 sed "s/
\f//" Makefile >> Makefile.tem
360 mv Makefile.tem Makefile
363 sed "s:^SUBDIRS =.*$:SUBDIRS = ${configdirs}:" Makefile > Makefile.tem
364 mv Makefile.tem Makefile
367 sed "s:^NONSUBDIRS =.*$:NONSUBDIRS = ${noconfigdirs}:" Makefile > Makefile.tem
368 mv Makefile.tem Makefile
371 if [ -f ${srcdir}/config/${host_var_file} ]
373 using=" using \"${host_var_file}\""
376 if [ -f ${srcdir}/config/${target_var_file} ]
380 andusing=" using \"${target_var_file}\""
382 andusing="${using} and \"${target_var_file}\""
388 echo "Created \"Makefile\""${andusing}.
390 if [ x$host = x$target ]
392 echo "Links are now set up for use with a $target." \
394 # | tee ${srcdir}/config.status
396 echo "Links are now set up for host $host and target $target." \
398 # | tee ${srcdir}/config.status
405 # If there are subdirectories, then recurse.
407 if [ -n "$norecurse" ] ; then exit 0 ; fi
409 while [ -n "$configdirs" ]
411 # set configdir to car of configdirs, configdirs to cdr of configdirs
412 set $configdirs; configdir=$1; shift; configdirs=$*
414 # check for target override
415 targetspecificdir=${configdir}.${target}
416 if [ -d ${targetspecificdir} ]
418 configdir=${targetspecificdir}
421 echo Configuring ${configdir}...
423 ./configure ${forcesubdirs} ${removing} +host=${host} ${target}) \
431 # Revision 1.3 1991/04/10 22:56:14 rich
438 # end of configure.template