Commit | Line | Data |
---|---|---|
eb02fd64 | 1 | #!/bin/sh |
eb02fd64 | 2 | |
46f3c7cd | 3 | # Configuration script |
6559fbdb | 4 | # Copyright (C) 1988, 1990-1993 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, | |
73f1f5ba | 31 | # config.status is removed. |
eb02fd64 RP |
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= |
a98e98d3 | 58 | moveifchange= |
4d714963 | 59 | next_host= |
3a07a6ac | 60 | next_prefix= |
3509822c | 61 | next_site= |
4d714963 | 62 | next_srcdir= |
3509822c RP |
63 | next_target= |
64 | next_tmpdir= | |
46766962 | 65 | norecursion= |
34bdab16 | 66 | package_makefile_frag= |
4d714963 | 67 | prefix=/usr/local |
49b10446 | 68 | progname= |
c1e4672c | 69 | program_prefix= |
c5108322 ILT |
70 | program_prefixoption= |
71 | program_suffix= | |
72 | program_suffixoption= | |
73 | program_transform_name= | |
74 | program_transform_nameoption= | |
a98e98d3 RP |
75 | redirect=">/dev/null" |
76 | removing= | |
0e693d0b | 77 | site= |
3a07a6ac | 78 | site_makefile_frag= |
a98e98d3 | 79 | site_option= |
74cc5508 | 80 | srcdir= |
ec342d7d | 81 | srctrigger= |
8becd045 | 82 | subdirs= |
c1e4672c | 83 | target_alias= |
3a07a6ac | 84 | target_makefile_frag= |
4d714963 | 85 | undefinedargs= |
0c72405d | 86 | version="$Revision$" |
4d714963 RP |
87 | x11=default |
88 | ||
4d714963 RP |
89 | NO_EDIT="This file was generated automatically by configure. Do not edit." |
90 | ||
91 | ## this is a little touchy and won't always work, but... | |
92 | ## | |
c1e4672c RP |
93 | ## if the argv[0] starts with a slash then it is an absolute name that can (and |
94 | ## must) be used as is. | |
4d714963 RP |
95 | ## |
96 | ## otherwise, if argv[0] has no slash in it, we can assume that it is on the | |
97 | ## path. Since PATH might include "." we also add `pwd` to the end of PATH. | |
98 | ## | |
4d714963 | 99 | |
c1e4672c | 100 | progname=$0 |
5cc24596 PB |
101 | # if PWD already has a value, it is probably wrong. |
102 | if [ -n "$PWD" ]; then PWD=`pwd`; fi | |
4d714963 | 103 | |
c1e4672c RP |
104 | case "${progname}" in |
105 | /*) ;; | |
106 | */*) ;; | |
107 | *) | |
73f1f5ba DZ |
108 | PATH=$PATH:${PWD=`pwd`} ; export PATH |
109 | ;; | |
c1e4672c | 110 | esac |
4d714963 | 111 | |
eb02fd64 RP |
112 | for arg in $*; |
113 | do | |
73f1f5ba DZ |
114 | # handle things that might have args following as separate words |
115 | if [ -n "${next_prefix}" ] ; then prefix=${arg} ; prefixoption="-prefix=${prefix}" ; next_prefix= | |
116 | elif [ -n "${next_exec_prefix}" ] ; then | |
117 | exec_prefix=${arg} | |
118 | exec_prefixoption="-exec_prefix=${exec_prefix}" | |
119 | next_exec_prefix= | |
120 | elif [ -n "${next_site}" ] ; then site=${arg} ; site_option=-site=${site} ; next_site= | |
121 | # remove any possible trailing slash from srcdir. See note below. | |
122 | elif [ -n "${next_srcdir}" ] ; then srcdir=`echo ${arg} | sed -e 's:/$::'` ; next_srcdir= | |
123 | elif [ -n "${next_program_prefix}" ] ; then | |
124 | program_prefix=${arg} | |
125 | program_prefixoption="-program_prefix=${program_prefix}" | |
126 | next_program_prefix= | |
127 | elif [ -n "${next_program_suffix}" ] ; then | |
128 | program_suffix=${arg} | |
129 | program_suffixoption="-program_suffix=${program_suffix}" | |
130 | next_program_suffix= | |
131 | elif [ -n "${next_program_transform_name}" ] ; then | |
132 | # Double any backslashes or dollar signs in the argument | |
133 | program_transform_name="${program_transform_name} -e `echo ${arg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`" | |
134 | program_transform_nameoption="${program_transform_nameoption} -program_transform_name='${arg}'" | |
135 | next_program_transform_name= | |
136 | elif [ -n "${next_target}" ] ; then | |
137 | next_target= | |
138 | case "${target_alias}" in | |
139 | "") | |
140 | target_alias="${arg}" | |
141 | ;; | |
142 | *) | |
143 | echo '***' Can only configure for one target at a time. 1>&2 | |
144 | fatal=yes | |
145 | ;; | |
146 | esac | |
147 | elif [ -n "${next_tmpdir}" ] ; then | |
148 | next_tmpdir= | |
149 | tmpdiroption="--tmpdir=${arg}" | |
150 | TMPDIR=${arg} | |
3509822c | 151 | |
73f1f5ba DZ |
152 | else |
153 | case ${arg} in | |
154 | -exec_prefix=* | --exec_prefix=* | --exec_prefi=* | --exec_pref=* | --exec_pre=* | --exec_pr=* | --exec_p=* | --exec_=* | --exec=* | --exe=* | --ex=* | --e=* | -exec-prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* ) | |
155 | exec_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'` | |
156 | exec_prefixoption=${arg} | |
157 | ;; | |
158 | -exec_prefix | --exec_prefix | --exec_prefi | --exec_pref | --exec_pre | --exec_pr | --exec_p | --exec_ | --exec | --exe | --ex | --e | -exec-prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec-) | |
159 | next_exec_prefix=yes | |
160 | ;; | |
161 | -gas | --g*) | |
162 | gas=yes | |
163 | ;; | |
164 | -help | --he*) | |
165 | fatal=true | |
166 | ;; | |
167 | -host=* | --host=* | --hos=* | --ho=*) | |
168 | case "${host_alias}" in | |
169 | "") | |
170 | host_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`" | |
171 | ;; | |
172 | *) | |
173 | echo '***' Can only configure for one host at a time. 1>&2 | |
174 | fatal=yes | |
175 | ;; | |
176 | esac | |
177 | ;; | |
178 | -nfp | --nf*) | |
179 | floating_point=no | |
180 | ;; | |
181 | -norecursion | --no*) | |
182 | norecursion=true | |
183 | ;; | |
184 | -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=*) | |
185 | prefix=`echo ${arg} | sed 's/^[-a-z]*=//'` | |
186 | prefixoption=${arg} | |
187 | ;; | |
188 | -prefix | --prefix | --prefi | --pref | --pre) | |
189 | next_prefix=yes | |
190 | ;; | |
191 | -rm | --rm) removing=${arg} ;; | |
192 | -program_prefix=* | --program_prefix=* | --program_prefi=* | --program_pref=* | --program_pre=* | --program_pr=* | --program_p=* | -program-prefix=* | --program-prefix=* | --program-prefi=* | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) | |
193 | program_prefix=`echo ${arg} | sed 's/^[-a-z_]*=//'` | |
194 | program_prefixoption=${arg} | |
195 | ;; | |
196 | -program_prefix | --program_prefix | --program_prefi | --program_pref | --program_pre | --program_pr | --program_p | -program-prefix | --program-prefix | --program-prefi | --program-pref | --program-pre | --program-pr | --program-p) | |
197 | next_program_prefix=yes | |
198 | ;; | |
199 | -program_suffix=* | --program_suffix=* | --program_suffi=* | --program_suff=* | --program_suf=* | --program_su=* | --program_s=* | -program-suffix=* | --program-suffix=* | --program-suffi=* | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) | |
200 | program_suffix=`echo ${arg} | sed 's/^[-a-z_]*=//'` | |
201 | program_suffixoption=${arg} | |
202 | ;; | |
203 | -program_suffix | --program_suffix | --program_suffi | --program_suff | --program_suf | --program_su | --program_s |-program-suffix | --program-suffix | --program-suffi | --program-suff | --program-suf | --program-su | --program-s) | |
204 | next_program_suffix=yes | |
205 | ;; | |
206 | -program_transform_name=* | --program_transform_name=* | --program_transform_nam=* | --program_transform_na=* | --program_transform_n=* | --program_transform_=* | --program_transform=* | --program_transfor=* | --program_transfo=* | --program_transf=* | --program_trans=* | --program_tran=* | --program_tra=* | --program_tr=* | --program_t=* | -program-transform-name=* | --program-transform-name=* | --program-transform-nam=* | --program-transform-na=* | --program-transform-n=* | --program-transform-=* | --program-transform=* | --program-transfor=* | --program-transfo=* | --program-transf=* | --program-trans=* | --program-tran=* | --program-tra=* | --program-tr=* | --program-t=*) | |
207 | # Double any \ or $ in the argument | |
208 | program_transform_name="${program_transform_name} -e `echo ${arg} | sed -e 's/^[-a-z_]*=//' -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`" | |
209 | program_transform_nameoption="${program_transform_nameoption} -program_transform_name='`echo ${arg} | sed 's/^[-a-z_]*=//'`'" | |
210 | ;; | |
211 | -program_transform_name | --program_transform_name | --program_transform_nam | --program_transform_na | --program_transform_n | --program_transform_ | --program_transform | --program_transfor | --program_transfo | --program_transf | --program_trans | --program_tran | --program_tra | --program_tr | --program_t | -program-transform-name | --program-transform-name | --program-transform-nam | --program-transform-na | --program-transform-n | --program-transform- | --program-transform | --program-transfor | --program-transfo | --program-transf | --program-trans | --program-tran | --program-tra | --program-tr | --program-t) | |
212 | next_program_transform_name=yes | |
213 | ;; | |
214 | -site=* | --site=* | --sit=* | --si=*) | |
215 | site_option=${arg} | |
216 | site=`echo ${arg} | sed 's/^[-a-z]*=//'` | |
217 | ;; | |
218 | -site | --site | --sit) | |
219 | next_site=yes | |
220 | ;; | |
221 | # remove trailing slashes. Otherwise, when the file name gets | |
222 | # bolted into an object file as debug info, it has two slashes in | |
223 | # it. Ordinarily this is ok, but emacs takes double slash to | |
224 | # mean "forget the first part". | |
225 | -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) | |
226 | srcdir=`echo ${arg} | sed 's/^[-a-z]*=//' | sed -e 's:/$::'` | |
227 | ;; | |
228 | -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) | |
229 | next_srcdir=yes | |
230 | ;; | |
231 | -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=*) | |
232 | case "${target_alias}" in | |
233 | "") target_alias="`echo ${arg} | sed 's/^[-a-z]*=//'`" ;; | |
234 | *) | |
235 | echo '***' Can only configure for one target at a time. 1>&2 | |
236 | fatal=yes | |
237 | ;; | |
238 | esac | |
239 | ;; | |
240 | -target | --target | --targe | --targ | --tar | --ta) | |
241 | next_target=yes | |
242 | ;; | |
243 | -tmpdir=* | --tmpdir=* | --tmpdi=* | --tmpd=* | --tmp=* | --tm=*) | |
244 | tmpdiroption=${arg} | |
245 | TMPDIR=`echo ${arg} | sed 's/^[-a-z]*=//'` | |
246 | ;; | |
247 | -tmpdir | --tmpdir | --tmpdi | --tmpd | --tmp | --tm) | |
248 | next_tmpdir=yes | |
249 | ;; | |
250 | -v | -verbose | --v) | |
251 | redirect= | |
252 | verbose=-v | |
253 | ;; | |
254 | -version | -V | --version | --V) | |
255 | echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'` | |
256 | exit 0 | |
257 | ;; | |
258 | -with*=* | --with*=*) | |
259 | withopt=`echo ${arg} | sed 's:^-*\(with[^=]*\)=.*$:\1:;s/-/_/g'` | |
260 | withval=`echo ${arg} | sed 's:^-*with[^=]*=\(.*\)$:\1:'` | |
261 | eval $withopt="$withval" | |
262 | withoptions="$withoptions $arg" | |
263 | ;; | |
264 | -with* | --with*) | |
265 | withopt=`echo ${arg} | sed 's:^-*with:with:;s/-/_/g'` | |
266 | eval $withopt=yes | |
267 | withoptions="$withoptions $arg" | |
268 | ;; | |
269 | -x | --x) ;; | |
270 | -* | --*) | |
271 | (echo ; | |
272 | echo "Unrecognized option: \"${arg}\"". ; | |
273 | echo) 1>&2 | |
274 | fatal=true | |
275 | ;; | |
276 | *) | |
277 | case "${undefs}" in | |
278 | "") | |
279 | undefs="${arg}" | |
280 | ;; | |
281 | *) | |
282 | echo '***' Can only configure for one host and one target at a time. 1>&2 | |
283 | fatal=yes | |
284 | ;; | |
285 | esac | |
286 | ;; | |
287 | esac | |
288 | fi | |
eb02fd64 RP |
289 | done |
290 | ||
4d714963 | 291 | # process host and target |
a98bbe58 RP |
292 | case "${fatal}" in |
293 | "") | |
73f1f5ba DZ |
294 | # # Complain if an arg is missing |
295 | # if [ -z "${host_alias}" ] ; then | |
296 | # (echo ; | |
297 | # echo "configure: No HOST specified." ; | |
298 | # echo) 1>&2 | |
299 | # fatal=true | |
300 | # fi | |
4d714963 RP |
301 | |
302 | ### This is a bit twisted. | |
303 | ### * if all three are specified, this is an error. | |
304 | ### * if we have neither hosts, nor unadorned args, this is an error. | |
305 | ### * if no hosts are specified, then the unadorned args are hosts, but if | |
306 | ### there were none, this is an error. | |
307 | ### * if no targets are specified, then the unadorned args are targets, but if | |
308 | ### there were no unadorned args, then the hosts are also targets. | |
309 | ||
73f1f5ba DZ |
310 | if [ -n "${host_alias}" -a -n "${target_alias}" -a -n "${undefs}" ] ; then |
311 | echo '***' Can only configure for one host and one target at a time. 1>&2 | |
312 | fatal=yes | |
313 | elif [ -z "${host_alias}" -a -z "${undefs}" ] ; then | |
314 | echo '- You did not tell me what kind of host system you want to configure. | |
5cc24596 | 315 | - I will attempt to guess the kind of system this is.' 1>&2 |
73f1f5ba DZ |
316 | guesssys=`echo ${progname} | sed 's/configure$/config.guess/'` |
317 | if tmp_alias=`${guesssys}` ; then | |
318 | echo "- Looks like this is a ${tmp_alias}" 1>&2 | |
319 | host_alias=${tmp_alias} | |
320 | target_alias=${tmp_alias} | |
321 | else | |
322 | echo '- Failed to guess the system type. You need to tell me.' 1>&2 | |
323 | fatal=yes | |
324 | fi | |
325 | else | |
326 | case "${host_alias}" in | |
327 | "") host_alias=${undefs} ;; | |
328 | *) ;; | |
329 | esac | |
330 | ||
331 | case "${target_alias}" in | |
332 | "") | |
333 | case "${undefs}" in | |
334 | "") target_alias=${host_alias} ;; | |
335 | *) target_alias=${undefs} ;; | |
336 | esac | |
337 | ;; | |
338 | *) ;; | |
339 | esac | |
340 | fi | |
341 | ;; | |
a98bbe58 RP |
342 | *) ;; |
343 | esac | |
eb02fd64 | 344 | |
c1e4672c | 345 | if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then |
73f1f5ba DZ |
346 | (echo "Usage: configure HOST" ; |
347 | echo ; | |
348 | echo "Options: [defaults in brackets]" ; | |
349 | echo " -exec-prefix=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ; | |
350 | echo " -gas configure the compilers for use with gas. [native as]" ; | |
351 | echo " -help print this message. [normal config]" ; | |
352 | echo " -lang=LANG configure to build LANG. [gcc]" ; | |
353 | echo " -nfp configure the compilers default to soft floating point. [hard float]" ; | |
354 | echo " -norecursion configure this directory only. [recurse]" ; | |
355 | echo " -prefix=MYDIR configure for installation of host dependent files into MYDIR. [\"/usr/local\"]" ; | |
356 | echo " -program-prefix=FOO install programs with FOO prepended to their names. [ \"\" ]" ; | |
357 | echo " -program-suffix=FOO install programs with FOO appended to their names. [ \"\" ]" ; | |
358 | echo " -program-transform-name=FOO install programs with names transformed by sed pattern FOO. [ \"\" ]" ; | |
359 | echo " -site=SITE configure with site specific makefile for SITE" ; | |
360 | echo " -srcdir=DIR find the sources in DIR. [\".\" or \"..\"]" ; | |
361 | echo " -target=TARGET configure for TARGET. [TARGET = HOST]" ; | |
362 | echo " -tmpdir=TMPDIR create temporary files in TMPDIR. [ TMPDIR = \"/tmp\" ]" ; | |
363 | echo ; | |
364 | echo "Where HOST and TARGET are something like \"vax\", \"sun3\", \"encore\", etc." ; | |
365 | ) 1>&2 | |
366 | ||
367 | if [ -r config.status ] ; then | |
368 | cat config.status | |
369 | fi | |
0df06ca0 | 370 | |
73f1f5ba | 371 | exit 1 |
eb02fd64 RP |
372 | fi |
373 | ||
0c72405d | 374 | configsub=`echo ${progname} | sed 's/configure$/config.sub/'` |
196377ee | 375 | moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'` |
7da1d334 | 376 | |
94c7ae21 RP |
377 | # this is a hack. sun4 must always be a valid host alias or this will fail. |
378 | if ${configsub} sun4 >/dev/null 2>&1 ; then | |
73f1f5ba | 379 | true |
7da1d334 | 380 | else |
73f1f5ba DZ |
381 | echo '***' cannot find config.sub. 1>&2 |
382 | exit 1 | |
7da1d334 RP |
383 | fi |
384 | ||
196377ee RP |
385 | touch config.junk |
386 | if ${moveifchange} config.junk config.trash ; then | |
73f1f5ba | 387 | true |
196377ee | 388 | else |
73f1f5ba DZ |
389 | echo '***' cannot find move-if-change. 1>&2 |
390 | exit 1 | |
196377ee RP |
391 | fi |
392 | rm -f config.junk config.trash | |
393 | ||
a98bbe58 RP |
394 | case "${srcdir}" in |
395 | "") | |
73f1f5ba DZ |
396 | if [ -r configure.in ] ; then |
397 | srcdir=. | |
398 | else | |
399 | if [ -r ${progname}.in ] ; then | |
400 | srcdir=`echo ${progname} | sed 's:/configure$::'` | |
401 | else | |
402 | echo '***' "Can't find configure.in. Try using -srcdir=some_dir" 1>&2 | |
403 | exit 1 | |
404 | fi | |
405 | fi | |
406 | ;; | |
a98bbe58 RP |
407 | *) ;; |
408 | esac | |
eb02fd64 | 409 | |
8fd24008 RP |
410 | ### warn about some conflicting configurations. |
411 | ||
412 | case "${srcdir}" in | |
413 | ".") ;; | |
414 | *) | |
73f1f5ba DZ |
415 | if [ -f ${srcdir}/config.status ] ; then |
416 | echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2 | |
417 | exit 1 | |
418 | fi | |
8fd24008 | 419 | esac |
bc58b41d | 420 | |
c1e4672c RP |
421 | # default exec_prefix |
422 | case "${exec_prefix}" in | |
8becd045 | 423 | "") exec_prefix="\$(prefix)" ;; |
3a07a6ac RP |
424 | *) ;; |
425 | esac | |
426 | ||
4d714963 | 427 | ### break up ${srcdir}/configure.in. |
a98bbe58 RP |
428 | case "`grep '^# per\-host:' ${srcdir}/configure.in`" in |
429 | "") | |
73f1f5ba DZ |
430 | echo '***' ${srcdir}/configure.in has no "per-host:" line. 1>&2 |
431 | exit 1 | |
432 | ;; | |
a98bbe58 RP |
433 | *) ;; |
434 | esac | |
49b10446 | 435 | |
a98bbe58 RP |
436 | case "`grep '^# per\-target:' ${srcdir}/configure.in`" in |
437 | "") | |
73f1f5ba DZ |
438 | echo '***' ${srcdir}/configure.in has no "per-target:" line. 1>&2 |
439 | exit 1 | |
440 | ;; | |
a98bbe58 RP |
441 | *) ;; |
442 | esac | |
c5ae5678 | 443 | |
a98bbe58 RP |
444 | case "${TMPDIR}" in |
445 | "") TMPDIR=/tmp ; export TMPDIR ;; | |
446 | *) ;; | |
447 | esac | |
eb02fd64 | 448 | |
4d714963 RP |
449 | # keep this filename short for &%*%$*# 14 char file names |
450 | tmpfile=${TMPDIR}/cONf$$ | |
451 | trap "rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos" 0 | |
452 | ||
453 | # split ${srcdir}/configure.in into common, per-host, per-target, | |
454 | # and post-target parts. Post-target is optional. | |
455 | sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com | |
456 | sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst | |
457 | if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then | |
458 | sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt | |
459 | sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos | |
c297d71e | 460 | else |
4d714963 RP |
461 | sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt |
462 | echo >${tmpfile}.pos | |
c297d71e | 463 | fi |
eb02fd64 | 464 | |
c297d71e | 465 | ### do common part of configure.in |
eb02fd64 | 466 | |
c5ae5678 | 467 | . ${tmpfile}.com |
eb02fd64 | 468 | |
ec342d7d | 469 | # some sanity checks on configure.in |
a98bbe58 RP |
470 | case "${srctrigger}" in |
471 | "") | |
73f1f5ba DZ |
472 | echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in. 1>&2 |
473 | exit 1 | |
474 | ;; | |
a98bbe58 RP |
475 | *) ;; |
476 | esac | |
ec342d7d | 477 | |
c1e4672c RP |
478 | result=`${configsub} ${host_alias}` |
479 | host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` | |
480 | host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` | |
481 | host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` | |
482 | host=${host_cpu}-${host_vendor}-${host_os} | |
6c18e393 | 483 | |
c1e4672c | 484 | . ${tmpfile}.hst |
eb02fd64 | 485 | |
c1e4672c RP |
486 | result=`${configsub} ${target_alias}` |
487 | target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'` | |
488 | target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'` | |
489 | target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'` | |
490 | target=${target_cpu}-${target_vendor}-${target_os} | |
eb02fd64 | 491 | |
c1e4672c | 492 | . ${tmpfile}.tgt |
49b10446 | 493 | |
c1e4672c RP |
494 | # Find the source files, if location was not specified. |
495 | case "${srcdir}" in | |
496 | "") | |
73f1f5ba DZ |
497 | srcdirdefaulted=1 |
498 | srcdir=. | |
499 | if [ ! -r ${srctrigger} ] ; then | |
500 | srcdir=.. | |
501 | fi | |
502 | ;; | |
c1e4672c RP |
503 | *) ;; |
504 | esac | |
eb02fd64 | 505 | |
c1e4672c | 506 | if [ ! -r ${srcdir}/${srctrigger} ] ; then |
73f1f5ba DZ |
507 | case "${srcdirdefaulted}" in |
508 | "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;; | |
509 | *) echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;; | |
510 | esac | |
eb02fd64 | 511 | |
73f1f5ba DZ |
512 | echo '***' \(At least ${srctrigger} is missing.\) 1>&2 |
513 | exit 1 | |
c1e4672c | 514 | fi |
131a3881 | 515 | |
c5108322 ILT |
516 | tooldir="\$(libdir)/${target_alias}" |
517 | ||
518 | if [ "${host_alias}" != "${target_alias}" ] ; then | |
519 | if [ "${program_prefix}" = "" ] ; then | |
73f1f5ba DZ |
520 | if [ "${program_suffix}" = "" ] ; then |
521 | if [ "${program_transform_name}" = "" ] ; then | |
522 | program_prefix=${target_alias}- ; | |
523 | fi | |
524 | fi | |
c5108322 ILT |
525 | fi |
526 | fi | |
527 | ||
528 | # Merge program_prefix and program_suffix onto program_transform_name | |
529 | # Use a double $ so that make ignores it | |
530 | if [ "${program_suffix}" != "" ] ; then | |
531 | program_transform_name="-e s/\$\$/${program_suffix}/ ${program_transform_name}" | |
532 | fi | |
533 | ||
534 | if [ "${program_prefix}" != "" ] ; then | |
535 | program_transform_name="-e s/^/${program_prefix}/ ${program_transform_name}" | |
536 | fi | |
537 | ||
8becd045 | 538 | for subdir in . ${subdirs} ; do |
eb02fd64 | 539 | |
8becd045 PB |
540 | # ${subdir} is relative path from . to the directory we're currently |
541 | # configuring. | |
542 | # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed. | |
543 | invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'` | |
131a3881 | 544 | |
8becd045 PB |
545 | ### figure out what to do with srcdir |
546 | case "${srcdir}" in | |
73f1f5ba DZ |
547 | ".") # no -srcdir option. We're building in place. |
548 | makesrcdir=. ;; | |
549 | /*) # absolute path | |
550 | makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'` | |
551 | ;; | |
552 | *) # otherwise relative | |
553 | case "${subdir}" in | |
554 | .) makesrcdir=${srcdir} ;; | |
555 | *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;; | |
556 | esac | |
557 | ;; | |
8becd045 | 558 | esac |
131a3881 | 559 | |
8becd045 | 560 | if [ "${subdir}/" != "./" ] ; then |
73f1f5ba | 561 | Makefile=${subdir}/Makefile |
8becd045 | 562 | fi |
131a3881 | 563 | |
9546e9b4 | 564 | if [ ! -d ${subdir} ] ; then |
73f1f5ba DZ |
565 | if mkdir ${subdir} ; then |
566 | true | |
09e0b992 | 567 | else |
73f1f5ba DZ |
568 | echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2 |
569 | exit 1 | |
09e0b992 | 570 | fi |
9546e9b4 RP |
571 | fi |
572 | ||
8becd045 PB |
573 | case "${removing}" in |
574 | "") | |
73f1f5ba DZ |
575 | case "${subdir}" in |
576 | .) ;; | |
577 | *) eval echo Building in ${subdir} ${redirect} ;; | |
578 | esac | |
579 | ||
580 | # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest) | |
581 | # Set up the list of links to be made. | |
582 | # ${links} is the list of link names, and ${files} is the list of names to link to. | |
583 | ||
584 | # Make the links. | |
585 | configlinks="${links}" | |
586 | if [ -r ${subdir}/config.status ] ; then | |
587 | mv -f ${subdir}/config.status ${subdir}/config.back | |
588 | fi | |
589 | while [ -n "${files}" ] ; do | |
590 | # set file to car of files, files to cdr of files | |
591 | set ${files}; file=$1; shift; files=$* | |
592 | set ${links}; link=$1; shift; links=$* | |
593 | ||
594 | if [ ! -r ${srcdir}/${file} ] ; then | |
595 | echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2 | |
596 | echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2 | |
597 | exit 1 | |
598 | fi | |
599 | ||
600 | ${remove} -f ${link} | |
601 | # Make a symlink if possible, otherwise try a hard link | |
602 | ${symbolic_link} ${srcdir}/${file} ${link} 2>/dev/null || ${hard_link} ${srcdir}/${file} ${link} | |
603 | ||
604 | if [ ! -r ${link} ] ; then | |
605 | echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2 | |
606 | exit 1 | |
607 | fi | |
608 | ||
609 | echo "Linked \"${link}\" to \"${srcdir}/${file}\"." | |
610 | done | |
611 | ||
612 | # Create a .gdbinit file which runs the one in srcdir | |
613 | # and tells GDB to look there for source files. | |
614 | ||
615 | if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then | |
616 | case ${srcdir} in | |
617 | .) ;; | |
618 | *) cat > ${subdir}/.gdbinit <<EOF | |
8becd045 | 619 | # ${NO_EDIT} |
3a07a6ac | 620 | dir . |
8becd045 PB |
621 | dir ${makesrcdir} |
622 | source ${makesrcdir}/.gdbinit | |
3a07a6ac | 623 | EOF |
73f1f5ba DZ |
624 | ;; |
625 | esac | |
626 | fi | |
0df06ca0 | 627 | |
73f1f5ba DZ |
628 | # Install a makefile, and make it set VPATH |
629 | # if necessary so that the sources are found. | |
630 | # Also change its value of srcdir. | |
631 | # NOTE: Makefile generation constitutes the majority of the time in configure. Hence, this section has | |
632 | # been somewhat optimized and is perhaps a bit twisty. | |
0df06ca0 | 633 | |
73f1f5ba | 634 | # code is order so as to try to sed the smallest input files we know. |
0df06ca0 | 635 | |
73f1f5ba | 636 | # the four makefile fragments MUST end up in the resulting Makefile in this order: |
34bdab16 DZ |
637 | # package, target, host, and site. so do these separately because I don't trust the |
638 | # order of sed -e expressions. | |
131a3881 | 639 | |
73f1f5ba DZ |
640 | if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then |
641 | ||
642 | # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem | |
643 | rm -f ${subdir}/Makefile.tem | |
644 | case "${site}" in | |
645 | "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;; | |
646 | *) | |
647 | site_makefile_frag=${srcdir}/config/ms-${site} | |
648 | ||
649 | if [ -f ${site_makefile_frag} ] ; then | |
650 | sed -e "/^####/ r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \ | |
651 | > ${subdir}/Makefile.tem | |
652 | else | |
653 | cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem | |
654 | site_makefile_frag= | |
655 | fi | |
656 | ;; | |
657 | esac | |
658 | # working copy now in ${subdir}/Makefile.tem | |
659 | ||
660 | # Conditionalize the makefile for this host. | |
661 | rm -f ${Makefile} | |
662 | case "${host_makefile_frag}" in | |
663 | "") mv ${subdir}/Makefile.tem ${Makefile} ;; | |
664 | *) | |
665 | if [ ! -f ${host_makefile_frag} ] ; then | |
666 | host_makefile_frag=${srcdir}/${host_makefile_frag} | |
667 | fi | |
668 | if [ -f ${host_makefile_frag} ] ; then | |
669 | sed -e "/^####/ r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile} | |
670 | else | |
671 | echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2 | |
672 | echo '***' is missing in ${PWD=`pwd`}. 1>&2 | |
673 | mv ${subdir}/Makefile.tem ${Makefile} | |
674 | fi | |
675 | esac | |
676 | # working copy now in ${Makefile} | |
677 | ||
678 | # Conditionalize the makefile for this target. | |
679 | rm -f ${subdir}/Makefile.tem | |
680 | case "${target_makefile_frag}" in | |
681 | "") mv ${Makefile} ${subdir}/Makefile.tem ;; | |
682 | *) | |
683 | if [ ! -f ${target_makefile_frag} ] ; then | |
684 | target_makefile_frag=${srcdir}/${target_makefile_frag} | |
685 | fi | |
686 | if [ -f ${target_makefile_frag} ] ; then | |
687 | sed -e "/^####/ r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem | |
688 | else | |
689 | mv ${Makefile} ${subdir}/Makefile.tem | |
690 | target_makefile_frag= | |
691 | fi | |
692 | ;; | |
693 | esac | |
694 | # real copy now in ${subdir}/Makefile.tem | |
695 | ||
696 | # Conditionalize the makefile for this package. | |
697 | rm -f ${Makefile} | |
698 | case "${package_makefile_frag}" in | |
699 | "") mv ${subdir}/Makefile.tem ${Makefile} ;; | |
700 | *) | |
701 | if [ ! -f ${package_makefile_frag} ] ; then | |
702 | package_makefile_frag=${srcdir}/${package_makefile_frag} | |
703 | fi | |
704 | if [ -f ${package_makefile_frag} ] ; then | |
705 | sed -e "/^####/ r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile} | |
706 | else | |
707 | echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2 | |
708 | echo '***' is missing in ${PWD=`pwd`}. 1>&2 | |
709 | mv ${subdir}/Makefile.tem ${Makefile} | |
710 | fi | |
711 | esac | |
712 | # working copy now in ${Makefile} | |
713 | ||
714 | mv ${Makefile} ${subdir}/Makefile.tem | |
715 | ||
716 | # real copy now in ${subdir}/Makefile.tem | |
717 | ||
718 | # prepend warning about editting, and a bunch of variables. | |
719 | rm -f ${Makefile} | |
720 | cat > ${Makefile} <<EOF | |
3a07a6ac | 721 | # ${NO_EDIT} |
8becd045 PB |
722 | VPATH = ${makesrcdir} |
723 | links = ${configlinks} | |
3a07a6ac RP |
724 | host_alias = ${host_alias} |
725 | host_cpu = ${host_cpu} | |
726 | host_vendor = ${host_vendor} | |
727 | host_os = ${host_os} | |
5cc24596 | 728 | host_canonical = ${host_cpu}-${host_vendor}-${host_os} |
3a07a6ac RP |
729 | target_alias = ${target_alias} |
730 | target_cpu = ${target_cpu} | |
731 | target_vendor = ${target_vendor} | |
732 | target_os = ${target_os} | |
5cc24596 | 733 | target_canonical = ${target_cpu}-${target_vendor}-${target_os} |
3a07a6ac | 734 | EOF |
73f1f5ba DZ |
735 | case "${package_makefile_frag}" in |
736 | "") ;; | |
737 | /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;; | |
738 | *) echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;; | |
739 | esac | |
740 | ||
741 | case "${target_makefile_frag}" in | |
742 | "") ;; | |
743 | /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;; | |
744 | *) echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;; | |
745 | esac | |
746 | ||
747 | case "${host_makefile_frag}" in | |
748 | "") ;; | |
749 | /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;; | |
750 | *) echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;; | |
751 | esac | |
752 | ||
753 | if [ "${site_makefile_frag}" != "" ] ; then | |
754 | echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile} | |
755 | fi | |
756 | ||
757 | # fixme: this shouldn't be in configure. | |
758 | # Define macro CROSS_COMPILE in compilation if this is a cross-compiler. | |
759 | case "${host_alias}" in | |
760 | "${target_alias}") | |
761 | echo "ALL=all.internal" >> ${Makefile} | |
762 | ;; | |
763 | *) | |
764 | echo "CROSS=-DCROSS_COMPILE" >> ${Makefile} | |
765 | echo "ALL=all.cross" >> ${Makefile} | |
766 | ;; | |
767 | esac | |
768 | ||
769 | # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS, | |
770 | # remove any form feeds. | |
771 | if [ -z "${subdirs}" ]; then | |
772 | rm -f ${subdir}/Makefile.tem2 | |
773 | sed -e "s:^SUBDIRS[ ]*=.*$:SUBDIRS = ${configdirs}:" \ | |
774 | -e "s:^NONSUBDIRS[ ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \ | |
775 | ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2 | |
776 | rm -f ${subdir}/Makefile.tem | |
777 | mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem | |
778 | fi | |
779 | sed -e "s:^prefix[ ]*=.*$:prefix = ${prefix}:" \ | |
780 | -e "s:^exec_prefix[ ]*=.*$:exec_prefix = ${exec_prefix}:" \ | |
781 | -e "s:^srcdir[ ]*=.*$:srcdir = ${makesrcdir}:" \ | |
782 | -e "s/\f//" \ | |
783 | -e "s:^program_prefix[ ]*=.*$:program_prefix = ${program_prefix}:" \ | |
784 | -e "s:^program_suffix[ ]*=.*$:program_suffix = ${program_suffix}:" \ | |
785 | -e "s:^program_transform_name[ ]*=.*$:program_transform_name = ${program_transform_name}:" \ | |
786 | -e "s:^tooldir[ ]*=.*$:tooldir = ${tooldir}:" \ | |
787 | ${subdir}/Makefile.tem >> ${Makefile} | |
788 | # final copy now in ${Makefile} | |
789 | ||
790 | else | |
791 | echo "No Makefile.in found in ${srcdir}, unable to configure" 1>&2 | |
8becd045 | 792 | fi |
73f1f5ba DZ |
793 | |
794 | rm -f ${subdir}/Makefile.tem | |
795 | ||
796 | case "${host_makefile_frag}" in | |
797 | "") using= ;; | |
798 | *) using="and \"${host_makefile_frag}\"" ;; | |
799 | esac | |
800 | ||
801 | case "${target_makefile_frag}" in | |
802 | "") ;; | |
803 | *) using="${using} and \"${target_makefile_frag}\"" ;; | |
804 | esac | |
805 | ||
806 | case "${site_makefile_frag}" in | |
807 | "") ;; | |
808 | *) using="${using} and \"${site_makefile_frag}\"" ;; | |
809 | esac | |
810 | ||
811 | newusing=`echo "${using}" | sed 's/and/using/'` | |
812 | using=${newusing} | |
813 | echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using} | |
814 | ||
815 | . ${tmpfile}.pos | |
816 | ||
817 | # describe the chosen configuration in config.status. | |
818 | # Make that file a shellscript which will reestablish | |
819 | # the same configuration. Used in Makefiles to rebuild | |
820 | # Makefiles. | |
821 | ||
822 | case "${norecursion}" in | |
823 | "") arguments="${arguments} -norecursion" ;; | |
824 | *) ;; | |
825 | esac | |
826 | ||
827 | if [ ${subdir} = . ] ; then | |
828 | echo "#!/bin/sh | |
4d714963 | 829 | # ${NO_EDIT} |
4347369f | 830 | # This directory was configured as follows: |
4d714963 | 831 | ${progname}" ${arguments} " |
196377ee | 832 | # ${using}" > ${subdir}/config.new |
73f1f5ba DZ |
833 | else |
834 | echo "#!/bin/sh | |
8becd045 | 835 | # ${NO_EDIT} |
4347369f | 836 | # This directory was configured as follows: |
8becd045 PB |
837 | cd ${invsubdir} |
838 | ${progname}" ${arguments} " | |
196377ee | 839 | # ${using}" > ${subdir}/config.new |
73f1f5ba DZ |
840 | fi |
841 | chmod a+x ${subdir}/config.new | |
842 | if [ -r ${subdir}/config.back ] ; then | |
843 | mv -f ${subdir}/config.back ${subdir}/config.status | |
844 | fi | |
845 | ${moveifchange} ${subdir}/config.new ${subdir}/config.status | |
846 | ;; | |
8becd045 | 847 | |
73f1f5ba | 848 | *) rm -f ${Makefile} ${subdir}/config.status ${links} ;; |
8becd045 PB |
849 | esac |
850 | done | |
c1e4672c RP |
851 | |
852 | # If there are subdirectories, then recur. | |
853 | if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then | |
73f1f5ba DZ |
854 | for configdir in ${configdirs} ; do |
855 | ||
856 | if [ -d ${srcdir}/${configdir} ] ; then | |
857 | eval echo Configuring ${configdir}... ${redirect} | |
858 | case "${srcdir}" in | |
859 | ".") ;; | |
860 | *) | |
861 | if [ ! -d ./${configdir} ] ; then | |
862 | if mkdir ./${configdir} ; then | |
863 | true | |
864 | else | |
865 | echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2 | |
866 | exit 1 | |
867 | fi | |
868 | fi | |
869 | ;; | |
870 | esac | |
871 | ||
872 | POPDIR=${PWD=`pwd`} | |
873 | cd ${configdir} | |
c1e4672c RP |
874 | |
875 | ### figure out what to do with srcdir | |
73f1f5ba DZ |
876 | case "${srcdir}" in |
877 | ".") newsrcdir=${srcdir} ;; # no -srcdir option. We're building in place. | |
878 | /*) # absolute path | |
879 | newsrcdir=${srcdir}/${configdir} | |
880 | srcdiroption="-srcdir=${newsrcdir}" | |
881 | ;; | |
882 | *) # otherwise relative | |
883 | newsrcdir=../${srcdir}/${configdir} | |
884 | srcdiroption="-srcdir=${newsrcdir}" | |
885 | ;; | |
886 | esac | |
c1e4672c RP |
887 | |
888 | ### check for guested configure, otherwise fix possibly relative progname | |
73f1f5ba DZ |
889 | if [ -f ${newsrcdir}/configure ] ; then |
890 | recprog=${newsrcdir}/configure | |
891 | else | |
892 | case "${progname}" in | |
893 | /*) recprog=${progname} ;; | |
894 | *) recprog=../${progname} ;; | |
895 | esac | |
896 | fi | |
4d714963 RP |
897 | |
898 | ### The recursion line is here. | |
73f1f5ba DZ |
899 | if eval ${recprog} ${verbose} --host=${host_alias} --target=${target_alias} \ |
900 | ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \ | |
901 | ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${removing} ${redirect} ; then | |
902 | true | |
903 | else | |
904 | exit 1 | |
905 | fi | |
906 | ||
907 | cd ${POPDIR} | |
908 | fi | |
909 | done | |
c1e4672c | 910 | fi |
eb02fd64 | 911 | |
eb02fd64 | 912 | exit 0 |
74cc5508 | 913 | |
0df06ca0 RP |
914 | # |
915 | # Local Variables: | |
916 | # fill-column: 131 | |
917 | # End: | |
918 | # | |
74cc5508 | 919 | |
46f3c7cd | 920 | # end of configure |