home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / binutils-2.7-src.tgz / tar.out / fsf / binutils / configure < prev    next >
Text File  |  1996-10-03  |  41KB  |  1,314 lines

  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, 90, 91, 92, 93, 94 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. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. # GNU General Public License for more details.
  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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19.  
  20. # This file was originally written by K. Richard Pixley.
  21.  
  22. #
  23. # Shell script to create proper links to machine-dependent files in
  24. # preparation for compilation.
  25. #
  26. # If configure succeeds, it leaves its status in config.status.
  27. # If configure fails after disturbing the status quo, 
  28. #       config.status is removed.
  29. #
  30.  
  31. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0 $argv; kill $$)
  32.  
  33. remove=rm
  34. hard_link=cp
  35. symbolic_link=cp
  36.  
  37. #for Test
  38. #remove="echo rm"
  39. #hard_link="echo ln"
  40. #symbolic_link="echo ln -s"
  41.  
  42. # clear some things potentially inherited from environment.
  43.  
  44. Makefile=Makefile
  45. Makefile_in=Makefile.in
  46. arguments=
  47. build_alias=
  48. cache_file=
  49. cache_file_option=
  50. configdirs=
  51. exec_prefix=
  52. exec_prefixoption=
  53. fatal=
  54. floating_point=default
  55. gas=default
  56. host_alias=NOHOST
  57. host_makefile_frag=
  58. moveifchange=
  59. norecursion=
  60. other_options=
  61. package_makefile_frag=
  62. # This is a hack so we don't have to remember to always configure using
  63. # the "--prefix=/ade" option.  Personally I feel this should be settable
  64. # in a config file.  -fnf
  65. prefix=/ade
  66. progname=
  67. program_prefix=
  68. program_prefixoption=
  69. program_suffix=
  70. program_suffixoption=
  71. program_transform_name=
  72. program_transform_nameoption=
  73. redirect=">/dev/null"
  74. removing=
  75. site=
  76. site_makefile_frag=
  77. site_option=
  78. srcdir=
  79. srctrigger=
  80. subdirs=
  81. target_alias=NOTARGET
  82. target_makefile_frag=
  83. undefs=NOUNDEFS
  84. version="$Revision: 1.224 $"
  85. x11=default
  86.  
  87. ### we might need to use some other shell than /bin/sh for running subshells
  88. #
  89. config_shell=${CONFIG_SHELL-/bin/sh}
  90.  
  91. NO_EDIT="This file was generated automatically by configure.  Do not edit."
  92.  
  93. ## this is a little touchy and won't always work, but...
  94. ##
  95. ## if the argv[0] starts with a slash then it is an absolute name that can (and
  96. ## must) be used as is.
  97. ##
  98. ## otherwise, if argv[0] has no slash in it, we can assume that it is on the
  99. ## path.  Since PATH might include "." we also add `pwd` to the end of PATH.
  100. ##
  101.  
  102. # For some reason, the value of $0 in AmigaOS pdksh ends up with a
  103. # trailing '/' that needs to be stripped.
  104. progname=`echo $0 | sed 's:/$::'`
  105. # if PWD already has a value, it is probably wrong.
  106. # The AmigaOS pksh can't change the value of PWD, it's readonly.
  107. #if [ -n "$PWD" ]; then PWD=`pwd`; fi
  108.  
  109. case "${progname}" in
  110. /*) ;;
  111. */*) ;;
  112. *)
  113.         PATH=$PATH:${PWD=`pwd`} ; export PATH
  114.         ;;
  115. esac
  116.  
  117. # Loop over all args
  118.  
  119. while :
  120. do
  121.  
  122. # Break out if there are no more args
  123.     case $# in
  124.     0)
  125.         break
  126.         ;;
  127.     esac
  128.  
  129. # Get the first arg, and shuffle
  130.     option=$1
  131.     shift
  132.  
  133. # Make all options have two hyphens
  134.     orig_option=$option    # Save original for error messages
  135.     case $option in
  136.     --*) ;;
  137.     -*) option=-$option ;;
  138.     esac
  139.         
  140. # Split out the argument for options that take them
  141.     case $option in
  142.     --*=*)
  143.         optarg=`echo $option | sed -e 's/^[^=]*=//'`
  144.         arguments="$arguments $option"
  145.         ;;
  146. # These options have mandatory values.  Since we didn't find an = sign,
  147. # the value must be in the next argument
  148.     --bu* | --cache* | --ex* | --ho* | --pre* | --program-p* | --program-s* | --program-t* | --si* | --sr* | --ta* | --tm* | --x-* | --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
  149.         optarg=$1
  150.         shift
  151.         arguments="$arguments $option=$optarg"
  152.         ;;
  153.     --v)
  154.         arguments="$arguments -v"
  155.         ;;
  156.     --*)
  157.         arguments="$arguments $option"
  158.         ;;
  159.     esac
  160.  
  161. # Now, process the options
  162.     case $option in
  163.  
  164.     --build* | --bu*)
  165.         case "$build_alias" in
  166.         "") build_alias=$optarg ;;
  167.         *) echo '***' Can only configure for one build machine at a time.  1>&2
  168.            fatal=yes
  169.            ;;
  170.         esac
  171.         ;;
  172.     --cache*)
  173.         cache_file=$optarg
  174.         ;;
  175.     --disable-*)
  176.         enableopt=`echo ${option} | sed 's:^--disable-:enable_:;s:-:_:g'`
  177.         eval $enableopt=no
  178.         disableoptions="$disableoptions $option"
  179.         ;;
  180.     --enable-*)
  181.         case "$option" in
  182.         *=*)    ;;
  183.         *)    optarg=yes ;;
  184.         esac
  185.  
  186.         enableopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  187.         eval "$enableopt='$optarg'"
  188.         enableoptions="$enableoptions '$option'"
  189.         ;;
  190.     --exec-prefix* | --ex*)
  191.         exec_prefix=$optarg
  192.         exec_prefixoption="--exec-prefix=$optarg"
  193.         ;;
  194.     --gas | --g*)
  195.         gas=yes
  196.         ;;
  197.     --help | --he*)
  198.         fatal=yes
  199.         ;;
  200.     --host* | --ho*)
  201.         case $host_alias in
  202.         NOHOST) host_alias=$optarg ;;
  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.         floating_pointoption="--nfp"
  211.         ;;
  212.     --norecursion | --no*)
  213.         norecursion=yes
  214.         ;;
  215.     --prefix* | --pre*)
  216.         prefix=$optarg
  217.         prefixoption="--prefix=$optarg"
  218.         ;;
  219.     --program-prefix* | --program-p*)
  220.         program_prefix=$optarg
  221.         program_prefixoption="--program-prefix=$optarg"
  222.         ;;
  223.     --program-suffix* | --program-s*)
  224.         program_suffix=$optarg
  225.         program_suffixoption="--program-suffix=$optarg"
  226.         ;;
  227.     --program-transform-name* | --program-t*)
  228.         # Double any backslashes or dollar signs in the argument
  229.         program_transform_name="${program_transform_name} -e `echo ${optarg} | sed -e 's/\\\\/\\\\\\\\/g' -e 's/\\\$/$$/g'`"
  230.         program_transform_nameoption="${program_transform_nameoption} --program-transform-name='$optarg'"
  231.         ;;
  232.     --rm)
  233.         removing=--rm
  234.         ;;
  235.     --silent | --sil* | --quiet | --q*)
  236.         redirect=">/dev/null"
  237.         verbose=--silent
  238.         ;;
  239.     --site* | --sit*)
  240.         site=$optarg
  241.         site_option="--site=$optarg"
  242.         ;;
  243.     --srcdir*/ | --sr*/)
  244.                 # Remove trailing slashes.  Otherwise, when the file name gets
  245.                 # bolted into an object file as debug info, it has two slashes
  246.                 # in it.  Ordinarily this is ok, but emacs takes double slash
  247.                 # to mean "forget the first part".
  248.         srcdir=`echo $optarg | sed -e 's:/$::'`
  249.         ;;
  250.     --srcdir* | --sr*)
  251.         srcdir=$optarg
  252.         ;;
  253.     --target* | --ta*)
  254.         case $target_alias in
  255.         NOTARGET) target_alias=$optarg ;;
  256.         *) echo '***' Can only configure for one target at a time.  1>&2
  257.            fatal=yes
  258.            ;;
  259.         esac
  260.         ;;
  261.     --tmpdir* | --tm*)
  262.         TMPDIR=$optarg
  263.         tmpdiroption="--tmpdir=$optarg"
  264.         ;;
  265.     --verbose | --v | --verb*)
  266.         redirect=
  267.         verbose=--verbose
  268.         ;;
  269.     --version | --V | --vers*)
  270.         echo "This is Cygnus Configure version" `echo ${version} | sed 's/[ $:]//g'`
  271.         exit 0
  272.         ;;
  273.     --with-*)
  274.         case "$option" in
  275.         *=*)    ;;
  276.         *)    optarg=yes ;;
  277.         esac
  278.  
  279.         withopt=`echo ${option} | sed 's:^--::;s:=.*$::;s:-:_:g'`
  280.         eval $withopt="$optarg"
  281.         withoptions="$withoptions $option"
  282.         ;;
  283.     --without-*)
  284.         withopt=`echo ${option} | sed 's:^--::;s:out::;s:-:_:g'`
  285.         eval $withopt=no
  286.         withoutoptions="$withoutoptions $option"
  287.         ;;
  288.     --x)    with_x=yes
  289.         withoptions="$withoptions --with-x"
  290.         ;;
  291.     --x-i* | --x-l*) other_options="$other_options $orig_option"
  292.         ;;
  293.     --bi* | --sb* | --li* | --da* | --sy* | --sh* | --lo* | --in* | --ol* | --ma*)
  294.         # These options were added to autoconf for emacs.
  295.         ;;
  296.     --*)
  297.         echo "configure: Unrecognized option: \"$orig_option\"; use --help for usage." >&2
  298.         exit 1
  299.         ;;
  300.     *)
  301.         case $undefs in
  302.         NOUNDEFS) undefs=$option ;;
  303.         *) echo '***' Can only configure for one host and one target at a time.  1>&2
  304.            fatal=yes
  305.            ;;
  306.         esac
  307.         ;;
  308.     esac
  309. done
  310.  
  311. # process host and target
  312.  
  313. # Do some error checking and defaulting for the host and target type.
  314. # The inputs are:
  315. #    configure --host=HOST --target=TARGET UNDEFS
  316. #
  317. # The rules are:
  318. # 1. You aren't allowed to specify --host, --target, and undefs at the
  319. #    same time.
  320. # 2. Host defaults to undefs.
  321. # 3. If undefs is not specified, then host defaults to the current host,
  322. #    as determined by config.guess.
  323. # 4. Target defaults to undefs.
  324. # 5. If undefs is not specified, then target defaults to host.
  325.  
  326. case "${fatal}" in
  327. "")
  328.     # Make sure that host, target & undefs aren't all specified at the
  329.     # same time.
  330.     case $host_alias---$target_alias---$undefs in
  331.     NOHOST---*---* | *---NOTARGET---* | *---*---NOUNDEFS)
  332.         ;;
  333.     *) echo '***' Can only configure for one host and one target at a time.  1>&2
  334.        fatal=yes
  335.        break 2
  336.         ;;
  337.     esac
  338.  
  339.     # Now, do defaulting for host.
  340.     case $host_alias in
  341.     NOHOST)
  342.         case $undefs in
  343.         NOUNDEFS)
  344.             # Neither --host option nor undefs were present.
  345.             # Call config.guess.
  346.             guesssys=`echo ${progname} | sed 's/configure$/config.guess/'`
  347.             if host_alias=`${guesssys}`
  348.             then
  349.                 # If the string we are going to use for
  350.                 # the target is a prefix of the string
  351.                 # we just guessed for the host, then
  352.                 # assume we are running native, and force
  353.                 # the same string for both target and host.
  354.                 case $target_alias in
  355.                 NOTARGET) ;;
  356.                 *)
  357.                     if expr $host_alias : $target_alias >/dev/null
  358.                     then
  359.                         host_alias=$target_alias
  360.                     fi
  361.                     ;;
  362.                 esac
  363.                 echo "Configuring for a ${host_alias} host." 1>&2
  364.                 arguments="--host=$host_alias $arguments"
  365.             else
  366.                 echo 'Config.guess failed to determine the host type.  You need to specify one.' 1>&2
  367.                 fatal=yes
  368.             fi
  369.             ;;
  370.         *)
  371.             host_alias=$undefs
  372.             arguments="--host=$host_alias $arguments"
  373.             undefs=NOUNDEFS
  374.             ;;
  375.         esac
  376.     esac
  377.  
  378.     # Do defaulting for target.  If --target option isn't present, default
  379.     # to undefs.  If undefs isn't present, default to host.
  380.     case $target_alias in
  381.     NOTARGET)
  382.         case $undefs in
  383.         NOUNDEFS)
  384.             target_alias=$host_alias
  385.             ;;
  386.         *)
  387.             target_alias=$undefs
  388.             arguments="--target=$target_alias $arguments"
  389.             ;;
  390.         esac
  391.     esac
  392.     ;;
  393. *) ;;
  394. esac
  395.  
  396. if [ -n "${fatal}" -o "${host_alias}" = "help" ] ; then
  397.     exec 1>&2
  398.     echo Usage: configure [OPTIONS] [HOST]
  399.     echo
  400.     echo Options: [defaults in brackets]
  401.     echo ' --prefix=MYDIR         install into MYDIR [/usr/local]'
  402.     echo ' --exec-prefix=MYDIR     install host-dependent files into MYDIR [/usr/local]'
  403.     echo ' --help             print this message [normal config]'
  404.     echo ' --build=BUILD         configure for building on BUILD [BUILD=HOST]'
  405.     echo ' --host=HOST         configure for HOST [determined via config.guess]'
  406.     echo ' --norecursion         configure this directory only [recurse]'
  407.     echo ' --program-prefix=FOO     prepend FOO to installed program names [""]'
  408.     echo ' --program-suffix=FOO     append FOO to installed program names [""]'
  409.     echo ' --program-transform-name=P transform installed names by sed pattern P [""]'
  410.     echo ' --site=SITE         configure with site-specific makefile for SITE'
  411.     echo ' --srcdir=DIR         find the sources in DIR [. or ..]'
  412.     echo ' --target=TARGET     configure for TARGET [TARGET=HOST]'
  413.     echo ' --tmpdir=TMPDIR     create temporary files in TMPDIR [/tmp]'
  414.     echo ' --nfp             configure for software floating point [hard float]'
  415.     echo ' --with-FOO, --with-FOO=BAR package FOO is available (parameter BAR)'
  416.     echo ' --without-FOO         package FOO is NOT available'
  417.     echo ' --enable-FOO, --enable-FOO=BAR include feature FOO (parameter BAR)'
  418.     echo ' --disable-FOO         do not include feature FOO'
  419.     echo
  420.     echo 'Where HOST and TARGET are something like "sparc-sunos", "mips-sgi-irix5", etc.'
  421.     echo
  422.     if [ -r config.status ] ; then
  423.         cat config.status
  424.     fi
  425.  
  426.     exit 1
  427. fi
  428.  
  429. configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
  430. moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
  431.  
  432. # this is a hack.  sun4 must always be a valid host alias or this will fail.
  433. if ${configsub} sun4 >/dev/null 2>&1 ; then
  434.         true
  435. else
  436.         echo '***' cannot find config.sub.  1>&2
  437.         exit 1
  438. fi
  439.  
  440. touch config.junk
  441. if ${moveifchange} config.junk config.trash ; then
  442.         true
  443. else
  444.         echo '***' cannot find move-if-change.  1>&2
  445.         exit 1
  446. fi
  447. rm -f config.junk config.trash
  448.  
  449. case "${srcdir}" in
  450. "")
  451.         if [ -r configure.in ] ; then
  452.                 srcdir=.
  453.         else
  454.                 if [ -r ${progname}.in ] ; then
  455.                         srcdir=`echo ${progname} | sed 's:/configure$::'`
  456.                 else
  457.                         echo '***' "Can't find configure.in.  Try using --srcdir=some_dir"  1>&2
  458.                         exit 1
  459.                 fi
  460.         fi
  461.         ;;
  462. *)
  463.     # Set srcdir to "." if that's what it is.
  464.     # This is important for multilib support.
  465.     if [ ! -d ${srcdir} ] ; then
  466.         echo "Invalid source directory ${srcdir}" >&2
  467.         exit 1
  468.     fi
  469.     pwd=`pwd`
  470.     srcpwd=`cd ${srcdir} ; pwd`
  471.     if [ "${pwd}" = "${srcpwd}" ] ; then
  472.         srcdir=.
  473.     fi
  474. esac
  475.  
  476. ### warn about some conflicting configurations.
  477.  
  478. case "${srcdir}" in
  479. ".") ;;
  480. *)
  481.         if [ -f ${srcdir}/config.status ] ; then
  482.                 echo '***' Cannot configure here in \"${PWD=`pwd`}\" when \"${srcdir}\" is currently configured. 1>&2
  483.                 exit 1
  484.         fi
  485. esac
  486.  
  487. # default exec_prefix
  488. case "${exec_prefixoption}" in
  489. "") exec_prefix="\$(prefix)" ;;
  490. *) ;;
  491. esac
  492.  
  493. ### break up ${srcdir}/configure.in.
  494. case "`grep '^# per\-host:' ${srcdir}/configure.in`" in
  495. "")
  496.         echo '***' ${srcdir}/configure.in has no \"per-host:\" line. 1>&2
  497.     # Check for a directory that's been converted to use autoconf since
  498.     # it was last configured.
  499.     if grep AC_OUTPUT ${srcdir}/configure.in >/dev/null ; then
  500.       echo '***' Hmm, looks like this directory has been autoconfiscated. 1>&2
  501.       if [ -r ${srcdir}/configure ] ; then
  502.         echo '***' Running the local configure script. 1>&2
  503.         case "${cache_file}" in
  504.         "") cache_file_option= ;;
  505.         *)  cache_file_option="--cache-file=${cache_file}" ;;
  506.         esac
  507.         srcdiroption="--srcdir=${srcdir}"
  508.         case "${build_alias}" in
  509.         "") buildopt= ;;
  510.         *)  buildopt="--build=${build_alias}" ;;
  511.         esac
  512.         eval exec ${config_shell} ${srcdir}/configure ${verbose} \
  513.         ${buildopt} --host=${host_alias} --target=${target_alias} \
  514.         ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  515.         ${srcdiroption} \
  516.         ${program_prefixoption} ${program_suffixoption} \
  517.         ${program_transform_nameoption} ${site_option} \
  518.         ${withoptions} ${withoutoptions} \
  519.         ${enableoptions} ${disableoptions} ${floating_pointoption} \
  520.         ${cache_file_option} ${removing} ${other_options} ${redirect}
  521.       else
  522.         echo '***' There is no configure script present though. 1>&2
  523.       fi
  524.     fi
  525.         exit 1
  526.         ;;
  527. *) ;;
  528. esac
  529.  
  530. case "`grep '^# per\-target:' ${srcdir}/configure.in`" in
  531. "")
  532.         echo '***' ${srcdir}/configure.in has no \"per-target:\" line. 1>&2
  533.         exit 1
  534.         ;;
  535. *) ;;
  536. esac
  537.  
  538. case "${TMPDIR}" in
  539. "") TMPDIR=/tmp ; export TMPDIR ;;
  540. *) ;;
  541. esac
  542.  
  543. # keep this filename short for &%*%$*# 14 char file names
  544. tmpfile=${TMPDIR}/cONf$$
  545. # Note that under many versions of sh a trap handler for 0 will *override* any
  546. # exit status you explicitly specify!  At this point, the only non-error exit
  547. # is at the end of the script; these actions are duplicated there, minus
  548. # the "exit 1".  Don't use "exit 0" anywhere after this without resetting the
  549. # trap handler, or you'll lose.
  550. trap "rm -f Makefile.tem ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos; exit 1" 0 1 2 15
  551.  
  552. # split ${srcdir}/configure.in into common, per-host, per-target,
  553. # and post-target parts.  Post-target is optional.
  554. sed -e '/^# per\-host:/,$d' ${srcdir}/configure.in > ${tmpfile}.com
  555. sed -e '1,/^# per\-host:/d' -e '/^# per\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.hst
  556. if grep '^# post-target:' ${srcdir}/configure.in >/dev/null ; then
  557.   sed -e '1,/^# per\-target:/d' -e '/^# post\-target:/,$d' ${srcdir}/configure.in > ${tmpfile}.tgt
  558.   sed -e '1,/^# post\-target:/d' ${srcdir}/configure.in > ${tmpfile}.pos
  559. else
  560.   sed -e '1,/^# per\-target:/d' ${srcdir}/configure.in > ${tmpfile}.tgt
  561.   echo >${tmpfile}.pos
  562. fi
  563.  
  564. ### do common part of configure.in
  565.  
  566. . ${tmpfile}.com
  567.  
  568. # some sanity checks on configure.in
  569. case "${srctrigger}" in
  570. "")
  571.         echo '***' srctrigger not set in ${PWD=`pwd`}/configure.in.  1>&2
  572.         exit 1
  573.         ;;
  574. *) ;;
  575. esac
  576.  
  577. case "${build_alias}" in
  578. "")
  579.     if result=`${config_shell} ${configsub} ${host_alias}` ; then
  580.         build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  581.         build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  582.         build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  583.         build=${build_cpu}-${build_vendor}-${build_os}
  584.         build_alias=${host_alias}
  585.     fi
  586.     ;;
  587. *)
  588.     if result=`${config_shell} ${configsub} ${build_alias}` ; then
  589.         buildopt="--build=${build_alias}"
  590.         build_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  591.         build_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  592.         build_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  593.         build=${build_cpu}-${build_vendor}-${build_os}
  594.     else
  595.         echo "Unrecognized build system name ${build_alias}." 1>&2
  596.         exit 1
  597.     fi
  598.     ;;
  599. esac
  600.  
  601. if result=`${config_shell} ${configsub} ${host_alias}` ; then
  602.     true
  603. else
  604.     echo "Unrecognized host system name ${host_alias}." 1>&2
  605.     exit 1
  606. fi
  607. host_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  608. host_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  609. host_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  610. host=${host_cpu}-${host_vendor}-${host_os}
  611.  
  612. . ${tmpfile}.hst
  613.  
  614. if result=`${config_shell} ${configsub} ${target_alias}` ; then
  615.     true
  616. else
  617.     echo "Unrecognized target system name ${target_alias}." 1>&2
  618.     exit 1
  619. fi
  620. target_cpu=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`
  621. target_vendor=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`
  622. target_os=`echo $result | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`
  623. target=${target_cpu}-${target_vendor}-${target_os}
  624.  
  625. . ${tmpfile}.tgt
  626.  
  627. # Find the source files, if location was not specified.
  628. case "${srcdir}" in
  629. "")
  630.         srcdirdefaulted=1
  631.         srcdir=.
  632.         if [ ! -r ${srctrigger} ] ; then
  633.                 srcdir=..
  634.         fi
  635.         ;;
  636. *) ;;
  637. esac
  638.  
  639. if [ ! -r ${srcdir}/${srctrigger} ] ; then
  640.         case "${srcdirdefaulted}" in
  641.         "") echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/${srcdir}" 1>&2 ;;
  642.         *)  echo '***' "${progname}: Can't find ${srcname} sources in ${PWD=`pwd`}/. or ${PWD=`pwd`}/.." 1>&2 ;;
  643.         esac
  644.  
  645.         echo '***' \(At least ${srctrigger} is missing.\) 1>&2
  646.         exit 1
  647. fi
  648.  
  649. # Some systems (e.g., one of the i386-aix systems the gas testers are
  650. # using) don't handle "\$" correctly, so don't use it here.
  651. tooldir='$(exec_prefix)'/${target_alias}
  652.  
  653. if [ "${host_alias}" != "${target_alias}" ] ; then
  654.     if [ "${program_prefixoption}" = "" ] ; then
  655.         if [ "${program_suffixoption}" = "" ] ; then 
  656.             if [ "${program_transform_nameoption}" = "" ] ; then
  657.                 program_prefix=${target_alias}- ;
  658.             fi
  659.         fi
  660.     fi
  661. fi
  662.  
  663. # Merge program_prefix and program_suffix onto program_transform_name.
  664. # (program_suffix used to use $, but it's hard to preserve $ through both
  665. # make and sh.)
  666. if [ "${program_suffix}" != "" ] ; then
  667.     program_transform_name="-e s,\\\\(.*\\\\),\\\\1${program_suffix}, ${program_transform_name}"
  668. fi
  669.  
  670. if [ "${program_prefix}" != "" ] ; then
  671.     program_transform_name="-e s,^,${program_prefix}, ${program_transform_name}"
  672. fi
  673.  
  674. # If CC and CXX are not set in the environment, and the Makefile
  675. # exists, try to extract them from it.  This is to handle running
  676. # ./config.status by hand.
  677. if [ -z "${CC}" -a -r Makefile ]; then
  678.   sed -n -e ':loop
  679. /\\$/ N
  680. /\\$/ b loop
  681. s/\\\n//g
  682. /^CC[     ]*=/ s/CC[     ]*=[     ]*\(.*\)/\1/p' < Makefile > Makefile.cc
  683.   CC=`tail -1 Makefile.cc`
  684.   rm -f Makefile.cc
  685. fi
  686.  
  687. if [ -z "${CXX}" -a -r Makefile ]; then
  688.   sed -n -e ':loop
  689. /\\$/ N
  690. /\\$/ b loop
  691. s/\\\n//g
  692. /^CXX[     ]*=/ s/CXX[     ]*=[     ]*\(.*\)/\1/p' < Makefile > Makefile.cc
  693.   CXX=`tail -1 Makefile.cc`
  694.   rm -f Makefile.cc
  695. fi
  696.  
  697. # Generate a default definition for YACC.  This is used if the makefile can't
  698. # locate bison or byacc in objdir.
  699.  
  700. for prog in 'bison -y' byacc yacc
  701. do
  702.   set dummy $prog; tmp=$2
  703.   IFS="${IFS=     }"; save_ifs="$IFS"; IFS="${IFS}:"
  704.   for dir in $PATH; do
  705.     test -z "$dir" && dir=.
  706.     if test -f $dir/$tmp; then
  707.       DEFAULT_YACC="$prog"
  708.       break
  709.     fi
  710.   done
  711.   IFS="$save_ifs"
  712.  
  713.   test -n "$DEFAULT_YACC" && break
  714. done
  715.  
  716. # Generate a default definition for LEX.  This is used if the makefile can't
  717. # locate flex in objdir.
  718.  
  719. for prog in flex lex
  720. do
  721.   set dummy $prog; tmp=$2
  722.   IFS="${IFS=     }"; save_ifs="$IFS"; IFS="${IFS}:"
  723.   for dir in $PATH; do
  724.     test -z "$dir" && dir=.
  725.     if test -f $dir/$tmp; then
  726.       DEFAULT_LEX="$prog"
  727.       break
  728.     fi
  729.   done
  730.   IFS="$save_ifs"
  731.  
  732.   test -n "$DEFAULT_LEX" && break
  733. done
  734.  
  735. if [ "${build}" != "${host}" ]; then
  736.   # If we are doing a Canadian Cross, in which the host and build systems
  737.   # are not the same, we set reasonable default values for the tools.
  738.  
  739.   tools="AR AR_FOR_TARGET AS AS_FOR_TARGET BISON CC_FOR_BUILD"
  740.   tools="${tools} CC_FOR_TARGET CXX_FOR_TARGET"
  741.   tools="${tools} DLLTOOL DLLTOOL_FOR_TARGET HOST_PREFIX"
  742.   tools="${tools} HOST_PREFIX_1 LD LD_FOR_TARGET LEX MAKEINFO NM"
  743.   tools="${tools} NM_FOR_TARGET RANLIB RANLIB_FOR_TARGET"
  744.  
  745.   for var in ${tools}; do
  746.     if [ -z "`eval 'echo $'"${var}"`" -a -r Makefile ]; then
  747.       sed -n -e ':loop
  748. /\\$/ N
  749. /\\$/ b loop
  750. s/\\\n//g
  751. /^'"${var}"'[     ]*=/ s/'"${var}"'[     ]*=[     ]*\(.*\)/\1/p' \
  752.     < Makefile > Makefile.v
  753.       t=`tail -1 Makefile.v`
  754.       if [ -n "${t}" ]; then
  755.     eval "${var}='${t}'"
  756.       fi
  757.       rm -f Makefile.v
  758.     fi
  759.   done
  760.  
  761.   AR=${AR-${host_alias}-ar}
  762.   AR_FOR_TARGET=${AR_FOR_TARGET-${target_alias}-ar}
  763.   AS=${AS-${host_alias}-as}
  764.   AS_FOR_TARGET=${AS_FOR_TARGET-${target_alias}-as}
  765.   CC=${CC-${host_alias}-gcc}
  766.   CXX=${CXX-${host_alias}-gcc}
  767.   CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
  768.   CC_FOR_TARGET=${CC_FOR_TARGET-${target_alias}-gcc}
  769.   CXX_FOR_TARGET=${CXX_FOR_TARGET-${target_alias}-gcc}
  770.   DLLTOOL=${DLLTOOL-${host_alias}-dlltool}
  771.   DLLTOOL_FOR_TARGET=${DLLTOOL_FOR_TARGET-${target_alias}-dlltool}
  772.   HOST_PREFIX=${build_alias}-
  773.   HOST_PREFIX_1=${build_alias}-
  774.   LD=${LD-${host_alias}-ld}
  775.   LD_FOR_TARGET=${LD_FOR_TARGET-${target_alias}-ld}
  776.   MAKEINFO=${MAKEINFO-makeinfo}
  777.   NM=${NM-${host_alias}-nm}
  778.   NM_FOR_TARGET=${NM_FOR_TARGET-${target_alias}-nm}
  779.   RANLIB=${RANLIB-${host_alias}-ranlib}
  780.   RANLIB_FOR_TARGET=${RANLIB_FOR_TARGET-${target_alias}-ranlib}
  781.  
  782.   if [ -z "${BISON}" ]; then
  783.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS="${IFS}:"
  784.     for dir in $PATH; do
  785.       test -z "$dir" && dir=.
  786.       if test -f $dir/byacc; then
  787.     BISON=byacc
  788.     break
  789.       fi
  790.       if test -f $dir/bison; then
  791.     BISON=bison
  792.     break
  793.       fi
  794.       if test -f $dir/yacc; then
  795.     BISON=yacc
  796.     break
  797.       fi
  798.     done
  799.     IFS="$save_ifs"
  800.     BISON=${BISON-bison}
  801.   fi
  802.  
  803.   if [ -z "${LEX}" ]; then
  804.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS="${IFS}:"
  805.     for dir in $PATH; do
  806.       test -z "$dir" && dir=.
  807.       if test -f $dir/flex; then
  808.     LEX=flex
  809.     break
  810.       fi
  811.       if test -f $dir/lex; then
  812.     LEX=lex
  813.     break
  814.       fi
  815.     done
  816.     IFS="$save_ifs"
  817.     LEX=${LEX-flex}
  818.   fi
  819.  
  820.   # Export variables which autoconf might try to set.
  821.   export AS
  822.   export AR
  823.   export CC_FOR_BUILD
  824.   export DLLTOOL
  825.   export LD
  826.   export NM
  827.   export RANLIB
  828. else
  829.   # If CC is still not set, try to get gcc.
  830.   if [ -z "${CC}" ]; then
  831.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS="${IFS}:"
  832.     for dir in $PATH; do
  833.       test -z "$dir" && dir=.
  834.       if test -f $dir/gcc; then
  835.     CC="gcc"
  836.     break
  837.       fi
  838.     done
  839.     IFS="$save_ifs"
  840.     CC=${CC-gcc}
  841.   fi
  842.  
  843.   CXX=${CXX-"gcc"}
  844. fi
  845.  
  846. export CC
  847. export CXX
  848.  
  849. case "$host" in
  850.     *go32*)
  851.         enable_gdbtk=no ;;
  852.     *cygwin32*)
  853.         enable_gdbtk=no ;;
  854. esac
  855.  
  856. # Determine whether gdb needs tk/tcl or not.
  857. if [ "$enable_gdbtk" != "no" ]; then
  858.     GDB_TK="all-tcl all-tk"
  859. else
  860.     GDB_TK=""
  861. fi
  862.  
  863. for subdir in . ${subdirs} ; do
  864.  
  865.     # ${subdir} is relative path from . to the directory we're currently
  866.     # configuring.
  867.     # ${invsubdir} is inverse of ${subdir), *with* trailing /, if needed.
  868.     invsubdir=`echo ${subdir}/ | sed -e 's|\./||g' -e 's|[^/]*/|../|g'`
  869.  
  870.     ### figure out what to do with srcdir
  871.     case "${srcdir}" in
  872.         ".")  # no -srcdir option.  We're building in place.
  873.                 makesrcdir=. ;;
  874.         /*) # absolute path
  875.                 makesrcdir=`echo ${srcdir}/${subdir} | sed -e 's|/\.$||'`
  876.                 ;;
  877.         *) # otherwise relative
  878.                 case "${subdir}" in
  879.                 .) makesrcdir=${srcdir} ;;
  880.                 *) makesrcdir=${invsubdir}${srcdir}/${subdir} ;;
  881.                 esac
  882.                 ;;
  883.     esac
  884.  
  885.     if [ "${subdir}/" != "./" ] ; then
  886.         Makefile=${subdir}/Makefile
  887.     fi
  888.  
  889.     if [ ! -d ${subdir} ] ; then
  890.         if mkdir ${subdir} ; then
  891.                 true
  892.         else
  893.                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${subdir}" 1>&2
  894.                 exit 1
  895.         fi
  896.     fi
  897.  
  898.     case "${removing}" in
  899.     "")
  900.         case "${subdir}" in
  901.         .) ;;
  902.         *) eval echo Building in ${subdir} ${redirect} ;;
  903.         esac
  904.  
  905.         # FIXME Should this be done recursively ??? (Useful for e.g. gdbtest)
  906.         # Set up the list of links to be made.
  907.         # ${links} is the list of link names, and ${files} is the list of names to link to.
  908.  
  909.         # Make the links.
  910.         configlinks="${links}"
  911.         if [ -r ${subdir}/config.status ] ; then
  912.                 mv -f ${subdir}/config.status ${subdir}/config.back
  913.         fi
  914.         while [ -n "${files}" ] ; do
  915.                 # set file to car of files, files to cdr of files
  916.                 set ${files}; file=$1; shift; files=$*
  917.                 set ${links}; link=$1; shift; links=$*
  918.  
  919.                 if [ ! -r ${srcdir}/${file} ] ; then
  920.                         echo '***' "${progname}: cannot create a link \"${link}\"," 1>&2
  921.                         echo '***' "since the file \"${srcdir}/${file}\" does not exist." 1>&2
  922.                         exit 1
  923.                 fi
  924.  
  925.                 ${remove} -f ${link}
  926.         # Make a symlink if possible, otherwise try a hard link
  927.         if ${symbolic_link} ${srcdir}/${file} ${link} >/dev/null 2>&1 ; then
  928.             true
  929.         else
  930.             # We need to re-remove the file because Lynx leaves a 
  931.             # very strange directory there when it fails an NFS symlink.
  932.             ${remove} -r -f ${link}
  933.             ${hard_link} ${srcdir}/${file} ${link}
  934.         fi
  935.                 if [ ! -r ${link} ] ; then
  936.                         echo '***' "${progname}: unable to link \"${link}\" to \"${srcdir}/${file}\"." 1>&2
  937.                         exit 1
  938.                 fi
  939.  
  940.                 echo "Linked \"${link}\" to \"${srcdir}/${file}\"."
  941.         done
  942.  
  943.         # Create a .gdbinit file which runs the one in srcdir
  944.         # and tells GDB to look there for source files.
  945.  
  946.         if [ -r ${srcdir}/${subdir}/.gdbinit ] ; then
  947.                 case ${srcdir} in
  948.                 .) ;;
  949.                 *) cat > ${subdir}/.gdbinit <<EOF
  950. # ${NO_EDIT}
  951. dir ${makesrcdir}
  952. dir .
  953. source ${makesrcdir}/.gdbinit
  954. EOF
  955.                         ;;
  956.                 esac
  957.         fi
  958.  
  959.         # Install a makefile, and make it set VPATH
  960.         # if necessary so that the sources are found.
  961.         # Also change its value of srcdir.
  962.         # NOTE: Makefile generation constitutes the majority of the time in configure.  Hence, this section has
  963.         # been somewhat optimized and is perhaps a bit twisty.
  964.  
  965.         # code is order so as to try to sed the smallest input files we know.
  966.  
  967.         # the four makefile fragments MUST end up in the resulting Makefile in this order: 
  968.         # package, target, host, and site.  so do these separately because I don't trust the
  969.         #  order of sed -e expressions.
  970.  
  971.         if [ -f ${srcdir}/${subdir}/${Makefile_in} ] ; then
  972.  
  973.             # Conditionalize for this site from "Makefile.in" (or whatever it's called) into Makefile.tem
  974.             rm -f ${subdir}/Makefile.tem
  975.               case "${site}" in
  976.               "") cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem ;;
  977.               *)
  978.                       site_makefile_frag=${srcdir}/config/ms-${site}
  979.  
  980.                       if [ -f ${site_makefile_frag} ] ; then
  981.                               sed -e "/^####/  r ${site_makefile_frag}" ${srcdir}/${subdir}/${Makefile_in} \
  982.                                       > ${subdir}/Makefile.tem
  983.                       else
  984.                               cp ${srcdir}/${subdir}/${Makefile_in} ${subdir}/Makefile.tem
  985.                               site_makefile_frag=
  986.                       fi
  987.                       ;;
  988.             esac
  989.             # working copy now in ${subdir}/Makefile.tem
  990.  
  991.             # Conditionalize the makefile for this host.
  992.             rm -f ${Makefile}
  993.             case "${host_makefile_frag}" in
  994.               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  995.               *)
  996.                       if [ ! -f ${host_makefile_frag} ] ; then
  997.                               host_makefile_frag=${srcdir}/${host_makefile_frag}
  998.                       fi
  999.                       if [ -f ${host_makefile_frag} ] ; then
  1000.                               sed -e "/^####/  r ${host_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  1001.                       else
  1002.                               echo '***' Expected host makefile fragment \"${host_makefile_frag}\" 1>&2
  1003.                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
  1004.                               mv ${subdir}/Makefile.tem ${Makefile}
  1005.                       fi
  1006.             esac
  1007.             # working copy now in ${Makefile}
  1008.  
  1009.             # Conditionalize the makefile for this target.
  1010.             rm -f ${subdir}/Makefile.tem
  1011.             case "${target_makefile_frag}" in
  1012.               "") mv ${Makefile} ${subdir}/Makefile.tem ;;
  1013.               *)
  1014.                       if [ ! -f ${target_makefile_frag} ] ; then
  1015.                               target_makefile_frag=${srcdir}/${target_makefile_frag}
  1016.                       fi
  1017.                       if [ -f ${target_makefile_frag} ] ; then
  1018.                               sed -e "/^####/  r ${target_makefile_frag}" ${Makefile} > ${subdir}/Makefile.tem
  1019.                       else
  1020.                               mv ${Makefile} ${subdir}/Makefile.tem
  1021.                               target_makefile_frag=
  1022.                       fi
  1023.                       ;;
  1024.             esac
  1025.             # real copy now in ${subdir}/Makefile.tem
  1026.  
  1027.             # Conditionalize the makefile for this package.
  1028.             rm -f ${Makefile}
  1029.             case "${package_makefile_frag}" in
  1030.               "") mv ${subdir}/Makefile.tem ${Makefile} ;;
  1031.               *)
  1032.                       if [ ! -f ${package_makefile_frag} ] ; then
  1033.                               package_makefile_frag=${srcdir}/${package_makefile_frag}
  1034.                       fi
  1035.                       if [ -f ${package_makefile_frag} ] ; then
  1036.                               sed -e "/^####/  r ${package_makefile_frag}" ${subdir}/Makefile.tem > ${Makefile}
  1037.                   rm -f ${subdir}/Makefile.tem
  1038.                       else
  1039.                               echo '***' Expected package makefile fragment \"${package_makefile_frag}\" 1>&2
  1040.                               echo '***' is missing in ${PWD=`pwd`}. 1>&2
  1041.                               mv ${subdir}/Makefile.tem ${Makefile}
  1042.                       fi
  1043.             esac
  1044.             # working copy now in ${Makefile}
  1045.  
  1046.             mv ${Makefile} ${subdir}/Makefile.tem
  1047.  
  1048.             # real copy now in ${subdir}/Makefile.tem
  1049.  
  1050.             # prepend warning about editting, and a bunch of variables.
  1051.             rm -f ${Makefile}
  1052.             cat > ${Makefile} <<EOF
  1053. # ${NO_EDIT}
  1054. VPATH = ${makesrcdir}
  1055. links = ${configlinks}
  1056. host_alias = ${host_alias}
  1057. host_cpu = ${host_cpu}
  1058. host_vendor = ${host_vendor}
  1059. host_os = ${host_os}
  1060. host_canonical = ${host_cpu}-${host_vendor}-${host_os}
  1061. target_alias = ${target_alias}
  1062. target_cpu = ${target_cpu}
  1063. target_vendor = ${target_vendor}
  1064. target_os = ${target_os}
  1065. target_canonical = ${target_cpu}-${target_vendor}-${target_os}
  1066. EOF
  1067.         case "${build}" in
  1068.           "") ;;
  1069.           *)  cat >> ${Makefile} << EOF
  1070. build_alias = ${build_alias}
  1071. build_cpu = ${build_cpu}
  1072. build_vendor = ${build_vendor}
  1073. build_os = ${build_os}
  1074. build_canonical = ${build_cpu}-${build_vendor}-${build_os}
  1075. EOF
  1076.         esac
  1077.  
  1078.             case "${package_makefile_frag}" in
  1079.               "") ;;
  1080.               /*) echo package_makefile_frag = ${package_makefile_frag} >>${Makefile} ;;
  1081.               *)  echo package_makefile_frag = ${invsubdir}${package_makefile_frag} >>${Makefile} ;;
  1082.             esac
  1083.  
  1084.             case "${target_makefile_frag}" in
  1085.               "") ;;
  1086.               /*) echo target_makefile_frag = ${target_makefile_frag} >>${Makefile} ;;
  1087.               *)  echo target_makefile_frag = ${invsubdir}${target_makefile_frag} >>${Makefile} ;;
  1088.             esac
  1089.  
  1090.             case "${host_makefile_frag}" in
  1091.               "") ;;
  1092.               /*) echo host_makefile_frag = ${host_makefile_frag} >>${Makefile} ;;
  1093.               *)  echo host_makefile_frag = ${invsubdir}${host_makefile_frag} >>${Makefile} ;;
  1094.             esac
  1095.  
  1096.             if [ "${site_makefile_frag}" != "" ] ; then
  1097.                 echo site_makefile_frag = ${invsubdir}${site_makefile_frag} >>${Makefile}
  1098.             fi 
  1099.  
  1100.             # reset prefix, exec_prefix, srcdir, SUBDIRS, NONSUBDIRS,
  1101.             # remove any form feeds.
  1102.             if [ -z "${subdirs}" ]; then
  1103.                 rm -f ${subdir}/Makefile.tem2
  1104.                 sed -e "s:^SUBDIRS[     ]*=.*$:SUBDIRS = ${configdirs}:" \
  1105.                     -e "s:^NONSUBDIRS[     ]*=.*$:NONSUBDIRS = ${noconfigdirs}:" \
  1106.                     ${subdir}/Makefile.tem > ${subdir}/Makefile.tem2
  1107.                 rm -f ${subdir}/Makefile.tem
  1108.                 mv ${subdir}/Makefile.tem2 ${subdir}/Makefile.tem
  1109.             fi
  1110.             sed -e "s:^prefix[     ]*=.*$:prefix = ${prefix}:" \
  1111.                     -e "s:^exec_prefix[     ]*=.*$:exec_prefix = ${exec_prefix}:" \
  1112.             -e "/^CC[     ]*=/{
  1113.             :loop1
  1114.             /\\\\$/ N
  1115.             /\\\\$/ b loop1
  1116.             s/\\\\\\n//g
  1117.             s%^CC[     ]*=.*$%CC = ${CC}%
  1118.             }" \
  1119.             -e "/^CXX[     ]*=/{
  1120.             :loop2
  1121.             /\\\\$/ N
  1122.             /\\\\$/ b loop2
  1123.             s/\\\\\\n//g
  1124.             s%^CXX[     ]*=.*$%CXX = ${CXX}%
  1125.             }" \
  1126.             -e "s:^SHELL[     ]*=.*$:SHELL = ${config_shell}:" \
  1127.             -e "s:^GDB_TK[     ]*=.*$:GDB_TK = ${GDB_TK}:" \
  1128.                     -e "s:^srcdir[     ]*=.*$:srcdir = ${makesrcdir}:" \
  1129.                     -e "s/ //" \
  1130.                     -e "s:^program_prefix[     ]*=.*$:program_prefix = ${program_prefix}:" \
  1131.                     -e "s:^program_suffix[     ]*=.*$:program_suffix = ${program_suffix}:" \
  1132.                     -e "s:^program_transform_name[     ]*=.*$:program_transform_name = ${program_transform_name}:" \
  1133.                     -e "s:^tooldir[     ]*=.*$:tooldir = ${tooldir}:" \
  1134.             -e "s:^DEFAULT_YACC[     ]*=.*$:DEFAULT_YACC = ${DEFAULT_YACC}:" \
  1135.             -e "s:^DEFAULT_LEX[     ]*=.*$:DEFAULT_LEX = ${DEFAULT_LEX}:" \
  1136.                     ${subdir}/Makefile.tem >> ${Makefile}
  1137.  
  1138.         # If this is a Canadian Cross, preset the values of many more
  1139.         # tools.
  1140.         if [ "${build}" != "${host}" ]; then
  1141.         for var in ${tools}; do
  1142.             val=`eval 'echo $'"${var}"`
  1143.             sed -e "/^${var}[     ]*=/{
  1144.                :loop1
  1145.                /\\\\$/ N
  1146.                /\\\\$/ b loop1
  1147.                s/\\\\\\n//g
  1148.                s%^${var}[     ]*=.*$%${var} = ${val}%
  1149.                }" ${Makefile} > ${Makefile}.tem
  1150.             mv -f ${Makefile}.tem ${Makefile}
  1151.         done
  1152.         fi
  1153.  
  1154.             # final copy now in ${Makefile}
  1155.  
  1156.         else
  1157.            echo "No Makefile.in found in ${srcdir}/${subdir}, unable to configure" 1>&2
  1158.         fi
  1159.  
  1160.         rm -f ${subdir}/Makefile.tem
  1161.  
  1162.         case "${host_makefile_frag}" in
  1163.         "") using= ;;
  1164.         *) using="and \"${host_makefile_frag}\"" ;;
  1165.         esac
  1166.  
  1167.         case "${target_makefile_frag}" in
  1168.         "") ;;
  1169.         *) using="${using} and \"${target_makefile_frag}\"" ;;
  1170.         esac
  1171.  
  1172.         case "${site_makefile_frag}" in
  1173.         "") ;;
  1174.         *) using="${using} and \"${site_makefile_frag}\"" ;;
  1175.         esac
  1176.  
  1177.         newusing=`echo "${using}" | sed 's/and/using/'`
  1178.         using=${newusing}
  1179.         echo "Created \"${Makefile}\" in" ${PWD=`pwd`} ${using}
  1180.  
  1181.         . ${tmpfile}.pos
  1182.  
  1183.         # describe the chosen configuration in config.status.
  1184.         # Make that file a shellscript which will reestablish
  1185.         # the same configuration.  Used in Makefiles to rebuild
  1186.         # Makefiles.
  1187.  
  1188.         case "${norecursion}" in
  1189.         "") arguments="${arguments} --norecursion" ;;
  1190.         *) ;;
  1191.         esac
  1192.  
  1193.         if [ ${subdir} = . ] ; then
  1194.             echo "#!/bin/sh
  1195. # ${NO_EDIT}
  1196. # This directory was configured as follows:
  1197. ${progname}" ${arguments}  "
  1198. # ${using}" > ${subdir}/config.new
  1199.         else
  1200.             echo "#!/bin/sh
  1201. # ${NO_EDIT}
  1202. # This directory was configured as follows:
  1203. cd ${invsubdir}
  1204. ${progname}" ${arguments}  "
  1205. # ${using}" > ${subdir}/config.new
  1206.         fi
  1207.         chmod a+x ${subdir}/config.new
  1208.         if [ -r ${subdir}/config.back ] ; then
  1209.                 mv -f ${subdir}/config.back ${subdir}/config.status
  1210.         fi
  1211.         ${moveifchange} ${subdir}/config.new ${subdir}/config.status
  1212.         ;;
  1213.  
  1214.     *)  rm -f ${Makefile} ${subdir}/config.status ${links} ;;
  1215.     esac
  1216. done
  1217.  
  1218. # If there are subdirectories, then recur. 
  1219. if [ -z "${norecursion}" -a -n "${configdirs}" ] ; then 
  1220.         for configdir in ${configdirs} ; do
  1221.  
  1222.                 if [ -d ${srcdir}/${configdir} ] ; then
  1223.                         eval echo Configuring ${configdir}... ${redirect}
  1224.                         case "${srcdir}" in
  1225.                         ".") ;;
  1226.                         *)
  1227.                                 if [ ! -d ./${configdir} ] ; then
  1228.                                         if mkdir ./${configdir} ; then
  1229.                                                 true
  1230.                                         else
  1231.                                                 echo '***' "${progname}: could not make ${PWD=`pwd`}/${configdir}" 1>&2
  1232.                                                 exit 1
  1233.                                         fi
  1234.                                 fi
  1235.                                 ;;
  1236.                         esac
  1237.  
  1238.                         POPDIR=${PWD=`pwd`}
  1239.                         cd ${configdir} 
  1240.  
  1241. ### figure out what to do with srcdir
  1242.                         case "${srcdir}" in
  1243.                         ".") newsrcdir=${srcdir} ;; # no -srcdir option.  We're building in place.
  1244.                         /*) # absolute path
  1245.                                 newsrcdir=${srcdir}/${configdir}
  1246.                                 srcdiroption="--srcdir=${newsrcdir}"
  1247.                                 ;;
  1248.                         *) # otherwise relative
  1249.                                 newsrcdir=../${srcdir}/${configdir}
  1250.                                 srcdiroption="--srcdir=${newsrcdir}"
  1251.                                 ;;
  1252.                         esac
  1253.  
  1254.             # Handle --cache-file=../XXX
  1255.             case "${cache_file}" in
  1256.             "") # empty
  1257.                 ;;
  1258.             /*) # absolute path
  1259.                 cache_file_option="--cache-file=${cache_file}"
  1260.                 ;;
  1261.             *) # relative path
  1262.                 cache_file_option="--cache-file=../${cache_file}"
  1263.                 ;;
  1264.             esac
  1265.  
  1266. ### check for guested configure, otherwise fix possibly relative progname
  1267.                         if [ -f ${newsrcdir}/configure ] ; then
  1268.                                 recprog=${newsrcdir}/configure
  1269.                         elif [ -f ${newsrcdir}/configure.in ] ; then
  1270.                                 case "${progname}" in
  1271.                                 /*)     recprog=${progname} ;;
  1272.                                 *)      recprog=../${progname} ;;
  1273.                                 esac
  1274.             else
  1275.                 eval echo No configuration information in ${configdir} ${redirect}
  1276.                 recprog=
  1277.                         fi
  1278.  
  1279. ### The recursion line is here.
  1280.             if [ ! -z "${recprog}" ] ; then
  1281.                                 echo ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} ${prefixoption} ${tmpdiroption} ${exec_prefixoption} ${srcdiroption} ${program_prefixoption} ${program_suffixoption} \
  1282.                     ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${removing} ${other_options} ${redirect}
  1283.                     if eval ${config_shell} ${recprog} ${verbose} ${buildopt} --host=${host_alias} --target=${target_alias} \
  1284.                                     ${prefixoption} ${tmpdiroption} ${exec_prefixoption} \
  1285.                                     ${srcdiroption} ${program_prefixoption} ${program_suffixoption} ${program_transform_nameoption} ${site_option} ${withoptions} ${withoutoptions} ${enableoptions} ${disableoptions} ${floating_pointoption} ${cache_file_option} ${removing} ${other_options} ${redirect} ; then
  1286.                                     true
  1287.                             else
  1288.                     echo Configure in `pwd` failed, exiting. 1>&2
  1289.                                     exit 1
  1290.                             fi
  1291.             fi
  1292.  
  1293.                         cd ${POPDIR}
  1294.                 fi
  1295.         done
  1296. fi
  1297.  
  1298. # Perform the same cleanup as the trap handler, minus the "exit 1" of course,
  1299. # and reset the trap handler.
  1300. rm -f ${tmpfile}.com ${tmpfile}.tgt ${tmpfile}.hst ${tmpfile}.pos
  1301. trap 0
  1302.  
  1303. exit 0
  1304.  
  1305. #
  1306. # Local Variables:
  1307. # fill-column: 131
  1308. # End:
  1309. #
  1310.  
  1311. # end of configure
  1312.