1#!/bin/sh
2# Configuration script for GNU CHILL
3#   Copyright (C) 1994 Free Software Foundation, Inc.
4
5#This file is part of GNU CC.
6
7#GNU CC 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 2, or (at your option)
10#any later version.
11
12#GNU CC 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.
16
17#You should have received a copy of the GNU General Public License
18#along with GNU CC; see the file COPYING.  If not, write to
19#the Free Software Foundation, 59 Temple Place - Suite 330,
20#Boston, MA 02111-1307, USA.  */
21
22#
23# Shell script to create proper links to machine-dependent files in
24# preparation for compiling gcc.
25#
26# Options: --srcdir=DIR		specifies directory where sources are.
27# 	   --host=HOST		specifies host configuration.
28#	   --target=TARGET	specifies target configuration.
29#	   --build=TARGET	specifies configuration of machine you are
30#				using to compile GCC.
31#	   --prefix=DIR		specifies directory to install in.
32#	   --local-prefix=DIR	specifies directory to put local ./include in.
33#	   --exec-prefix=DIR	specifies directory to install executables in.
34#	   --with-gnu-ld	arrange to work with GNU ld.
35#	   --with-gnu-as	arrange to work with GAS.
36#	   --with-stabs		arrange to use stabs instead of host debug format.
37#	   --with-elf		arrange to use elf instead of host debug format.
38#	   --nfp		assume system has no FPU.
39#
40# If configure succeeds, it leaves its status in config.status.
41# If configure fails after disturbing the status quo, 
42# 	config.status is removed.
43#
44
45progname=$0
46# Configure the runtime and regression-test directories
47SUBDIRS="runtime utils"
48SUBDIRS="$SUBDIRS testsuite/compile"
49SUBDIRS="$SUBDIRS testsuite/execute"
50SUBDIRS="$SUBDIRS testsuite/execute/telebras"
51SUBDIRS="$SUBDIRS testsuite/noncompile"
52SUBDIRS="$SUBDIRS testsuite/examples"
53SUBDIRS="$SUBDIRS testsuite/execute/oe"
54SUBDIRS="$SUBDIRS testsuite/compile/elektra"
55SUBDIRS="$SUBDIRS testsuite/compile/votrics"
56
57# Default --srcdir to the directory where the script is found, 
58# if a directory was specified.
59# The second sed call is to convert `.//configure' to `./configure'.
60srcdir=`echo $0 | sed 's|//|/|' | sed 's|/[^/]*$||'`
61if [ x$srcdir = x$0 ]
62then
63srcdir=
64fi
65
66host=
67
68# Default prefix to /usr/local.
69prefix=/usr/local
70
71# local_prefix specifies where to find the directory /usr/local/include
72# We don't use $(prefix) for this
73# because we always want GCC to search /usr/local/include
74# even if GCC is installed somewhere other than /usr/local.
75# Think THREE TIMES before specifying any other value for this!
76# DO NOT make this use $prefix!
77local_prefix=/usr/local
78# CYGNUS LOCAL: for our purposes, this must be prefix.  This is apparently
79# only done for the benefit of glibc, and we don't use glibc.
80local_prefix='$(prefix)'
81# Default is to let the Makefile set exec_prefix from $(prefix)
82exec_prefix='$(prefix)'
83
84# CYGNUS LOCAL.  Default to nothing.
85program_transform_name=
86program_transform_set=
87site=
88
89remove=rm
90hard_link=ln
91symbolic_link='ln -s'
92copy=cp
93
94# Record all the arguments, to write them in config.status.
95arguments=$*
96
97#for Test
98#remove="echo rm"
99#hard_link="echo ln"
100#symbolic_link="echo ln -s"
101
102target=
103host=
104build=
105
106for arg in $*;
107do
108  case $next_arg in
109  --srcdir)
110    srcdir=$arg
111    next_arg=
112    ;;
113  --host)
114    host=$arg
115    next_arg=
116    ;;
117  --target)
118    target=$arg
119    next_arg=
120    ;;
121  --build)
122    build=$arg
123    next_arg=
124    ;;
125  --prefix)
126    prefix=$arg
127    next_arg=
128    ;;
129  --local-prefix)
130    local_prefix=$arg
131    next_arg=
132    ;;
133  --exec-prefix)
134    exec_prefix=$arg
135    next_arg=
136    ;;
137  --program-transform-name) # CYGNUS LOCAL
138    # Double any backslashes or dollar signs in the argument.
139    if [ -n "${arg}" ] ; then
140      program_transform_name="${program_transform_name} -e `echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
141    fi
142    program_transform_set=yes
143    next_arg=
144    ;;    
145  --program-prefix) # CYGNUS LOCAL
146    if [ -n "${arg}" ]; then
147      program_transform_name="${program_transform_name} -e s,^,`echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`,"
148    fi
149    program_transform_set=yes
150    next_arg=
151    ;;
152  --program-suffix) # CYGNUS LOCAL
153    if [ -n "${arg}" ]; then
154      program_transform_name="${program_transform_name} -e s,\$\$,`echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`,"
155    fi
156    program_transform_set=yes
157    next_arg=
158    ;;
159  --site) # CYGNUS LOCAL
160    site=${arg}
161    next_arg=
162    ;;
163  --x-*)
164    next_arg=
165    ;;
166  *)
167    case $arg in
168     -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
169	next_arg=--srcdir
170	;;
171     -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
172	srcdir=`echo $arg | sed 's/-*s[a-z]*=//'`
173	;;
174     -host | --host | --hos | --ho | --h)
175	next_arg=--host
176	;;
177     -host=* | --host=* | --hos=* | --ho=* | --h=*)
178	host=`echo $arg | sed 's/-*h[a-z]*=//'`
179	;; 
180     -target | --target | --targe | --targ | --tar | --ta | --t)
181	next_arg=--target
182	;;
183     -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
184	target=`echo $arg | sed 's/-*t[a-z]*=//'`
185	;; 
186     -build | --build | --buil | --bui | --bu | --b)
187	next_arg=--build
188	;;
189     -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
190	build=`echo $arg | sed 's/-*b[a-z]*=//'`
191	;; 
192     -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
193	next_arg=--prefix
194	;;
195     -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
196	prefix=`echo $arg | sed 's/-*p[a-z]*=//'`
197	;;
198     -local-prefix | --local-prefix | --local-prefi | --local-pref | --local-pre \
199	| --local-pr | --local-p | --local- | --local | --loc | --lo | --l)
200	next_arg=--local-prefix
201	;;
202     -local-prefix=* | --local-prefix=* | --local-prefi=* | --local-pref=* \
203	| --local-pre=* | --local-pr=* | --local-p=* | --local-=* | --local=* \
204	| --loc=* | --lo=* | --l=*)
205	local_prefix=`echo $arg | sed 's/-*l[-a-z]*=//'`
206	;;
207     -exec-prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre \
208	| --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
209	next_arg=--exec-prefix
210	;;
211     -exec-prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* \
212	| --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* \
213	| --exe=* | --ex=* | --e=*)
214	exec_prefix=`echo $arg | sed 's/-*e[-a-z]*=//'`
215	;;
216     -program-transform-name | --program-transform-name \
217	| --program-transform-nam | --program-transform-na \
218	| --program-transform-n | --program-transform- | --program-transform \
219	| --program-transfor | --program-transfo | --program-transf \
220	| --program-trans | --program-tran | --program-tra \
221	| --program-tr | --program-t)
222	next_arg=--program-transform-name
223	# CYGNUS LOCAL
224	;;
225     -program-transform-name=* | --program-transform-name=* \
226	| --program-transform-nam=* | --program-transform-na=* \
227	| --program-transform-n=* | --program-transform-=* \
228	| --program-transform=* | --program-transfor=* | --program-transfo=* \
229	| --program-transf=* | --program-trans=* | --program-tran=* \
230	| --program-tra=* | --program-tr=* | --program-t=*)
231	# CYGNUS LOCAL
232	arg=`echo ${arg} | sed -e 's/^[-a-z_]*=//'`
233	# Double any \ or $ in the argument.
234	if [ -n "${arg}" ] ; then
235	  program_transform_name="${program_transform_name} -e `echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
236	fi
237	program_transform_set=yes
238	;;
239     -program-prefix | --program-prefix | --program-prefi \
240	| --program-pref | --program-pre | --program-pr \
241	| --program-p)
242	next_arg=--program-prefix
243	# CYGNUS LOCAL
244	;;
245     -program-prefix=* | --program-prefix=* | --program-prefi=* \
246	| --program-pref=* | --program-pre=* | --program-pr=* \
247	| --program-p=*)
248	# CYGNUS LOCAL
249	arg=`echo ${arg} | sed -e 's/^[-a-z_]*=//'`
250	if [ -n "${arg}" ]; then
251	  program_transform_name="${program_transform_name} -e s,^,`echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`,"
252	fi
253	program_transform_set=yes
254	;;
255     -program-suffix | --program-suffix | --program-suffi \
256	| --program-suff | --program-suf | --program-su \
257	| --program-s)
258	next_arg=--program-suffix
259	# CYGNUS LOCAL
260	;;
261     -program-suffix=* | --program-suffix=* | --program-suffi=* \
262	| --program-suff=* | --program-suf=* | --program-su=* \
263	| --program-s=*)
264	# CYGNUS LOCAL
265	arg=`echo ${arg} | sed -e 's/^[-a-z_]*=//'`
266	if [ -n "${arg}" ]; then
267	  program_transform_name="${program_transform_name} -e s,\$\$,`echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`,"
268	fi
269	program_transform_set=yes
270	;;
271     -site | --site | --sit) # CYGNUS LOCAL
272	next_arg=--site
273	;;
274     -site=* | --site=* | --sit=* | --si=*) # CYGNUS LOCAL
275	site=`echo ${arg} | sed 's/^[-a-z]*=//'`
276	;;
277     -with-gnu-ld | --with-gnu-ld | --with-gnu-l)
278	gnu_ld=yes
279	;;
280     -gas | --gas | --ga | --g | -with-gnu-as | --with-gnu-as | -with-gnu-a)
281        gas=yes
282	;;
283     -nfp | --nfp | --nf | --n)
284	nfp=yes
285	;;
286     -with-stabs | -with-stab | -with-sta | -with-st | -with-s \
287	| --with-stabs | --with-stab | --with-sta | --with-st | --with-s \
288	| -stabs | -stab | -sta | -st  \
289	| --stabs | --stab | --sta | --st)
290	stabs=yes
291	;;
292     -with-elf | -with-el | -with-se \
293	| --with-elf | --with-el | --with-e \
294	| -elf | -el | -e \
295	|--elf | --el | --e)
296	elf=yes
297	;;
298     -with-* | --with-*) ;; #ignored
299     -without-* | --without-*) ;; #ignored
300     -enable-* | --enable-*) ;; #ignored
301     -x | --x) ;; # ignored
302     -x-*=* | --x-*=*) ;; # ignored
303     -x-* | --x-*)
304	next_arg=--x-ignored # ignored
305	;;
306     --he*) ;; # ignored for now (--help)
307     --vers*) ;; # ignored for now (--version)
308     -v | -verb* | --verb*) ;; # ignored for now (--verbose)
309     --program-*) ;; #ignored (--program-prefix, --program-suffix)
310     --c*) ;; #ignored (--cache-file)
311     --q*) ;; #ignored (--quiet)
312     --si*) ;; #ignored (--silent)
313     -*)
314	echo "Invalid option \`$arg'" 1>&2
315	exit 1
316	;;
317     *)
318# Allow configure HOST TARGET
319	if [ x$host = x ]
320	then
321		host=$target
322	fi
323	target=$arg
324	;;
325    esac
326  esac
327done
328
329# Find the source files, if location was not specified.
330if [ x$srcdir = x ]
331then
332	srcdirdefaulted=1
333	srcdir=.
334	if [ ! -r tree.c ]
335	then
336		srcdir=..
337	fi
338fi
339
340if [ ! -r ${srcdir}/grant.c ]
341then
342	if [ x$srcdirdefaulted = x ]
343	then
344	  echo "$progname: Can't find CHILL frontend sources in \`${srcdir}'" 1>&2
345	else
346	  echo "$progname: Can't find CHILL frontend sources in \`.' or \`..'" 1>&2
347	fi
348	exit 1
349fi
350
351# Make sure that scripts are executable
352[ -w ${srcdir} -a -f ${srcdir}/regression.sh   ] && \
353  chmod +x ${srcdir}/regression.sh 
354[ -w ${srcdir} -a -f ${srcdir}/regression.prpt ] && \
355  chmod +x ${srcdir}/regression.prpt
356[ -w ${srcdir} -a -f ${srcdir}/regression.awk3 ] && \
357  chmod +x ${srcdir}/regression.awk3
358
359if [ -r ${srcdir}/config.status ] && [ x$srcdir != x. ]
360then
361	echo "$progname: \`configure' has been run in \`${srcdir}'" 1>&2
362	exit 1
363fi
364
365host_xmake_file=
366host_truncate_target=
367
368# Complain if an arg is missing
369if [ x$build = x ]
370then
371	# If host was specified, always use it for build also to avoid
372	# confusion.  If someone wants a cross compiler where build != host,
373	# then they must specify build explicitly.  Since this case is
374	# extremely rare, it does not matter that it is slightly inconvenient.
375	if [ x$host != x ]
376	then
377		build=$host
378	
379	# This way of testing the result of a command substitution is
380	# defined by Posix.2 (section 3.9.1) as well as traditional shells.
381	elif build=`${srcdir}/../config.guess`
382	then
383		echo "This appears to be a ${build} system." 1>&2
384
385	elif [ x$target != x ]
386	then
387		echo 'Config.guess failed to determine the host type.  Defaulting to target.'
388		build=$target
389	else
390		echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
391		echo "\
392Usage: `basename $progname` [--host=HOST] [--build=BUILD]
393       [--prefix=DIR] [--gxx-include-dir=DIR] [--local-pref=DIR] [--exec-pref=DIR]
394       [--with-gnu-as] [--with-gnu-ld] [--with-stabs] [--with-elf] [--nfp] TARGET" 1>&2
395	echo "Where HOST, TARGET and BUILD are three-part configuration names " 1>&2
396		if [ -r config.status ]
397		then
398			tail +2 config.status 1>&2
399		fi
400		exit 1
401	fi
402fi
403
404# If $host was not specified, use $build.
405if [ x$host = x ]
406then
407	host=$build
408fi
409
410# If $target was not specified, use $host.
411if [ x$target = x ]
412then
413	target=$host
414fi
415
416# Validate the specs, and canonicalize them.
417canon_build=`/bin/sh $srcdir/../config.sub $build` || exit 1
418canon_host=`/bin/sh $srcdir/../config.sub $host` || exit 1
419canon_target=`/bin/sh $srcdir/../config.sub $target` || exit 1
420
421rm -f config.bak
422if [ -f config.status ]; then mv -f config.status config.bak; fi
423
424#
425# For the current directory and all of the designated SUBDIRS,
426# do the rest of the script...
427#
428if [ ! -d testsuite ] ; then mkdir testsuite; fi
429_SUBDIRS=
430for d in $SUBDIRS; do
431	[ -d $srcdir/$d ] && _SUBDIRS="$_SUBDIRS $d"
432done
433
434savesrcdir=$srcdir
435STARTDIR=`pwd`
436
437for subdir in $_SUBDIRS
438do
439	tmake_file=
440	host_xmake_file=
441	oldsrcdir=$savesrcdir
442
443	# ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
444	invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
445
446	# Re-adjust the path
447	# Also create a .gdbinit file which runs the one in srcdir
448	# and tells GDB to look there for source files.
449
450	case $oldsrcdir in
451	".") srcdir=. ;;
452	/*) # absolute path
453               	srcdir=${oldsrcdir}/${subdir}  ;;
454        *) # otherwise relative
455		srcdir=${invsubdir}${oldsrcdir}/${subdir} ;;
456	esac
457
458        if [ -r ${oldsrcdir}/${subdir}/.gdbinit -a ${oldsrcdir} != "." ] ; then
459		cat > ${subdir}/.gdbinit <<EOF
460dir .
461dir ${srcdir}
462source ${srcdir}/.gdbinit
463EOF
464	fi
465
466	case $oldsrcdir in
467	/*)	;;
468	*)	oldsrcdir=${invsubdir}${oldsrcdir} ;;
469	esac
470	mainsrcdir=${oldsrcdir}/..
471	test -d $subdir || mkdir $subdir
472	cd $subdir
473	#
474	# Create Makefile.tem from Makefile.in.
475	# Make it set VPATH if necessary so that the sources are found.
476	# Also change its value of srcdir.
477	rm -f Makefile.tem
478	echo "VPATH = ${srcdir}" \
479	  | cat - ${srcdir}/Makefile.in \
480	  | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.tem
481
482	# Conditionalize the makefile for this host machine.
483	if [ -f ${mainsrcdir}/config/${host_xmake_file} ]
484	then
485		rm -f Makefile.xx
486		sed -e "/####host/  r ${mainsrcdir}/config/${host_xmake_file}" Makefile.tem > Makefile.xx
487		echo "Merged ${host_xmake_file}."
488		rm -f Makefile.tem
489		mv Makefile.xx Makefile.tem
490	else
491	# Say in the makefile that there is no host_xmake_file,
492	# by using a name which (when interpreted relative to $srcdir/config)
493	# will duplicate another dependency: $srcdir/Makefile.in.
494		host_xmake_file=../Makefile.in
495	fi
496	
497	# Define variables host_canonical, build_canonical, and target_canonical
498	# because some Cygnus local changes in the Makefile depend on them.
499	echo host_canonical = ${canon_host} > Makefile.xx
500	echo target_canonical = ${canon_target} >> Makefile.xx
501	echo build_canonical = ${canon_build} >> Makefile.xx
502	cat Makefile.tem >> Makefile.xx
503	mv Makefile.xx Makefile.tem
504	
505	# Conditionalize the makefile for this target machine.
506	if [ -f ${mainsrcdir}/config/${tmake_file} ]
507	then
508		rm -f Makefile.xx
509		sed -e "/####target/  r ${mainsrcdir}/config/${tmake_file}" Makefile.tem > Makefile.xx
510		echo "Merged ${tmake_file}."
511		rm -f Makefile.tem
512		mv Makefile.xx Makefile.tem
513	else
514	# Say in the makefile that there is no tmake_file,
515	# by using a name which (when interpreted relative to $srcdir/config)
516	# will duplicate another dependency: $srcdir/Makefile.in.
517		tmake_file=../Makefile.in
518	fi
519	
520	# CYGNUS LOCAL
521	# Conditionalize the makefile for this site.
522	if [ -f ${mainsrcdir}/config/ms-${site} ]
523	then
524		rm -f Makefile.xx
525		sed -e "/####site/  r ${mainsrcdir}/config/ms-${site}" Makefile.tem > Makefile.xx
526		echo "Merged ms-${site}."
527		rm -f Makefile.tem
528		mv Makefile.xx Makefile.tem
529	fi
530	
531	# CYGNUS LOCAL
532	# If this is a cross compilation, and we have newlib in the build
533	# tree, then define inhibit_libc in LIBGCC2_CFLAGS.  This will cause
534	# __eprintf to be left out of libgcc.a, but that's OK because newlib
535	# has its own version of assert.h.
536	if [ x$host != x$target ]; then
537	  sed -e 's/^\(LIBGCC2_CFLAGS[ 	]*=[ 	]*\)/\1-Dinhibit_libc /' Makefile.tem > Makefile.tem2
538	  rm -f Makefile.tem
539	  mv Makefile.tem2 Makefile.tem
540	fi
541	
542	# Remove all formfeeds, since some Makes get confused by them.
543	# Also arrange to give the variables `target', `host_xmake_file',
544	# `tmake_file', `prefix', `local_prefix', `exec_prefix', `FIXINCLUDES'
545	# and `INSTALL_HEADERS_DIR' values in the Makefile from the values
546	# they have in this script.
547	# CYGNUS LOCAL: FLOAT_H, CROSS_FLOAT_H, objdir
548	rm -f Makefile.xx
549	sed -e "s///" -e "s/^target=.*$/target=${target}/" \
550	    -e "s|^xmake_file=.*$|xmake_file=${host_xmake_file}|" \
551	    -e "s|^tmake_file=.*$|tmake_file=${tmake_file}|" \
552	    -e "s|^version=.*$|version=${version}|" \
553	    -e "s|^prefix[ 	]*=.*|prefix = $prefix|" \
554	    -e "s|^local_prefix[ 	]*=.*|local_prefix = $local_prefix|" \
555	    -e "s|^exec_prefix[ 	]*=.*|exec_prefix = $exec_prefix|" \
556	    -e "s|^objdir[ 	]*=.*|objdir=`pwd`|" \
557	    Makefile.tem > Makefile.xx
558	rm -f Makefile.tem
559	mv Makefile.xx Makefile.tem
560	
561	# Install Makefile for real, after making final changes.
562	# Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
563	# Also use all.cross instead of all.internal, and add cross-make to Makefile.
564	if [ x$canon_host = x$canon_target ]
565	then
566		rm -f Makefile
567	  	if [ x$canon_host = x$canon_build ]
568		then
569			mv Makefile.tem Makefile
570		else
571	#		When building gcc with a cross-compiler, we need to fix a
572	#		few things.
573			echo "build= $build" > Makefile
574			sed -e "/####build/  r ${mainsrcdir}/build-make" Makefile.tem >> Makefile
575			rm -f Makefile.tem Makefile.xx
576		fi
577	else
578		rm -f Makefile
579		echo "CROSS=-DCROSS_COMPILE" > Makefile
580		sed -e "/####cross/  r ${mainsrcdir}/cross-make" Makefile.tem >> Makefile
581		rm -f Makefile.tem Makefile.xx
582	fi
583	
584	echo "Created \`$subdir/Makefile'."
585	
586	if [ xx${vint} != xx ]
587	then
588		vintmsg=" (vint)"
589	fi
590	
591	# Describe the chosen configuration in config.status.
592	# Make that file a shellscript which will reestablish the same configuration.
593
594	rm -f config.bak
595	if [ -f config.status ]; then mv -f config.status config.bak; fi
596
597	echo "#!/bin/sh
598	# This directory was configured as follows:
599cd $invsubdir; ${progname}" $arguments > config.new
600	echo echo host=$canon_host target=$canon_target build=$canon_build >> config.new
601	chmod a+x config.new
602
603	# If we aren't executing the configure script in .
604	if [ x$subdir != x. ]
605	then
606		if [ -f $srcdir/configure ]
607		then
608			echo "Running \`${CONFIG_SHELL-sh} $srcdir/configure $arguments\'"
609			${CONFIG_SHELL-sh} $srcdir/configure $arguments
610			echo "${srcdir}/configure" $arguments >> config.new
611			echo echo host=$canon_host target=$canon_target build=$canon_build >> config.new
612		fi
613	fi
614
615	if [ -f config.bak ] && cmp config.bak config.new >/dev/null 2>/dev/null;
616	then
617		mv -f config.bak config.status
618		rm -f config.new
619	else
620		mv -f config.new config.status
621		rm -f config.bak
622	fi
623
624	cd $STARTDIR
625done   # end of current-dir SUBDIRS loop
626	
627srcdir=$savesrcdir
628
629# Describe the chosen configuration in config.status.
630# Make that file a shellscript which will reestablish the same configuration.
631echo "#!/bin/sh
632# This directory was configured as follows:
633${progname}" $arguments > config.new
634echo echo host=$canon_host target=$canon_target build=$canon_build >> config.new
635chmod a+x config.new
636if [ -f config.bak ] && cmp config.bak config.new >/dev/null 2>/dev/null;
637then
638	mv -f config.bak config.status
639	rm -f config.new
640else
641	mv -f config.new config.status
642	rm -f config.bak
643fi
644
645exit 0
646