Be less sensitive to spaces in Makefile.in. Kills bug #556.
[deliverable/binutils-gdb.git] / configure
1 #!/bin/sh
2
3 # Configuration script
4 # Copyright (C) 1988, 1990, 1991 Free Software Foundation, Inc.
5
6 #This file is part of GNU.
7
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. */
21
22 # $Id$
23
24 # Please email any bugs, comments, and/or additions to this file to:
25 # configure@cygnus.com
26
27 #
28 # Shell script to create proper links to machine-dependent files in
29 # preparation for compilation.
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
36 # NOTE: This script contains support for a Cygnus experimental feature, called
37 # +subdirs, which is currently, tentatively, de-supported.
38
39 export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0 $argv; kill $$)
40
41 remove=rm
42 hard_link=ln
43 symbolic_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.
51
52 Makefile=Makefile
53 Makefile_in=Makefile.in
54 arguments=$*
55 commontargets=
56 configdirs=
57 datadir=
58 datadiroption=
59 defaulttargets=
60 fatal=
61 floating_point=default
62 gas=default
63 hosts=
64 #hostsubdir=
65 #namesubdir=
66 next_prefix=
67 next_host=
68 #next_namesubdir=
69 #next_objdir=
70 next_site=
71 next_srcdir=
72 next_target=
73 next_tmpdir=
74 norecursion=
75 #objdir=
76 #objdiroption=
77 prefix=/usr/local
78 progname=
79 recurring=
80 removing=
81 srcdir=
82 srctrigger=
83 target=
84 targets=
85 #targetsubdir=
86 undefinedargs=
87 verbose=
88 version="$Revision$"
89 x11=default
90
91 # or maybe grab from gcc/version.c
92 version_path=
93 next_version_path=
94
95 NO_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
109 PWD=`pwd`
110
111 if (echo $0 | grep '^/' > /dev/null) ; then
112 progname=$0
113 elif (echo $0 | grep '/' > /dev/null) ; then
114 progname=${PWD}/$0
115 else
116 progname=$0
117 PATH=$PATH:${PWD} ; export PATH
118 fi
119
120 for arg in $*;
121 do
122 # handle things that might have args following as separate words
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=
129 elif [ -n "${next_site}" ] ; then site=${arg} ; next_site=
130 elif [ -n "${next_srcdir}" ] ; then srcdir=${arg} ; next_srcdir=
131 elif [ -n "${next_target}" ] ; then
132 next_target=
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
139 fi
140 elif [ -n "${next_tmpdir}" ] ; then
141 next_tmpdir=
142 tmpdiroption="--tmpdir=${arg}"
143 TMPDIR=${arg}
144
145 else
146 case ${arg} in
147 -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* | --da=* | --d=*)
148 datadir=`echo ${arg} | sed 's/^[-a-z]*=//'`
149 datadiroption=${arg}
150 ;;
151 -datadir | --datadir | --datadi | --datad | --data | --dat | --da | --d)
152 next_datadir=yes
153 ;;
154 -gas | --g*)
155 gas=yes
156 ;;
157 -help | --he*)
158 fatal=true
159 ;;
160 -host=* | --host=* | --hos=* | --ho=*)
161 # if [ -n "${hosts}" ] ; then
162 # subdirs="--subdirs"
163 # fi
164
165 if [ -z "${hosts}" ] ; then
166 newhosts="${hosts} `echo ${arg} | sed 's/^[-a-z]*=//'`"
167 hosts="${newhosts}"
168 else
169 echo '***' Can only configure for one host at a time.
170 fatal=yes
171 fi
172 ;;
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=*)
177 # namesubdir=`echo ${arg} | sed 's/^[-a-z]*=//'`
178 # namesubdiroption=${arg}
179 # ;;
180 -nfp | --nf*)
181 floating_point=no
182 ;;
183 -norecursion | --no*)
184 norecursion=true
185 ;;
186 # -objdir=* | --objdir=* | --objdi=* | --objd=* | --obj=* | --ob=* | --o=*)
187 # objdiroption=${arg}
188 # objdir=`echo ${arg} | sed 's/^[-a-z]*=//'`
189 # ;;
190 # -objdir | --objdir | --objdi | --objd | --obj | --ob | --o)
191 # next_objdir=yes
192 # ;;
193 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
194 prefix=`echo ${arg} | sed 's/^[-a-z]*=//'`
195 prefixoption=${arg}
196 ;;
197 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
198 next_prefix=yes
199 ;;
200 -recurring | --recurring | --recurrin | --recurri | --recurr | --recur | --recu | --rec | --re)
201 recurring=true
202 arguments=`echo ${arguments} | sed "s:${arg}::"`
203 ;;
204 -rm | --rm)
205 removing=${arg}
206 ;;
207 -site=* | --site=* | --sit=* | --si=*)
208 site=`echo ${arg} | sed 's/^[-a-z]*=//'`
209 ;;
210 -site | --site | --sit | --si)
211 next_site=yes
212 ;;
213 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
214 srcdir=`echo ${arg} | sed 's/^[-a-z]*=//'`
215 ;;
216 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
217 next_srcdir=yes
218 ;;
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
228 newtargets="${targets} `echo ${arg} | sed 's/^[-a-z]*=//'`"
229 targets="${newtargets}"
230 else
231 echo '***' Can only configure for one target at a time.
232 fatal=yes
233 fi
234 ;;
235 -target | --target | --targe | --targ | --tar | --ta)
236 next_target=yes
237 ;;
238 -tmpdir=* | --tmpdir=* | --tmpdi=* | --tmpd=* | --tmp=* | --tm=*)
239 tmpdiroption=${arg}
240 TMPDIR=`echo ${arg} | sed 's/^[-a-z]*=//'`
241 ;;
242 -tmpdir | --tmpdir | --tmpdi | --tmpd | --tmp | --tm)
243 next_tmpdir=yes
244 ;;
245 -v | -verbose | --v)
246 verbose=${arg}
247 ;;
248 -version | -V | --version | --V)
249 echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
250 exit 0
251 ;;
252 -x | --x) ;;
253 -* | --*)
254 (echo ;
255 echo "Unrecognized option: \"${arg}\"". ;
256 echo) 1>&2
257 fatal=true
258 ;;
259 *)
260 # if [ -n "${hosts}" ] ; then
261 # subdirs="--subdirs"
262 # fi
263
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
271 ;;
272 esac
273 fi
274 done
275
276 if [ -n "${verbose}" ] ; then
277 echo $0 $*
278 fi
279
280 # process host and target
281 if [ -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
304 else
305 if [ -z "${hosts}" ] ; then
306 hosts=${undefs}
307 fi
308
309 if [ -z "${targets}" ] ; then
310 if [ -n "${undefs}" ] ; then
311 targets=${undefs}
312 else
313 targets=${hosts}
314 fi
315 fi
316 fi
317 fi
318
319 if [ -n "${fatal}" -o "${hosts}" = "help" ] ; then
320 (echo "Usage: configure HOST" ;
321 echo ;
322 echo "Options: [defaults in brackets]" ;
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 \"..\"]" ;
334 # This is correctly aligned in the output, even though it isn't here.
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\" ]" ;
338 echo ;
339 echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ;
340 # echo "Asking for more than one \"--target\" implies \"--subdirs\". Any other" ;
341 # echo "options given will apply to all targets."
342 ) 1>&2
343
344 if [ -r config.status ] ; then
345 cat config.status
346 fi
347
348 exit 1
349 fi
350
351 configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
352
353 if (${configsub} `echo ${hosts} | sed -e 's/ .*//'`) >/dev/null 2>&1 ; then
354 true
355 else
356 echo '***' cannot find config.sub.
357 exit 1
358 fi
359
360 if [ -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"
367 exit 1
368 fi
369 fi
370
371
372 ### break up ${srcdir}/configure.in.
373 if [ -z "`grep '^# per\-host:' ${srcdir}/configure.in`" ] ; then
374 echo '***' ${srcdir}/configure.in has no "per-host:" line. 1>&2
375 exit 1
376 fi
377
378 if [ -z "`grep '^# per\-target:' ${srcdir}/configure.in`" ] ; then
379 echo '***' ${srcdir}/configure.in has no "per-target:" line. 1>&2
380 exit 1
381 fi
382
383 if [ -z "${TMPDIR}" ] ; then
384 TMPDIR=/tmp ; export TMPDIR
385 fi
386
387 # keep this filename short for &%*%$*# 14 char file names
388 tmpfile=${TMPDIR}/cONf$$
389 trap "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.
393 sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
394 sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
395 if 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
398 else
399 sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
400 echo >${tmpfile}.pos
401 fi
402
403 ### do common part of configure.in
404
405 . ${tmpfile}.com
406
407 # some sanity checks on configure.in
408 if [ -z "${srctrigger}" ] ; then
409 echo '***' srctrigger not set in ${PWD}/configure.in.
410 exit 1
411 fi
412
413 for host in ${hosts} ; do
414 # Default other arg
415 if [ -z "${targets}" -o -n "${defaulttargets}" ] ; then
416 targets=${host}
417 defaulttargets=true
418 fi
419
420 host_alias=${host}
421
422 result=`${configsub} ${host}`
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}
427 host_makefile_frag=config/mh-${host}
428 if [ ! -f ${host_makefile_frag} ]
429 then
430 host_makefile_frag=config/mh-${host_alias}
431 fi
432
433 . ${tmpfile}.hst
434
435 for target in ${targets} ; do
436
437 target_alias=${target}
438 result=`${configsub} ${target}`
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}
443 target_makefile_frag=config/mt-${target}
444 if [ ! -f ${target_makefile_frag} ]
445 then
446 target_makefile_frag=config/mt-${target_alias}
447 fi
448
449 . ${tmpfile}.tgt
450
451 if [ "${host_alias}" = "${target_alias}" ] ; then
452 subdirname=H-${host_alias}
453 else
454 subdirname=X-${host_alias}-${target_alias}
455 fi
456
457 if [ -n "${namesubdir}" ] ; then
458 subdirname=${namesubdir}
459 fi
460
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
474 rm -f ${Makefile} config.status ${links}
475 # fi
476 else
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
518
519 # Find the source files, if location was not specified.
520 if [ -z "${srcdir}" ] ; then
521 srcdirdefaulted=1
522 srcdir=.
523 if [ ! -r ${srctrigger} ] ; then
524 srcdir=..
525 fi
526 fi
527
528 if [ ! -r ${srcdir}/${srctrigger} ] ; then
529 if [ -z "${srcdirdefaulted}" ] ; then
530 echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/${srcdir}" 1>&2
531 else
532 echo '***' "${progname}: Can't find ${srcname} sources in ${PWD}/. or ${PWD}/.." 1>&2
533 fi
534
535 echo '***' \(At least ${srctrigger} is missing.\) 1>&2
536 exit 1
537 fi
538
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.
541
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=$*
547
548 if [ ! -r ${srcdir}/${file} ] ; then
549 echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
550 echo '***' "since the file \"${file}\" does not exist." 1>&2
551 exit 1
552 fi
553
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}
558
559 if [ ! -r ${link} ] ; then
560 echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
561 exit 1
562 fi
563
564 if [ -n "${verbose}" ] ; then
565 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
566 fi
567 done
568
569 # Create a .gdbinit file which runs the one in srcdir
570 # and tells GDB to look there for source files.
571
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
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
595 echo "CROSS=-DCROSS_COMPILE" > ${Makefile}
596 echo "ALL=all.cross" >> ${Makefile}
597 else
598 echo "ALL=all.internal" > ${Makefile}
599 fi
600
601 # set target, host, VPATH
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}
606 echo "version_path = ${version_path}" >> ${Makefile}
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}
611
612 # if [ -n "${subdirs}" ] ; then
613 # (echo "subdir = /${subdirname}" ;
614 # echo "unsubdir = ..") >> ${Makefile}
615 # else
616 (echo "subdir =" ;
617 echo "unsubdir = .") >> ${Makefile}
618 # fi
619
620 # echo "workdir = ${PWD}" >> ${Makefile}
621 echo "VPATH = ${srcdir}" >> ${Makefile}
622
623 # add "Makefile.in" (or whatever it's called)
624 cat ${srcdir}/${Makefile_in} >> ${Makefile}
625
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
640 # Conditionalize the makefile for this host.
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
648 mv Makefile.tem ${Makefile}
649
650 # Conditionalize the makefile for this target.
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
658 mv Makefile.tem ${Makefile}
659
660 # set srcdir
661 sed "s@^srcdir[ ]*=.*$@srcdir = ${srcdir}@" ${Makefile} > Makefile.tem
662 mv Makefile.tem ${Makefile}
663
664 # set prefix
665 if [ -n "${prefix}" ] ; then
666 sed "s:^prefix[ ]*=.*$:prefix = ${prefix}:" ${Makefile} > Makefile.tem
667 mv Makefile.tem ${Makefile}
668 fi
669
670 # set datadir
671 if [ -n "${datadir}" ] ; then
672 sed "s:^datadir[ ]*=.*$:datadir = ${datadir}:" ${Makefile} > Makefile.tem
673 mv Makefile.tem ${Makefile}
674 fi
675
676 # reset SUBDIRS
677 sed "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" ${Makefile} > Makefile.tem
678 mv Makefile.tem ${Makefile}
679
680 # reset NONSUBDIRS
681 sed "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" ${Makefile} > Makefile.tem
682 mv Makefile.tem ${Makefile}
683
684 # remove any form feeds.
685 sed -e "s/\f//" ${Makefile} > Makefile.tem
686 mv Makefile.tem ${Makefile}
687
688 # prepend warning about editting.
689 echo "# "${NO_EDIT} > ${Makefile}.tem
690 cat ${Makefile} >> ${Makefile}.tem
691 mv Makefile.tem ${Makefile}
692
693 using=
694 if [ -f ${srcdir}/${host_makefile_frag} ] ; then
695 using="${using} and \"${host_makefile_frag}\""
696 fi
697 if [ -f ${srcdir}/${target_makefile_frag} ] ; then
698 using="${using} and \"${target_makefile_frag}\""
699 fi
700 if [ -n "${site}" -a \
701 -f ${srcdir}/${site_makefile_frag} ] ; then
702 using="${using} and \"${site_makefile_frag}\""
703 fi
704 using=`echo "${using}" | sed 's/and/using/'`
705 using="Created \"${Makefile}\" in ${PWD}${using}."
706
707 if [ -n "${verbose}" -o -z "${recurring}" ] ; then
708 echo ${using}
709 fi
710
711 . ${tmpfile}.pos
712
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
718 if [ -z "${norecursion}" ] ; then
719 arguments="${arguments} -norecursion"
720 fi
721
722 echo "#!/bin/sh
723 # ${NO_EDIT}
724 # ${PWD} was configured as follows:
725 ${progname}" ${arguments} "
726 # ${using}" > config.status
727 chmod a+x config.status
728
729 # originaldir=${PWD}
730 # cd ${srcdir}
731 fi
732
733 # If there are subdirectories, then recur.
734 if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then
735 for configdir in ${configdirs} ; do
736 if [ -n "${verbose}" ] ; then
737 echo Configuring ${configdir}...
738 fi
739
740 if [ -d ${srcdir}/${configdir} ] ; then
741 if [ "${srcdir}" != "." ] ; then
742 if [ ! -d ./${configdir} ] ; then
743 mkdir ./${configdir}
744 fi
745 fi
746
747 POPDIR=${PWD}
748 cd ${configdir}
749
750 ### figure out what to do with srcdir
751 case "${srcdir}" in
752 ".") ;; # do nothing. We're building in place.
753 /*) srcdiroption="-srcdir=${srcdir}/${configdir}" ;; # absolute path
754 *) srcdiroption="-srcdir=../${srcdir}/${configdir}" ;; # otherwise relative
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
762 true
763 else
764 exit 1
765 fi
766
767 cd ${POPDIR}
768 elif [ -n "${verbose}" ] ; then
769 echo Warning: source directory \"${srcdir}/${configdir}\" is missing.
770 fi
771 done
772 fi
773 done # for each target
774
775 # Now build a Makefile for this host.
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
796 done # for each host
797
798 ### clean up.
799
800 # trap cmd above handles this now:
801 #rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
802
803 exit 0
804
805 #
806 # Local Variables:
807 # fill-column: 131
808 # End:
809 #
810
811 # end of configure
This page took 0.049902 seconds and 5 git commands to generate.