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