Mips-specific bug-fix (for stabs-in-ecoff), and style fix. See ChangeLog.
[deliverable/binutils-gdb.git] / configure
CommitLineData
eb02fd64 1#!/bin/sh
eb02fd64 2
46f3c7cd 3# Configuration script
eb02fd64
RP
4# Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
5
6#This file is part of GNU.
7
063efd10
JG
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
eb02fd64 21
74cc5508
RP
22# $Id$
23
49b10446
RP
24# Please email any bugs, comments, and/or additions to this file to:
25# configure@cygnus.com
26
eb02fd64
RP
27#
28# Shell script to create proper links to machine-dependent files in
0df06ca0 29# preparation for compilation.
eb02fd64
RP
30#
31# If configure succeeds, it leaves its status in config.status.
32# If configure fails after disturbing the status quo,
33# config.status is removed.
34#
35
4d714963
RP
36# NOTE: This script contains support for a Cygnus experimental feature, called
37# +subdirs, which is currently, tentatively, de-supported.
c5ae5678 38
4d714963 39export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$)
c297d71e 40
eb02fd64
RP
41remove=rm
42hard_link=ln
43symbolic_link='ln -s'
44
45#for Test
46#remove="echo rm"
47#hard_link="echo ln"
48#symbolic_link="echo ln -s"
49
50# clear some things potentially inherited from environment.
6f8ac2d9
RP
51
52Makefile=Makefile
53Makefile_in=Makefile.in
b8f8fddc 54arguments=$*
6f8ac2d9
RP
55commontargets=
56configdirs=
4d714963
RP
57datadir=
58datadiroption=
0df06ca0 59defaulttargets=
0df06ca0 60fatal=
4d714963
RP
61floating_point=default
62gas=default
63hosts=
64#hostsubdir=
65#namesubdir=
66next_prefix=
67next_host=
68#next_namesubdir=
69#next_objdir=
3509822c 70next_site=
4d714963 71next_srcdir=
3509822c
RP
72next_target=
73next_tmpdir=
46766962 74norecursion=
4d714963
RP
75#objdir=
76#objdiroption=
77prefix=/usr/local
49b10446 78progname=
46766962 79recurring=
131a3881 80removing=
74cc5508 81srcdir=
ec342d7d 82srctrigger=
131a3881 83target=
0df06ca0 84targets=
4d714963
RP
85#targetsubdir=
86undefinedargs=
0df06ca0 87verbose=
0c72405d 88version="$Revision$"
4d714963
RP
89x11=default
90
4d714963
RP
91NO_EDIT="This file was generated automatically by configure. Do not edit."
92
93## this is a little touchy and won't always work, but...
94##
95## if the argv[0] starts with a slash then it is an absolute name that can be
96## used as is.
97##
98## otherwise, if argv[0] has no slash in it, we can assume that it is on the
99## path. Since PATH might include "." we also add `pwd` to the end of PATH.
100##
101## otherwise we prepend `pwd` to $0 and hope that will give us an absolute
102## path.
103##
104
105PWD=`pwd`
106
107if (echo $0 | grep '^/' > /dev/null) ; then
108 progname=$0
109elif (echo $0 | grep '/' > /dev/null) ; then
110 progname=${PWD}/$0
111else
112 progname=$0
113 PATH=$PATH:${PWD} ; export PATH
114fi
115
eb02fd64
RP
116for arg in $*;
117do
3509822c 118 # handle things that might have args following as separate words
4d714963
RP
119 if [ -n "${next_prefix}" ] ; then prefix=${arg} ; prefixoption="-prefix=${prefix}" ; next_prefix=
120 elif [ -n "${next_datadir}" ] ; then datadir=${arg} ; datadiroption="-datadir=${datadir}" ; next_datadir=
121# elif [ -n "${next_namesubdir}" ] ; then \
122# namesubdir=${arg} ; namesubdiroption="--namesubdir=${namesubdir}" ; next_namesubdir=
123# elif [ -n "${next_objdir}" ] ; then objdir=${arg} ; objdiroption="--objdir=${objdir}" ; next_objdir=
3509822c 124 elif [ -n "${next_site}" ] ; then site=${arg} ; next_site=
4d714963 125 elif [ -n "${next_srcdir}" ] ; then srcdir=${arg} ; next_srcdir=
3509822c
RP
126 elif [ -n "${next_target}" ] ; then
127 next_target=
4d714963
RP
128 if [ -z "${targets}" ] ; then
129 newtargets="${targets} ${arg}"
130 targets="${newtargets}"
131 else
132 echo '***' Can only configure for one target at a time.
133 fatal=yes
0df06ca0 134 fi
3509822c
RP
135 elif [ -n "${next_tmpdir}" ] ; then
136 next_tmpdir=
4d714963 137 tmpdiroption="--tmpdir=${arg}"
3509822c
RP
138 TMPDIR=${arg}
139
140 else
141 case ${arg} in
4d714963 142 -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* | --da=* | --d=*)
0e0643c7 143 datadir=`echo ${arg} | sed 's/^[-a-z]*=//'`
4d714963 144 datadiroption=${arg}
3509822c 145 ;;
4d714963
RP
146 -datadir | --datadir | --datadi | --datad | --data | --dat | --da | --d)
147 next_datadir=yes
3509822c 148 ;;
4d714963 149 -gas | --g*)
3509822c
RP
150 gas=yes
151 ;;
4d714963 152 -help | --he*)
3509822c
RP
153 fatal=true
154 ;;
4d714963
RP
155 -host=* | --host=* | --hos=* | --ho=*)
156# if [ -n "${hosts}" ] ; then
157# subdirs="--subdirs"
158# fi
159
160 if [ -z "${hosts}" ] ; then
0e0643c7 161 newhosts="${hosts} `echo ${arg} | sed 's/^[-a-z]*=//'`"
4d714963
RP
162 hosts="${newhosts}"
163 else
164 echo '***' Can only configure for one host at a time.
165 fatal=yes
166 fi
3509822c 167 ;;
4d714963
RP
168# -namesubdir | --namesubdir | --namesubdi | --namesubd | --namesub | --namesu | --names | --name | --nam | --na)
169# next_namesubdir=yes
170# ;;
171# -namesubdir=* | --namesubdir=* | --namesubdi=* | --namesubd=* | --namesub=* | --namesu=* | --names=* | --name=* | --nam=* | --na=*)
0e0643c7 172# namesubdir=`echo ${arg} | sed 's/^[-a-z]*=//'`
4d714963
RP
173# namesubdiroption=${arg}
174# ;;
175 -nfp | --nf*)
176 floating_point=no
3509822c 177 ;;
4d714963 178 -norecursion | --no*)
3509822c
RP
179 norecursion=true
180 ;;
4d714963
RP
181# -objdir=* | --objdir=* | --objdi=* | --objd=* | --obj=* | --ob=* | --o=*)
182# objdiroption=${arg}
0e0643c7 183# objdir=`echo ${arg} | sed 's/^[-a-z]*=//'`
4d714963
RP
184# ;;
185# -objdir | --objdir | --objdi | --objd | --obj | --ob | --o)
186# next_objdir=yes
187# ;;
188 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
0e0643c7 189 prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
4d714963 190 prefixoption=${arg}
3509822c 191 ;;
4d714963
RP
192 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
193 next_prefix=yes
3509822c 194 ;;
4d714963 195 -recurring | --recurring | --recurrin | --recurri | --recurr | --recur | --recu | --rec | --re)
3509822c
RP
196 recurring=true
197 arguments=`echo ${arguments} | sed "s:${arg}::"`
198 ;;
4d714963 199 -rm | --rm)
3509822c
RP
200 removing=${arg}
201 ;;
4d714963 202 -site=* | --site=* | --sit=* | --si=*)
0e0643c7 203 site=`echo ${arg} | sed 's/^[-a-z]*=//'`
3509822c 204 ;;
4d714963 205 -site | --site | --sit | --si)
3509822c
RP
206 next_site=yes
207 ;;
4d714963 208 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
0e0643c7 209 srcdir=`echo ${arg} | sed 's/^[-a-z]*=//'`
4d714963
RP
210 ;;
211 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
212 next_srcdir=yes
3509822c 213 ;;
4d714963
RP
214# -subdirs | --su*)
215# subdirs=${arg}
216# ;;
217 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=*)
218# if [ -n "${targets}" ] ; then
219# subdirs="--subdirs"
220# fi
221
222 if [ -z "${targets}" ] ; then
0e0643c7 223 newtargets="${targets} `echo ${arg} | sed 's/^[-a-z]*=//'`"
4d714963
RP
224 targets="${newtargets}"
225 else
226 echo '***' Can only configure for one target at a time.
227 fatal=yes
3509822c 228 fi
3509822c 229 ;;
4d714963 230 -target | --target | --targe | --targ | --tar | --ta)
3509822c
RP
231 next_target=yes
232 ;;
4d714963 233 -tmpdir=* | --tmpdir=* | --tmpdi=* | --tmpd=* | --tmp=* | --tm=*)
3509822c 234 tmpdiroption=${arg}
0e0643c7 235 TMPDIR=`echo ${arg} | sed 's/^[-a-z]*=//'`
3509822c 236 ;;
4d714963 237 -tmpdir | --tmpdir | --tmpdi | --tmpd | --tmp | --tm)
3509822c
RP
238 next_tmpdir=yes
239 ;;
4d714963 240 -v | -verbose | --v)
3509822c
RP
241 verbose=${arg}
242 ;;
0c72405d 243 -version | -V | --version | --V)
b940b7c2 244 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
0c72405d
RP
245 exit 0
246 ;;
4d714963
RP
247 -x | --x) ;;
248 -* | --*)
3509822c
RP
249 (echo ;
250 echo "Unrecognized option: \"${arg}\"". ;
251 echo) 1>&2
252 fatal=true
253 ;;
254 *)
4d714963
RP
255# if [ -n "${hosts}" ] ; then
256# subdirs="--subdirs"
257# fi
3509822c 258
4d714963
RP
259 if [ -z "${undefs}" ] ; then
260 newundefs="${undefs} ${arg}"
261 undefs=${newundefs}
262 else
263 echo '***' Can only configure for one host and one target at a time.
264 fatal=yes
265 fi
3509822c
RP
266 ;;
267 esac
268 fi
eb02fd64
RP
269done
270
4d714963
RP
271# process host and target
272if [ -z "${fatal}" ] ; then
273# # Complain if an arg is missing
274# if [ -z "${hosts}" ] ; then
275# (echo ;
276# echo "configure: No HOST specified." ;
277# echo) 1>&2
278# fatal=true
279# fi
280
281### This is a bit twisted.
282### * if all three are specified, this is an error.
283### * if we have neither hosts, nor unadorned args, this is an error.
284### * if no hosts are specified, then the unadorned args are hosts, but if
285### there were none, this is an error.
286### * if no targets are specified, then the unadorned args are targets, but if
287### there were no unadorned args, then the hosts are also targets.
288
289 if [ -n "${hosts}" -a -n "${targets}" -a -n "${undefs}" ] ; then
290 echo '***' Can only configure for one host and one target at a time.
291 fatal=yes
292 elif [ -z "${hosts}" -a -z "${undefs}" ] ; then
293 echo '***' You must tell me for which host you want to configure.
294 fatal=yes
49b10446 295 else
4d714963
RP
296 if [ -z "${hosts}" ] ; then
297 hosts=${undefs}
298 fi
49b10446 299
4d714963
RP
300 if [ -z "${targets}" ] ; then
301 if [ -n "${undefs}" ] ; then
302 targets=${undefs}
303 else
304 targets=${hosts}
305 fi
306 fi
eb02fd64 307 fi
131a3881 308fi
eb02fd64 309
0df06ca0
RP
310if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
311 (echo "Usage: configure HOST" ;
312 echo ;
313 echo "Options: [defaults in brackets]" ;
4d714963
RP
314 echo " -datadir=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
315 echo " -gas configure the compilers for use with gas. [native as]" ;
316 echo " -help print this message. [normal config]" ;
317 echo " -lang=LANG configure to build LANG. [gcc]" ;
318 echo " -nfp configure the compilers default to soft floating point. [hard float]" ;
319 echo " -norecursion configure this directory only. [recurse]" ;
320# echo " -objdir=ODIR configure in a parallel tree rooted in ODIR. [rooted in \".\"]" ;
321 echo " -prefix=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ;
322 echo " -rm remove this configuration. [build a configuration]" ;
323 echo " -site configure with site specific makefile" ;
324 echo " -srcdir=DIR find the sources in DIR. [\".\" or \"..\"]" ;
639665de 325# This is correctly aligned in the output, even though it isn't here.
4d714963
RP
326# echo " -subdirs configure in subdirectories. [in source directories]" ;
327 echo " -target=TARGET configure for TARGET. [TARGET = HOST]" ;
328 echo " -tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ;
0df06ca0
RP
329 echo ;
330 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
4d714963
RP
331# echo "Asking for more than one \"--target\" implies \"--subdirs\". Any other" ;
332# echo "options given will apply to all targets."
333 ) 1>&2
0df06ca0
RP
334
335 if [ -r config.status ] ; then
336 cat config.status
337 fi
338
339 exit 1
eb02fd64
RP
340fi
341
0c72405d 342configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
7da1d334 343
0c72405d 344if (${configsub} `echo ${hosts} | sed -e 's/ .*//'`) >/dev/null 2>&1 ; then
7da1d334
RP
345 true
346else
0c72405d 347 echo '***' cannot find config.sub.
7da1d334
RP
348 exit 1
349fi
350
4d714963
RP
351if [ -z "${srcdir}" ] ; then
352 if [ -r configure.in ] ; then
353 srcdir=.
4d714963
RP
354 else
355 echo '***' "Can't find configure.in. Try using -srcdir=some_dir"
eb02fd64
RP
356 exit 1
357 fi
4d714963 358fi
eb02fd64 359
bc58b41d 360
4d714963
RP
361### break up ${srcdir}/configure.in.
362if [ -z "`grep '^# per\-host:' ${srcdir}/configure.in`" ] ; then
363 echo '***' ${srcdir}/configure.in has no "per-host:" line. 1>&2
364 exit 1
365fi
49b10446 366
4d714963
RP
367if [ -z "`grep '^# per\-target:' ${srcdir}/configure.in`" ] ; then
368 echo '***' ${srcdir}/configure.in has no "per-target:" line. 1>&2
369 exit 1
370fi
c5ae5678 371
4d714963
RP
372if [ -z "${TMPDIR}" ] ; then
373 TMPDIR=/tmp ; export TMPDIR
374fi
eb02fd64 375
4d714963
RP
376# keep this filename short for &%*%$*# 14 char file names
377tmpfile=${TMPDIR}/cONf$$
378trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0
379
380# split ${srcdir}/configure.in into common, per-host, per-target,
381# and post-target parts. Post-target is optional.
382sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
383sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
384if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
385 sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
386 sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
c297d71e 387else
4d714963
RP
388 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
389 echo >${tmpfile}.pos
c297d71e 390fi
eb02fd64 391
c297d71e 392### do common part of configure.in
eb02fd64 393
c5ae5678 394. ${tmpfile}.com
eb02fd64 395
ec342d7d 396# some sanity checks on configure.in
0df06ca0 397if [ -z "${srctrigger}" ] ; then
4d714963 398 echo '***' srctrigger not set in ${PWD}/configure.in.
ec342d7d
RP
399 exit 1
400fi
401
0df06ca0
RP
402for host in ${hosts} ; do
403 # Default other arg
404 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
405 targets=${host}
406 defaulttargets=true
407 fi
eb02fd64 408
b8f8fddc
RP
409 host_alias=${host}
410
0c72405d 411 result=`${configsub} ${host}`
bc58b41d
RP
412 host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
413 host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
414 host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
415 host=${host_cpu}-${host_vendor}-${host_os}
ee8f0bd7 416 host_makefile_frag=config/mh-${host}
ba04ec6e
HS
417 if [ ! -f ${host_makefile_frag} ]
418 then
ee8f0bd7 419 host_makefile_frag=config/mh-${host_alias}
ba04ec6e 420 fi
6c18e393 421
c5ae5678 422 . ${tmpfile}.hst
eb02fd64 423
0df06ca0 424 for target in ${targets} ; do
eb02fd64 425
b8f8fddc 426 target_alias=${target}
0c72405d 427 result=`${configsub} ${target}`
bc58b41d
RP
428 target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
429 target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
430 target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
431 target=${target_cpu}-${target_vendor}-${target_os}
ee8f0bd7 432 target_makefile_frag=config/mt-${target}
ba04ec6e
HS
433 if [ ! -f ${target_makefile_frag} ]
434 then
ee8f0bd7 435 target_makefile_frag=config/mt-${target_alias}
ba04ec6e 436 fi
6408afba 437
c5ae5678 438 . ${tmpfile}.tgt
0df06ca0 439
4d714963
RP
440 if [ "${host_alias}" = "${target_alias}" ] ; then
441 subdirname=H-${host_alias}
442 else
443 subdirname=X-${host_alias}-${target_alias}
444 fi
49b10446 445
4d714963
RP
446 if [ -n "${namesubdir}" ] ; then
447 subdirname=${namesubdir}
448 fi
0df06ca0 449
4d714963
RP
450 if [ -n "${removing}" ] ; then
451# if [ -n "${objdir}" ] ; then
452# echo '***' --rm not supported for --objdir. Just \"rm -rf ${objdir}\" by hand.
453# exit 1
454# fi
455
456# if [ -n "${subdirs}" ] ; then
457# if [ -d "${subdirname}" ] ; then
458# rm -rf ${hostsubdir}
459# else
460# echo Warning: no ${PWD}/${hostsubdir} to remove.
461# fi
462# else
063efd10 463 rm -f ${Makefile} config.status ${links}
4d714963 464# fi
74cc5508 465 else
4d714963
RP
466# if [ -n "${objdir}" ]; then
467# srcdir=${PWD}
468# cd ${objdir}
469# fi
470
471# if [ -n "${subdirs}" ] ; then
472# # check for existing status before allowing forced subdirs.
473# if [ -f ${Makefile} ] ; then
474# echo '***' "${Makefile} already exists in source directory. ${PWD} not configured." 1>&2
475# exit 1
476# fi
477#
478# # use a subdir common to all targets for this host iff: this is a cross AND
479# # this tool does not claim to be target dependent AND we have not been asked to name the subdir.
480# if [ ${host_alias} != ${target_alias} -a -z "${target_dependent}" -a -z "${namesubdiroption}" ]
481# then
482# if [ ! -d H-${host_alias} ] ; then mkdir H-${host_alias} ; fi
483#
484# if (${symbolic_link} ${subdirname} H-${host_alias} 2> /dev/null) ; then
485# true
486# else # just give up. they lose.
487# rmdir H-${host_alias}
488# if [ ! -d ${subdirname} ] ; then mkdir ${subdirname} ; fi
489# fi
490# elif [ ! -d ${subdirname} ] ; then
491# mkdir ${subdirname}
492# fi
493#
494# cd ${subdirname}
495#
496# if [ -z "${srcdir}" ] ; then
497# srcdir=..
498# fi
499# elif [ "`echo H-*`" != "H-*" -a "`echo X-*`" != "X-*" ] ; then
500# # if not subdir builds, then make sure none exist.
501# # We might miss if there are explicitly named subdirs.
502# echo '***' "Configured subdirs exist. ${PWD} not configured." 1>&2
503# exit 1
504# else
505# true
506# fi
eb02fd64 507
0df06ca0
RP
508 # Find the source files, if location was not specified.
509 if [ -z "${srcdir}" ] ; then
510 srcdirdefaulted=1
511 srcdir=.
4d714963 512 if [ ! -r ${srctrigger} ] ; then
0df06ca0
RP
513 srcdir=..
514 fi
515 fi
eb02fd64 516
4d714963 517 if [ ! -r ${srcdir}/${srctrigger} ] ; then
0df06ca0 518 if [ -z "${srcdirdefaulted}" ] ; then
4d714963 519 echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/${srcdir}" 1>&2
0df06ca0 520 else
4d714963 521 echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/. or ${PWD}/.." 1>&2
0df06ca0 522 fi
eb02fd64 523
bc58b41d 524 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
0df06ca0
RP
525 exit 1
526 fi
131a3881 527
0df06ca0
RP
528 # Set up the list of links to be made.
529 # ${links} is the list of link names, and ${files} is the list of names to link to.
eb02fd64 530
0df06ca0
RP
531 # Make the links.
532 while [ -n "${files}" ] ; do
533 # set file to car of files, files to cdr of files
534 set ${files}; file=$1; shift; files=$*
535 set ${links}; link=$1; shift; links=$*
131a3881 536
0df06ca0 537 if [ ! -r ${srcdir}/${file} ] ; then
bc58b41d
RP
538 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
539 echo '***' "since the file \"${file}\" does not exist." 1>&2
0df06ca0
RP
540 exit 1
541 fi
131a3881 542
0df06ca0
RP
543 ${remove} -f ${link}
544 rm -f config.status
545 # Make a symlink if possible, otherwise try a hard link
546 ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link}
131a3881 547
0df06ca0 548 if [ ! -r ${link} ] ; then
bc58b41d 549 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
0df06ca0
RP
550 exit 1
551 fi
bc58b41d
RP
552
553 if [ -n "${verbose}" ] ; then
554 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
555 fi
0df06ca0 556 done
131a3881 557
0df06ca0
RP
558 # Create a .gdbinit file which runs the one in srcdir
559 # and tells GDB to look there for source files.
560
4d714963
RP
561 if [ -r ${srcdir}/.gdbinit ] ; then
562 case ${srcdir} in
563 .)
564 ;;
565 *)
566 echo "# "${NO_EDIT} > .gdbinit
567 echo "dir ." >> .gdbinit
568 echo "dir ${srcdir}" >> .gdbinit
569 echo "source ${srcdir}/.gdbinit" >> .gdbinit
570 ;;
571 esac
572 fi
0df06ca0
RP
573
574 # Install a makefile, and make it set VPATH
575 # if necessary so that the sources are found.
576 # Also change its value of srcdir.
577
578 # FIXME-someday: This business of always writing to .tem and mv back
579 # is so that I don't screw things up while developing. Once this
580 # template is stable, these should be optimized. xoxorich.
581
582 # Define macro CROSS_COMPILE in compilation if this is a cross-compiler.
583 if [ "${host}" != "${target}" ] ; then
063efd10 584 echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
0c72405d 585 echo "ALL=all.cross" >> ${Makefile}
0df06ca0 586 else
063efd10 587 echo "ALL=all.internal" > ${Makefile}
0df06ca0 588 fi
131a3881 589
0df06ca0 590 # set target, host, VPATH
b8f8fddc
RP
591 echo "host_alias = ${host_alias}" >> ${Makefile}
592 echo "host_cpu = ${host_cpu}" >> ${Makefile}
593 echo "host_vendor = ${host_vendor}" >> ${Makefile}
594 echo "host_os = ${host_os}" >> ${Makefile}
1395529c 595
b8f8fddc
RP
596 echo "target_alias = ${target_alias}" >> ${Makefile}
597 echo "target_cpu = ${target_cpu}" >> ${Makefile}
598 echo "target_vendor = ${target_vendor}" >> ${Makefile}
599 echo "target_os = ${target_os}" >> ${Makefile}
131a3881 600
4d714963
RP
601# if [ -n "${subdirs}" ] ; then
602# (echo "subdir = /${subdirname}" ;
603# echo "unsubdir = ..") >> ${Makefile}
604# else
49b10446
RP
605 (echo "subdir =" ;
606 echo "unsubdir = .") >> ${Makefile}
4d714963 607# fi
131a3881 608
4d714963 609 # echo "workdir = ${PWD}" >> ${Makefile}
063efd10 610 echo "VPATH = ${srcdir}" >> ${Makefile}
eb02fd64 611
063efd10
JG
612 # add "Makefile.in" (or whatever it's called)
613 cat ${srcdir}/${Makefile_in} >> ${Makefile}
eb02fd64 614
28f3b094
RP
615 # Conditionalize the makefile for this site.
616 if [ -n "${site}" ] ; then
617 site_makefile_frag=config/ms-${site}
618
619 if [ -f ${srcdir}/${site_makefile_frag} ] ; then
620 (echo "site_makefile_frag = ${srcdir}/${site_makefile_frag}" ;
621 sed -e "/^####/ r ${srcdir}/${site_makefile_frag}" ${Makefile}) > Makefile.tem
622 else
623 (echo "site_makefile_frag =" ;
624 cat ${Makefile}) > Makefile.tem
625 fi
626 mv Makefile.tem ${Makefile}
627 fi
628
0df06ca0 629 # Conditionalize the makefile for this host.
ee8f0bd7
SC
630 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
631 (echo "host_makefile_frag = ${srcdir}/${host_makefile_frag}" ;
632 sed -e "/^####/ r ${srcdir}/${host_makefile_frag}" ${Makefile}) > Makefile.tem
633 else
634 (echo "host_makefile_frag =" ;
635 cat ${Makefile}) > Makefile.tem
636 fi
c5ae5678 637 mv Makefile.tem ${Makefile}
131a3881 638
0df06ca0 639 # Conditionalize the makefile for this target.
ee8f0bd7
SC
640 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
641 (echo "target_makefile_frag = ${srcdir}/${target_makefile_frag}" ;
642 sed -e "/^####/ r ${srcdir}/${target_makefile_frag}" ${Makefile}) > Makefile.tem
643 else
644 (echo "target_makefile_frag =" ;
645 cat ${Makefile}) > Makefile.tem
646 fi
c5ae5678 647 mv Makefile.tem ${Makefile}
ec342d7d 648
0df06ca0 649 # set srcdir
53b28d35 650 sed "s:^srcdir[ ]*=.*$:srcdir = ${srcdir}:" ${Makefile} > Makefile.tem
063efd10 651 mv Makefile.tem ${Makefile}
eb02fd64 652
4d714963
RP
653 # set prefix
654 if [ -n "${prefix}" ] ; then
e488e581 655 sed "s:^prefix[ ]*=.*$:prefix = ${prefix}:" ${Makefile} > Makefile.tem
28f3b094
RP
656 mv Makefile.tem ${Makefile}
657 fi
658
4d714963
RP
659 # set datadir
660 if [ -n "${datadir}" ] ; then
e488e581 661 sed "s:^datadir[ ]*=.*$:datadir = ${datadir}:" ${Makefile} > Makefile.tem
063efd10 662 mv Makefile.tem ${Makefile}
0df06ca0 663 fi
eb02fd64 664
0df06ca0 665 # reset SUBDIRS
e488e581 666 sed "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
063efd10 667 mv Makefile.tem ${Makefile}
eb02fd64 668
0df06ca0 669 # reset NONSUBDIRS
e488e581 670 sed "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
063efd10 671 mv Makefile.tem ${Makefile}
eb02fd64 672
7875b07f
RP
673 # remove any form feeds.
674 sed -e "s/\f//" ${Makefile} > Makefile.tem
675 mv Makefile.tem ${Makefile}
676
4d714963
RP
677 # prepend warning about editting.
678 echo "# "${NO_EDIT} > ${Makefile}.tem
679 cat ${Makefile} >> ${Makefile}.tem
680 mv Makefile.tem ${Makefile}
681
0df06ca0 682 using=
9d1e053b 683 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
c5ae5678 684 using="${using} and \"${host_makefile_frag}\""
0df06ca0 685 fi
9d1e053b 686 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
c5ae5678 687 using="${using} and \"${target_makefile_frag}\""
0df06ca0 688 fi
c5ae5678
RP
689 if [ -n "${site}" -a \
690 -f ${srcdir}/${site_makefile_frag} ] ; then
691 using="${using} and \"${site_makefile_frag}\""
7875b07f 692 fi
c5ae5678 693 using=`echo "${using}" | sed 's/and/using/'`
4d714963 694 using="Created \"${Makefile}\" in ${PWD}${using}."
7875b07f 695
46766962 696 if [ -n "${verbose}" -o -z "${recurring}" ] ; then
c5ae5678 697 echo ${using}
bc58b41d 698 fi
063efd10 699
c5ae5678 700 . ${tmpfile}.pos
eb02fd64 701
b8f8fddc
RP
702 # describe the chosen configuration in config.status.
703 # Make that file a shellscript which will reestablish
704 # the same configuration. Used in Makefiles to rebuild
705 # Makefiles.
706
4d714963
RP
707 if [ -z "${norecursion}" ] ; then
708 arguments="${arguments} -norecursion"
709 fi
710
b8f8fddc 711 echo "#!/bin/sh
4d714963
RP
712# ${NO_EDIT}
713# ${PWD} was configured as follows:
714${progname}" ${arguments} "
c5ae5678 715# ${using}" > config.status
b8f8fddc 716 chmod a+x config.status
0df06ca0 717
4d714963
RP
718# originaldir=${PWD}
719# cd ${srcdir}
0df06ca0 720 fi
bc58b41d 721
4d714963 722 # If there are subdirectories, then recur.
46766962 723 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
bc58b41d
RP
724 for configdir in ${configdirs} ; do
725 if [ -n "${verbose}" ] ; then
726 echo Configuring ${configdir}...
727 fi
728
4d714963
RP
729 if [ -d ${srcdir}/${configdir} ] ; then
730 if [ "${srcdir}" != "." ] ; then
731 if [ ! -d ./${configdir} ] ; then
732 mkdir ./${configdir}
49b10446
RP
733 fi
734 fi
735
4d714963 736 POPDIR=${PWD}
5420feaa
RP
737 cd ${configdir}
738
4d714963
RP
739### figure out what to do with srcdir
740 case "${srcdir}" in
741 ".") ;; # do nothing. We're building in place.
475576ae
RP
742 /*) srcdiroption="-srcdir=${srcdir}/${configdir}" ;; # absolute path
743 *) srcdiroption="-srcdir=../${srcdir}/${configdir}" ;; # otherwise relative
4d714963
RP
744 esac
745
746### The recursion line is here.
079399f6
RP
747 if [ -x configure ] ; then
748 recprog=`pwd`/configure
749 else
750 recprog=${progname}
751 fi
752
753 if (${recprog} -recurring ${host_alias} -target=${target_alias} \
4d714963
RP
754 ${verbose} ${subdirs} ${removing} ${prefixoption} \
755 ${tmpdiroption} ${namesubdiroption} ${datadiroption} \
756 ${srcdiroption}) ; then
c5ae5678
RP
757 true
758 else
759 exit 1
760 fi
5420feaa
RP
761
762 cd ${POPDIR}
4d714963
RP
763 elif [ -n "${verbose}" ] ; then
764 echo Warning: source directory \"${srcdir}/${configdir}\" is missing.
bc58b41d
RP
765 fi
766 done
767 fi
67ca110d
RP
768 done # for each target
769
4101d868 770 # Now build a Makefile for this host.
4d714963
RP
771# if [ -n "${subdirs}" -a ! -n "${removing}" ] ; then
772# push=${PWD}
773#
774# if [ -n "${objdir}" ] ; then
775# cd ${objdir}
776# fi
777#
778# cd ${hostsubdir}
779# cat > GNUmakefile << 'E!O!F'
780## Makefile generated by configure for host ${host_alias}.
781#
782#ALL := $(shell ls -d T-*)
783#
784#%:
785# $(foreach subdir,$(ALL),$(MAKE) -C $(subdir) \$@ &&) true
786#
787#all:
788#E!O!F
789# cd ${push}
790# fi
67ca110d 791done # for each host
eb02fd64 792
c297d71e
RP
793### clean up.
794
4d714963
RP
795# trap cmd above handles this now:
796#rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
c297d71e 797
eb02fd64 798exit 0
74cc5508 799
0df06ca0
RP
800#
801# Local Variables:
802# fill-column: 131
803# End:
804#
74cc5508 805
46f3c7cd 806# end of configure
This page took 0.086639 seconds and 4 git commands to generate.