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