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