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