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