2 # Configuration script for GNU CHILL
3 # Copyright (C) 1994 Free Software Foundation, Inc.
5 #This file is part of GNU CC.
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)
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.
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. */
23 # Shell script to create proper links to machine-dependent files in
24 # preparation for compiling gcc.
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.
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.
46 # Configure the runtime and regression-test directories
47 SUBDIRS
="runtime utils"
48 SUBDIRS
="$SUBDIRS testsuite/compile"
49 SUBDIRS
="$SUBDIRS testsuite/execute"
50 SUBDIRS
="$SUBDIRS testsuite/execute/telebras"
51 SUBDIRS
="$SUBDIRS testsuite/noncompile"
52 SUBDIRS
="$SUBDIRS testsuite/examples"
53 SUBDIRS
="$SUBDIRS testsuite/execute/oe"
54 SUBDIRS
="$SUBDIRS testsuite/compile/elektra"
55 SUBDIRS
="$SUBDIRS testsuite/compile/votrics"
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'.
60 srcdir
=`echo $0 | sed 's|//|/|' | sed 's|/[^/]*$||'`
68 # Default prefix to /usr/local.
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!
77 local_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.
80 local_prefix
='$(prefix)'
81 # Default is to let the Makefile set exec_prefix from $(prefix)
82 exec_prefix
='$(prefix)'
84 # CYGNUS LOCAL. Default to nothing.
85 program_transform_name
=
86 program_transform_set
=
94 # Record all the arguments, to write them in config.status.
100 #symbolic_link="echo ln -s"
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'`"
142 program_transform_set
=yes
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'`,"
149 program_transform_set
=yes
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'`,"
156 program_transform_set
=yes
159 --site) # CYGNUS LOCAL
168 -srcdir |
--srcdir |
--srcdi |
--srcd |
--src |
--sr |
--s)
171 -srcdir=* |
--srcdir=* |
--srcdi=* |
--srcd=* |
--src=* |
--sr=* |
--s=*)
172 srcdir
=`echo $arg | sed 's/-*s[a-z]*=//'`
174 -host |
--host |
--hos |
--ho |
--h)
177 -host=* |
--host=* |
--hos=* |
--ho=* |
--h=*)
178 host=`echo $arg | sed 's/-*h[a-z]*=//'`
180 -target |
--target |
--targe |
--targ |
--tar |
--ta |
--t)
183 -target=* |
--target=* |
--targe=* |
--targ=* |
--tar=* |
--ta=* |
--t=*)
184 target
=`echo $arg | sed 's/-*t[a-z]*=//'`
186 -build |
--build |
--buil |
--bui |
--bu |
--b)
189 -build=* |
--build=* |
--buil=* |
--bui=* |
--bu=* |
--b=*)
190 build
=`echo $arg | sed 's/-*b[a-z]*=//'`
192 -prefix |
--prefix |
--prefi |
--pref |
--pre |
--pr |
--p)
195 -prefix=* |
--prefix=* |
--prefi=* |
--pref=* |
--pre=* |
--pr=* |
--p=*)
196 prefix
=`echo $arg | sed 's/-*p[a-z]*=//'`
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
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]*=//'`
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
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]*=//'`
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
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=*)
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'`"
237 program_transform_set
=yes
239 -program-prefix |
--program-prefix |
--program-prefi \
240 |
--program-pref |
--program-pre |
--program-pr \
242 next_arg
=--program-prefix
245 -program-prefix=* |
--program-prefix=* |
--program-prefi=* \
246 |
--program-pref=* |
--program-pre=* |
--program-pr=* \
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'`,"
253 program_transform_set
=yes
255 -program-suffix |
--program-suffix |
--program-suffi \
256 |
--program-suff |
--program-suf |
--program-su \
258 next_arg
=--program-suffix
261 -program-suffix=* |
--program-suffix=* |
--program-suffi=* \
262 |
--program-suff=* |
--program-suf=* |
--program-su=* \
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'`,"
269 program_transform_set
=yes
271 -site |
--site |
--sit) # CYGNUS LOCAL
274 -site=* |
--site=* |
--sit=* |
--si=*) # CYGNUS LOCAL
275 site
=`echo ${arg} | sed 's/^[-a-z]*=//'`
277 -with-gnu-ld |
--with-gnu-ld |
--with-gnu-l)
280 -gas |
--gas |
--ga |
--g |
-with-gnu-as |
--with-gnu-as |
-with-gnu-a)
283 -nfp |
--nfp |
--nf |
--n)
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)
292 -with-elf |
-with-el |
-with-se \
293 |
--with-elf |
--with-el |
--with-e \
298 -with-* |
--with-*) ;; #ignored
299 -without-* |
--without-*) ;; #ignored
300 -enable-* |
--enable-*) ;; #ignored
301 -x |
--x) ;; # ignored
302 -x-*=* |
--x-*=*) ;; # ignored
304 next_arg
=--x-ignored # ignored
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)
314 echo "Invalid option \`$arg'" 1>&2
318 # Allow configure HOST TARGET
329 # Find the source files, if location was not specified.
340 if [ ! -r ${srcdir}/grant.c
]
342 if [ x
$srcdirdefaulted = x
]
344 echo "$progname: Can't find CHILL frontend sources in \`${srcdir}'" 1>&2
346 echo "$progname: Can't find CHILL frontend sources in \`.' or \`..'" 1>&2
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
359 if [ -r ${srcdir}/config.status
] && [ x
$srcdir != x.
]
361 echo "$progname: \`configure' has been run in \`${srcdir}'" 1>&2
366 host_truncate_target
=
368 # Complain if an arg is missing
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.
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`
383 echo "This appears to be a ${build} system." 1>&2
385 elif [ x
$target != x
]
387 echo 'Config.guess failed to determine the host type. Defaulting to target.'
390 echo 'Config.guess failed to determine the host type. You need to specify one.' 1>&2
392 Usage: `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
]
398 tail +2 config.status
1>&2
404 # If $host was not specified, use $build.
410 # If $target was not specified, use $host.
416 # Validate the specs, and canonicalize them.
417 canon_build
=`/bin/sh $srcdir/../config.sub $build` ||
exit 1
418 canon_host
=`/bin/sh $srcdir/../config.sub $host` ||
exit 1
419 canon_target
=`/bin/sh $srcdir/../config.sub $target` ||
exit 1
422 if [ -f config.status
]; then mv -f config.status config.bak
; fi
425 # For the current directory and all of the designated SUBDIRS,
426 # do the rest of the script...
428 if [ ! -d testsuite
] ; then mkdir testsuite
; fi
430 for d
in $SUBDIRS; do
431 [ -d $srcdir/$d ] && _SUBDIRS
="$_SUBDIRS $d"
437 for subdir
in $_SUBDIRS
441 oldsrcdir
=$savesrcdir
443 # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
444 invsubdir
=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
447 # Also create a .gdbinit file which runs the one in srcdir
448 # and tells GDB to look there for source files.
453 srcdir
=${oldsrcdir}/${subdir} ;;
454 *) # otherwise relative
455 srcdir
=${invsubdir}${oldsrcdir}/${subdir} ;;
458 if [ -r ${oldsrcdir}/${subdir}/.gdbinit -a ${oldsrcdir} != "." ] ; then
459 cat > ${subdir}/.gdbinit
<<EOF
462 source ${srcdir}/.gdbinit
468 *) oldsrcdir
=${invsubdir}${oldsrcdir} ;;
470 mainsrcdir
=${oldsrcdir}/..
471 test -d $subdir || mkdir
$subdir
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.
478 echo "VPATH = ${srcdir}" \
479 |
cat - ${srcdir}/Makefile.
in \
480 |
sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.tem
482 # Conditionalize the makefile for this host machine.
483 if [ -f ${mainsrcdir}/config
/${host_xmake_file} ]
486 sed -e "/####host/ r ${mainsrcdir}/config/${host_xmake_file}" Makefile.tem
> Makefile.xx
487 echo "Merged ${host_xmake_file}."
489 mv Makefile.xx Makefile.tem
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
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
505 # Conditionalize the makefile for this target machine.
506 if [ -f ${mainsrcdir}/config
/${tmake_file} ]
509 sed -e "/####target/ r ${mainsrcdir}/config/${tmake_file}" Makefile.tem
> Makefile.xx
510 echo "Merged ${tmake_file}."
512 mv Makefile.xx Makefile.tem
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
521 # Conditionalize the makefile for this site.
522 if [ -f ${mainsrcdir}/config
/ms-
${site} ]
525 sed -e "/####site/ r ${mainsrcdir}/config/ms-${site}" Makefile.tem
> Makefile.xx
526 echo "Merged ms-${site}."
528 mv Makefile.xx Makefile.tem
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
539 mv Makefile.tem2 Makefile.tem
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
549 sed -e "s/\f//" -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
559 mv Makefile.xx Makefile.tem
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 ]
567 if [ x
$canon_host = x
$canon_build ]
569 mv Makefile.tem Makefile
571 # When building gcc with a cross-compiler, we need to fix a
573 echo "build= $build" > Makefile
574 sed -e "/####build/ r ${mainsrcdir}/build-make" Makefile.tem
>> Makefile
575 rm -f Makefile.tem Makefile.xx
579 echo "CROSS=-DCROSS_COMPILE" > Makefile
580 sed -e "/####cross/ r ${mainsrcdir}/cross-make" Makefile.tem
>> Makefile
581 rm -f Makefile.tem Makefile.xx
584 echo "Created \`$subdir/Makefile'."
586 if [ xx
${vint} != xx
]
591 # Describe the chosen configuration in config.status.
592 # Make that file a shellscript which will reestablish the same configuration.
595 if [ -f config.status
]; then mv -f config.status config.bak
; fi
598 # This directory was configured as follows:
599 cd $invsubdir; ${progname}" $arguments > config.new
600 echo echo host=$canon_host target
=$canon_target build
=$canon_build >> config.new
603 # If we aren't executing the configure script in .
604 if [ x
$subdir != x.
]
606 if [ -f $srcdir/configure
]
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
615 if [ -f config.bak
] && cmp config.bak config.new
>/dev
/null
2>/dev
/null
;
617 mv -f config.bak config.status
620 mv -f config.new config.status
625 done # end of current-dir SUBDIRS loop
629 # Describe the chosen configuration in config.status.
630 # Make that file a shellscript which will reestablish the same configuration.
632 # This directory was configured as follows:
633 ${progname}" $arguments > config.new
634 echo echo host=$canon_host target
=$canon_target build
=$canon_build >> config.new
636 if [ -f config.bak
] && cmp config.bak config.new
>/dev
/null
2>/dev
/null
;
638 mv -f config.bak config.status
641 mv -f config.new config.status