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