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