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